collection/shuffle.js

  1. import _shuffle from 'lodash/shuffle'
  2. import { convert } from 'util/convert'
  3. /**
  4. * Replaces by an array of shuffled elements.
  5. * @function
  6. * @memberof collection
  7. * @param {Object} object The object to modify.
  8. * @param {Array|string} path The path of the property to set.
  9. * @return {Object} Returns the updated object.
  10. * @see {@link https://lodash.com/docs#shuffle|lodash.shuffle} for more information.
  11. * @example shuffle({ nested: { prop: [1, 2, 3, 4, 5, 6, 7, 8, 9] } }, 'nested.prop') // => { nested: { prop: [7, 3, 9, 1, 4, 5, 6, 8, 2] } }
  12. * @since 0.3.0
  13. */
  14. const shuffle = convert(_shuffle)
  15. export { shuffle, shuffle as default }