Code Monkey home page Code Monkey logo

inspirational-quotes's Introduction

โšก Inspirational Quotes โšก

Get Inspired!

NPM VERSION GitHub license Snyk Vulnerabilities for npm package version npm PRs Welcome

Inspirational-Quotes NPM package example

Installation

NPM:

npm install @anilseervi/inspirational-quotes

Yarn:

yarn add @anilseervi/inspirational-quotes

Usage

Check out all the existing quotes.

Following exports are available from the module:

  • getAll() - returns all quotes
  • getRandom() - returns a random quote

The result is in the following shape:

{
  "quote": "Always bet on JavaScript!",
  "author": "Brendan Eich"
}

Some quotes optionally have the source key. For example:

{
  "quote": "Amateurs know that contributing something is better than contributing nothing.",
  "author": "Austin Kleon",
  "source": "Show Your Work!"
}

Example

// Use require or import, either works
import { getAll, getRandom } from '@anilseervi/inspirational-quotes'

console.log(`All quotes`, getAll())
console.log(`A random quote`, getRandom())

Contributing

Contributions are welcome! Please read the contributing guidelines first.

Author

inspirational-quotes's People

Contributors

andrewbrey avatar anilseervi avatar anishshobithps avatar linaseervi avatar mariyammajeed avatar officialpiyush avatar patrickpsantos avatar pratheek-raghunath avatar sanjana-bhat-02 avatar satnaing avatar shyam-3110 avatar sunb3am avatar vaishnav-nt avatar zenbeam avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

inspirational-quotes's Issues

Add test to check quotes doesn't contain apostrophe

Describe the feature you'd like to request

Write a new test case to check that quotes don't contain apostrophes(') but right single quote(โ€™)

Well you might say :
whats the difference

Hmmm:
nothing

Describe the solution you'd like

Write a Test 04 : Check for proper quote format in All Quotes test in basic.test.ts file.

  1. use getAll() to get all the quotes.
  2. Do a for of loop over the Array from step 1
  3. assert() that every quote doesn't includes(`'`) apostrophe.

Describe alternatives you've considered

It'd be interesting to see other solutions to this test case.

Update test so that a `quote` can also end with question mark `?`

Describe the feature you'd like to request

Current Behaviour

Currently the test case Test 02: All Quotes end with a period checks if the all the quotes

  • end with a period(.)
  • or end with a exclamation(!)

Behaviour Wanted

assert the test case so that quote can also end with question mark(?)

Describe the solution you'd like

Assert the quote can end with question mark (?)

  1. Head to basic.test.ts file.
  2. Navigate to Test 02: All Quotes end with a period test
  3. assert : quote.quote.endsWith(`?`)

Describe alternatives you've considered

N/A

Tasks

Add test to check for duplicate quote entries

Describe the feature you'd like to request

Write a test case to find any duplicates in the quote field of the quotes Array

image

Describe the solution you'd like

Write a Test 03: Check for duplicate quotes in All Quotes test in basic.test.ts file.

  1. use getAll() to get all the quotes.
  2. Create an new Array containing all values from quote key
  3. Create an array containing unique values of the array in step 2. (use new Set())
  4. Compare both the arrays from step 2 and step 3

Use expect() assertion from 'vitest' and tack on the toEqual() on the assertion for step 4

Describe alternatives you've considered

It'd be interesting to see other solutions to this test case.

`Array.push()` more quotes to the list

Describe the feature you'd like to request

Push more quotes into the quotes Array :

More quotes

Describe the solution you'd like

Follow the Contributing Guidelines to add more quotes.

  1. You fork the repo
  2. Then clone the repo to local machine
  3. Create a new branch
  4. Install the deps
  5. Then you open the quotes.ts file
  6. Add the quote at the end of the quotes Array while following the guidelines
  7. Lint it, Format it, Test it ๐Ÿซฃ
  8. Push it to your fork
  9. Open a PR to this repo's main branch

Describe alternatives you've considered

You let GitHub GUI do all the work for you.

Do this at your own risk cuz some of the tests might fail when you raise the PR

  1. Navigate to quotes.ts
  2. Press E or click on the edit icon.
  3. Navigate to the end of the Array and add the quote while following all the quote guidelines.
  4. Commit the change and PR it. Ezzz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.