demotivator
Version:
A extremely large array of 300+ insults so you can integrate the power of (de)Motivator into your webapp.
17 lines • 650 B
JavaScript
import { insults } from './insults';
/**
* @returns a psuedorandom insult from the insult array.
*/
export default function generateInsult(array = insults) {
array || (array = insults);
return array[Math.floor(Math.random() * array.length)];
}
/**
* Get a specific insult from a point and array that you specify
*
* @param {Insult[]} [array=insults] The array to select from. Deault is original only
* @param {number} position The position in the array to select. Starts indexing at 1, not 0.
* @returns {Insult}
*/
export const insultAt = (position, array = insults) => array[position - 1];
//# sourceMappingURL=generateinsult.js.map