You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 406B

123456789101112131415
  1. 'use strict';
  2. const spinners = Object.assign({}, require('./spinners.json')); // eslint-disable-line import/extensions
  3. const spinnersList = Object.keys(spinners);
  4. Object.defineProperty(spinners, 'random', {
  5. get() {
  6. const randomIndex = Math.floor(Math.random() * spinnersList.length);
  7. const spinnerName = spinnersList[randomIndex];
  8. return spinners[spinnerName];
  9. }
  10. });
  11. module.exports = spinners;