mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
define(['../internal/baseFlatten', '../internal/bindCallback', '../internal/pickByArray', '../internal/pickByCallback'], function(baseFlatten, bindCallback, pickByArray, pickByCallback) {
|
||||
define(['../internal/baseFlatten', '../internal/bindCallback', '../internal/pickByArray', '../internal/pickByCallback', '../function/restParam'], function(baseFlatten, bindCallback, pickByArray, pickByCallback, restParam) {
|
||||
|
||||
/**
|
||||
* Creates an object composed of the picked `object` properties. Property
|
||||
* names may be specified as individual arguments or as arrays of property
|
||||
* names. If `predicate` is provided it is invoked for each property of `object`
|
||||
* picking the properties `predicate` returns truthy for. The predicate is
|
||||
* bound to `thisArg` and invoked with three arguments; (value, key, object).
|
||||
* bound to `thisArg` and invoked with three arguments: (value, key, object).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -26,14 +26,14 @@ define(['../internal/baseFlatten', '../internal/bindCallback', '../internal/pick
|
||||
* _.pick(object, _.isString);
|
||||
* // => { 'user': 'fred' }
|
||||
*/
|
||||
function pick(object, predicate, thisArg) {
|
||||
var pick = restParam(function(object, props) {
|
||||
if (object == null) {
|
||||
return {};
|
||||
}
|
||||
return typeof predicate == 'function'
|
||||
? pickByCallback(object, bindCallback(predicate, thisArg, 3))
|
||||
: pickByArray(object, baseFlatten(arguments, false, false, 1));
|
||||
}
|
||||
return typeof props[0] == 'function'
|
||||
? pickByCallback(object, bindCallback(props[0], props[1], 3))
|
||||
: pickByArray(object, baseFlatten(props));
|
||||
});
|
||||
|
||||
return pick;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user