_baseSample.js 357 B

123456789101112131415
  1. import arraySample from './_arraySample.js';
  2. import values from './values.js';
  3. /**
  4. * The base implementation of `_.sample`.
  5. *
  6. * @private
  7. * @param {Array|Object} collection The collection to sample.
  8. * @returns {*} Returns the random element.
  9. */
  10. function baseSample(collection) {
  11. return arraySample(values(collection));
  12. }
  13. export default baseSample;