2.1.1 • Published 7 years ago
tech-quote-of-the-week v2.1.1
tech-quote-of-the-week
A library to get every week a new tech quote that might be enjoyed by the fullstack developer.
Install
With NPM:
npm install tech-quote-of-the-week
with Yarn:
yarn add tech-quote-of-the-week
Usage
ES5 example:
var techQuoteOfTheWeek = require('tech-quote-of-the-week').default;
console.log(techQuoteOfTheWeek()()); // changes every week based on current time
// You can pass a custom week number (from 1 to 53) to get a different quote
console.log(techQuoteOfTheWeek()(23));
ES2015 example:
import { techQuoteOfTheWeek } from 'tech-quote-of-the-week';
console.log(techQuoteOfTheWeek()()); // changes every week based on current time
// You can pass a custom week number (from 1 to 53) to get a different quote
console.log(techQuoteOfTheWeek()(23));
Sample output:
{
"id": "6",
"text": "One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man",
"author": "Elbert Hubbard",
"authorDescription": "Author",
"authorUrl": "https://en.wikipedia.org/wiki/Elbert_Hubbard"
}
Options
You can pass a custom array of quotes in the initialization function in case you want to use the same algorithm in a custom set of quotes.
E.g.
import { techQuoteOfTheWeek } from 'tech-quote-of-the-week';
const quotes = [
{"id":"1","text":"Technology is anything that wasn’t around when you were born","author":"Alan Kay","authorDescription":"Computer Scientist", "authorUrl":"https://en.wikipedia.org/wiki/Alan_Kay"},
{"id":"2","text":"Any sufficiently advanced technology is equivalent to magic","author":"Arthur C. Clarke","authorDescription":"Author","authorUrl":"https://en.wikipedia.org/wiki/Arthur_C._Clarke"}
];
console.log(techQuoteOfTheWeek(quotes)());
Contributing
Everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by opening an issue on GitHub.
License
Licensed under MIT License. © Luciano Mammino.