Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

12345678910111213141516171819202122232425
  1. var arrayShuffle = require('./_arrayShuffle'),
  2. baseShuffle = require('./_baseShuffle'),
  3. isArray = require('./isArray');
  4. /**
  5. * Creates an array of shuffled values, using a version of the
  6. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  7. *
  8. * @static
  9. * @memberOf _
  10. * @since 0.1.0
  11. * @category Collection
  12. * @param {Array|Object} collection The collection to shuffle.
  13. * @returns {Array} Returns the new shuffled array.
  14. * @example
  15. *
  16. * _.shuffle([1, 2, 3, 4]);
  17. * // => [4, 1, 3, 2]
  18. */
  19. function shuffle(collection) {
  20. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  21. return func(collection);
  22. }
  23. module.exports = shuffle;