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.

15 line
359 B

4 年之前
  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;