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: 2 months 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 (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-11-29T09:55:18.000Z (over 1 year ago)
- Last Synced: 2025-08-15T22:22:58.827Z (10 months 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: 1
- 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.