Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/masterbrian99/quote-lib
random quote npm package
https://github.com/masterbrian99/quote-lib
git github node nodejs npm quote quote-generator quotes
Last synced: 17 days ago
JSON representation
random quote npm package
- Host: GitHub
- URL: https://github.com/masterbrian99/quote-lib
- Owner: MasterBrian99
- License: mit
- Created: 2020-12-26T13:18:28.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-29T09:55:18.000Z (about 1 month ago)
- Last Synced: 2024-12-13T10:27:25.909Z (21 days ago)
- Topics: git, github, node, nodejs, npm, quote, quote-generator, quotes
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/quote-lib
- Size: 179 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Quote Lib
A simple library for generating quotes.
## Installation
```bash
npm install quote-lib
```## Usage
### Random Quote
```js
import { getRandomQuote } from "quote-lib";
console.log(getRandomQuote());
```#### Output
```bash
{
id: 5,
text: "If you can't explain it simply, you don't understand it well enough.",
author: 'Albert Einstein',
category: [ 'motivational', 'education' ]
}
```### Get Quote by ID
```js
import { getQuoteById } from "quote-lib";
console.log(getQuoteById(5));
```#### Output
```bash
{
id: 5,
text: "If you can't explain it simply, you don't understand it well enough.",
author: 'Albert Einstein',
category: [ 'motivational', 'education' ]
}
```### Get Quote by Category
```js
import { getQuoteByCategory } from "quote-lib";
console.log(getQuoteByCategory("motivational"));
```#### Output
```bash
{
id: 1,
text: "If you can't explain it simply, you don't understand it well enough.",
author: 'Albert Einstein',
category: [ 'motivational', 'education' ]
}
```### Get Quotes by Author
```js
import { getQuotesByAuthor } from "quote-lib";
console.log(getQuotesByAuthor("Chris Grosser"));
```#### Output
```bash
[
{
id: 3,
text: "Opportunities don't happen, you create them.",
author: 'Chris Grosser',
category: [ 'motivational', 'entrepreneur' ]
}
]
```### Get Quote by Author
```js
import { getQuoteByAuthor } from "quote-lib";
console.log(getQuotesByAuthor("Chris Grosser"));
```#### Output
```bash
{
id: 3,
text: "Opportunities don't happen, you create them.",
author: 'Chris Grosser',
category: [ 'motivational', 'entrepreneur' ]
}
```## License
MIT © [Pasindu P Konghawaththa](https://github.com/MasterBrian99/quote-lib)
## Contributing
please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.