popular-movie-quotes
Version:
A simple NPM package to get popular movie quotes
178 lines (128 loc) • 9.22 kB
Markdown
      
[](https://www.npmjs.com/package/popular-movie-quotes) [](https://github.com/NikhilNamal17/popular-movie-quotes) [](https://github.com/NikhilNamal17/NikhilNamal17)

#### A simple [NPM](https://www.npmjs.com/package/popular-movie-quotes) package to get popular movie quotes.
## Getting started
[](https://nodei.co/npm/popular-movie-quotes/)
```bash
$ npm i popular-movie-quotes --save
```
## Installation
[](https://docs.npmjs.com/getting-started/installing-npm-packages-locally) [](https://nodejs.org/en/) [](https://www.npmjs.com/package/popular-movie-quotes)
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/).
Before installing, [download and install Node.js](https://nodejs.org/en/download/).
Installation is done using the
**[`npm install`](https://docs.npmjs.com/getting-started/installing-npm-packages-locally)** command:
```bash
$ npm i popular-movie-quotes --save
```
## Usage
[](https://github.com/NikhilNamal17/popular-movie-quotes)
- **getAll()** method returns an array of objects, each containing **quote** and **movie**.
```json
{
"quote": "Frankly, my dear, I don't give a damn.",
"movie": "Gone with the Wind",
"type": "movie",
"year": 1939
}
```
- **getQuoteByYear(startYear, endYear)** method returns a sorted object within the range of year startYear -endYear\*\*
```json
[
{
"quote": "Frankly, my dear, I don't give a damn.",
"movie": "Gone with the Wind",
"type": "movie",
"year": startYear
}
...
.....
{
"quote": "Frankly, my dear, I don't give a damn.",
"movie": "Gone with the Wind",
"type": "movie",
"year": endYear
}
]
```
- **getSomeRandom(count)** method returns an array (of length 'count') of non-duplicate random objects containing **quote** and **movie**.
```json
[
{
"quote": "Frankly, my dear, I don't give a damn.",
"movie": "Gone with the Wind",
"type": "movie",
"year": 1939
}
// with 'count' number of quote objects.
]
```
- **getRandomQuote()** method returns a random **movie** quote :
```javascript
I used to think that my life was a tragedy. But now I realize, it’s a comedy.
```
- **getQuotesByMovie("MovieName")** method returns an array with all quotes of MovieName movie, else returns empty.
```json
[
{
"quote": "Frankly, my dear, I don't give a damn.",
"movie": "Gone with the Wind",
"type": "movie",
"year": 1939
}
]
```
- **getQuotesByType("movie/anime/tv")** method returns an array with all quotes of type movie/anime/tv, else returns empty.
```json
[
{
"quote": "Frankly, my dear, I don't give a damn.",
"movie": "Gone with the Wind",
"type": "movie",
"year": 1939
}
...
.....
{
"quote": "You all love twisting the knife into one another.",
"movie": "Knives Out",
"type": "movie",
"year": 2019
}
]
```
```javascript
const movieQuote = require("popular-movie-quotes");
console.log(movieQuote.getAll()); //returns an object with all available quotes.
console.log(movieQuote.getSomeRandom(10)); // returns an object of 10 random quotes.
console.log(movieQuote.getRandomQuote()); // returns a random quote
console.log(movieQuote.getQuoteByYear(2000, 2019)); // returns a sorted object within
// the range of year 2000-2019
console.log(movieQuote.getQuotesByMovie("Joker")); //If present returns and array
// with all quotes of joker movie, else returns empty.
console.log(movieQuote.getQuotesByType("anime")); //If present returns and array
// with all quotes of type anime, else returns empty.
```
## Testing
- Check if quote is duplicate/already present.
```bash
$ npm test
```
## Want to contribute?
[](https://github.com/NikhilNamal17) [](https://github.com/NikhilNamal17/popular-movie-quotes)
> Please check issues **[here](https://github.com/NikhilNamal17/popular-movie-quotes/issues)**!
## License

## Let's get connected
[](https://twitter.com/Nikhil17_namal) [](https://github.com/NikhilNamal17/) [](https://www.facebook.com/nikhil.namal) [](https://www.instagram.com/nikhil_namal17/) [](https://www.linkedin.com/in/nikhil_namal17/)
## Special Thanks
#### Karan Bhatt [](https://www.facebook.com/karan.bhatt.7524) [](https://www.instagram.com/karanbhatt/) [](https://github.com/ItachiHyuga/)
#### Rishabh Kanojia [](https://www.facebook.com/rishabh.kanojiya.18) [](https://www.instagram.com/rishabhkanojiya/) [](https://github.com/rishabhkanojiya/)
## Support me for a couple of coffee
Hey! Help me out with a couple of coffee!
<a href="https://www.buymeacoffee.com/nikhilnamal" target="_blank"><img src="https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
[](https://ko-fi.com/I2I215TEM)
<hr>
[](https://forthebadge.com) [](https://forthebadge.com) [](https://forthebadge.com) [](https://forthebadge.com)