_baseSample.js 359 B

123456789101112131415
  1. var arraySample = require('./_arraySample'),
  2. values = require('./values');
  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. module.exports = baseSample;