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.
16 lines
359 B
16 lines
359 B
6 years ago
|
var arraySample = require('./_arraySample'),
|
||
|
values = require('./values');
|
||
|
|
||
|
/**
|
||
|
* The base implementation of `_.sample`.
|
||
|
*
|
||
|
* @private
|
||
|
* @param {Array|Object} collection The collection to sample.
|
||
|
* @returns {*} Returns the random element.
|
||
|
*/
|
||
|
function baseSample(collection) {
|
||
|
return arraySample(values(collection));
|
||
|
}
|
||
|
|
||
|
module.exports = baseSample;
|