mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Bump to v4.16.2.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import arraySample from './_arraySample.js';
|
||||
import isArrayLike from './isArrayLike.js';
|
||||
import values from './values.js';
|
||||
import baseSample from './_baseSample.js';
|
||||
import isArray from './isArray.js';
|
||||
|
||||
/**
|
||||
* Gets a random element from `collection`.
|
||||
@@ -17,7 +17,8 @@ import values from './values.js';
|
||||
* // => 2
|
||||
*/
|
||||
function sample(collection) {
|
||||
return arraySample(isArrayLike(collection) ? collection : values(collection));
|
||||
var func = isArray(collection) ? arraySample : baseSample;
|
||||
return func(collection);
|
||||
}
|
||||
|
||||
export default sample;
|
||||
|
||||
Reference in New Issue
Block a user