set - nodef/extra-quotes GitHub Wiki

Manually sets quotes, with specified name.

quotes.set(name, value);
// name:  name of quote group (corpus)
// value: array of quotes [{text, by, ref}]
// --> quotes function
const quotes = require('extra-quotes');

await quotes.load('mahatma gandhi');
/* loads Mahatma Gandhi quotes from Wikiquote */

await quotes.load();
/* loads local popular movie quotes */

quotes.set('me', [{
  text: 'Success is my last name.'
  by: 'me',
  ref: null
}]);
/* set custom quotes */

quotes.corpora;
// Map {'Mahatma Gandhi' => quotes, '' => movie quotes, 'me' => quotes}

quotes('success');
// [ { text:
//      "Satan's successes are the greatest when he appears with the name of God on his lips.",
//     by: 'Mahatma Gandhi',
//     ref:
//      `"The Inwardness of Non-Co-operation". Quoted in Freedom's Battle: Being a Comprehensive Collection of Writings and Speeches (1922), p. 144.` },
//   { text: 'Success is my last name.',
//     by: 'me',
//     ref: null } ]