Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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.