Inspirational-quotes
製品情報
ユースケース
公開チャット
サポートプラン
現在利用可能なOSSプランはありません
リポジトリのプロバイダーまたは寄稿者である場合は、OSSプランの追加を開始できます。
OSSプランを追加するこのOSSプランをお探しの場合は、お問い合わせください。
製品詳細
Inspirational Quotes
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 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 ofgetRandomQuote
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 testsnpm 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
- Head to
data/data.json
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. :tada:
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 :heart:
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
Author
Vinit Shahdeo |
Support
Thank you for being here! One day your life will flash before your eyes. Make sure it is worth watching!
_____ _ _____ _ _
/ ____| | |_ _| (_) | |
| (___ | |_ __ _ _ _ | | _ __ ___ _ __ _ _ __ ___ __| |
\___ \| __/ _` | | | | | | | '_ \/ __| '_ \| | '__/ _ \/ _` |
____) | || (_| | |_| | _| |_| | | \__ \ |_) | | | | __/ (_| |
|_____/ \__\__,_|\__, | |_____|_| |_|___/ .__/|_|_| \___|\__,_|
__/ | | |
|___/ |_|