UNPKG

weiser-leaders-quotes

Version:

A package that returns a random quote from w(e)ise world leaders.

39 lines (33 loc) 867 B
// quotes.js const quotes = [ { quote: "The only thing we have to fear is fear itself.", author: "Franklin D. Roosevelt", country: "United States", year: 1933, category: "leadership" }, { quote: "Be the change you wish to see in the world.", author: "Mahatma Gandhi", country: "India", category: "inspiration" }, // Add more quotes here ]; // index.js class WorldLeaderQuotes { constructor() { this.quotes = quotes; } getRandomQuote() { const randomIndex = Math.floor(Math.random() * this.quotes.length); return this.quotes[randomIndex]; } getQuoteByAuthor(author) { return this.quotes.filter(quote => quote.author.toLowerCase().includes(author.toLowerCase()) ); } } module.exports = WorldLeaderQuotes;