Skip to content

💡 A simple NPM Package which returns random Inspirational Quotes. Get your daily quote and stay motivated! ✌️ 🌸

License

Notifications You must be signed in to change notification settings

MembaDavid/inspirational-quotes

 
 

Repository files navigation

Inspirational Quotes

NPM VERSION GitHub license npm collaborators Snyk Vulnerabilities for npm package version npm PRs Welcome

A simple NPM Package which returns random Inspirational Quotes. It provides awesome quotes to display in your application. Get your daily quote and stay motivated!

Click here to view this package on NPM registry. Check the homepage here.

Getting started

NPM

$ npm install --save inspirational-quotes

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js.

Installation is done using the npm install command:

$ npm install inspirational-quotes

Usage

const Quote = require('inspirational-quotes');

console.log(Quote.getQuote()); // returns quote (text and author)
console.log(Quote.getQuote({ author: false }); // return quote without author
console.log(Quote.getRandomQuote()); // return any random quote
  • getQuote() method returns an object containing text and author.
 {  
    "text":"My number one piece of advice is: you should learn how to program.",
    "author":"Mark Zuckerberg, founder of Facebook"
 }
  • getRandomQuote() method returns a random inspirational quote : You miss 100 percent of the shots you don’t take.

Options

Additionally you can provide options to getQuote method. By default { author: true } is used.

getQuote({ author: false });
  • { author: true }: Returns a quote with author information
  • { author: false }: Returns a quote without author information

Note: Recommended to use getQuote with { author: false} option instead of getRandomQuote as it will be deprecated in the further versions. It's available just to ensure the backward compatability.

Examples

To view the examples, clone the inspirational-quotes repo and install the dependencies:

$ git clone https://github.com/vinitshahdeo/inspirational-quotes.git
$ cd inspirational-quotes
$ npm install

Then run the examples/index.js:

$ node examples

Tests

  • npm run test: Runs unit tests
  • npm run test-lint: Run lint tests

Contributing

Do you know any inspirational quotes so one can start working by taking control over thoughts, thinking positively and setting new goals? Append your quote to data.json inside the data/ directory and raise the PR.

Please check [ISSUE #4] : Add More Inspirational Quotes (Recommended for beginners)

Steps to follow:

  • Clone the repository and create a new branch
git clone https://github.com/vinitshahdeo/inspirational-quotes.git
git checkout feature/new-quote
cd data
vi data.json
  • Add a quote at random index (just to avoid conflicts if every PR appends a quote at the last)
 {  
    "text":"Your Awesome Quote",
    "from":"Name of author"
 }
  • Run tests locally
npm run test-lint
npm run test
  • Tests passed successfully?

    • If yes, please raise a pull request to add the quote
    • Otherwise, fix the tests and run the tests again
  • Sit and relax! You've made your contribution. 🎉

Disclaimer: There're so many open pull requests. It's not possible for me to merge them all manually. I will write an automation script if that's possible. If you've an idea, please feel free to share it on discussions. Happy to take it forward from there.

Stargazer ❤️

Stargazers repo roster for @vinitshahdeo/inspirational-quotes

Related Works

  • Checkout Quotter - A twitter bot which tweets random quotes with image and #hashtags!

  • Click here to view applications created by open-source community using this module.

I'll be more than happy to know if you build something using this module. Tweet your work at @Vinit_Shahdeo

Twitter Follow

Author

Vinit Shahdeo

Support

Open Source Love GitHub followers

Thank you for being here! One day your life will flash before your eyes. Make sure it is worth watching!

  • You can find my other NPM Packages here.
  • Find my blog here.

"Buy Me A Coffee"


   _____ _                _____                 _              _ 
  / ____| |              |_   _|               (_)            | |
 | (___ | |_ __ _ _   _    | |  _ __  ___ _ __  _ _ __ ___  __| |
  \___ \| __/ _` | | | |   | | | '_ \/ __| '_ \| | '__/ _ \/ _` |
  ____) | || (_| | |_| |  _| |_| | | \__ \ |_) | | | |  __/ (_| |
 |_____/ \__\__,_|\__, | |_____|_| |_|___/ .__/|_|_|  \___|\__,_|
                   __/ |                 | |                     
                  |___/                  |_|                     

About

💡 A simple NPM Package which returns random Inspirational Quotes. Get your daily quote and stay motivated! ✌️ 🌸

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%