/popular-movie-quotes

A simple NPM package which returns popular movie quotes.

Primary LanguageJavaScriptMIT LicenseMIT

GitHub license NPM MODULE NPM MODULE NPM MODULE NPM MODULE NPM MODULE NPM MODULE npm GitHub last commit Maintenance

A simple NPM package to get popular movie quotes.

Getting started

NPM

$ npm i popular-movie-quotes --save

Installation

NPM INSTALL NODE JS NODE JS

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 i popular-movie-quotes --save

Usage

usage

  • getAll() method returns an array of objects, each containing quote and movie.
{
    "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**
[
    {
        "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.
[
    {
        "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 :
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.
[
    {
        "quote": "Frankly, my dear, I don't give a damn.",
        "movie": "Gone with the Wind",
        "type": "movie",
        "year": 1939
    }
]
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.

Testing

  • Check if quote is duplicate/already present.
$ npm test

Want to contribute?

Open Source Love forthebadge

Please check issues here!

License

GitHub license

Let's get connected

Twitter Follow GitHub followers Facebook Instagram LinkedIn

Special Thanks

Karan Bhatt Facebook Instagram GitHub followers

Rishabh Kanojia Facebook Instagram GitHub followers

Support me on Buy Me A Coffee

Hey! Help me out with a couple of coffee!

Buy Me A Coffee


forthebadge forthebadge forthebadge forthebadge