mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Bump to v3.6.0.
This commit is contained in:
@@ -4,7 +4,7 @@ define(['../internal/baseAssign', '../internal/createAssigner'], function(baseAs
|
||||
* Assigns own enumerable properties of source object(s) to the destination
|
||||
* object. Subsequent sources overwrite property assignments of previous sources.
|
||||
* If `customizer` is provided it is invoked to produce the assigned values.
|
||||
* The `customizer` is bound to `thisArg` and invoked with five arguments;
|
||||
* The `customizer` is bound to `thisArg` and invoked with five arguments:
|
||||
* (objectValue, sourceValue, key, object, source).
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['../internal/arrayCopy', './assign', '../internal/assignDefaults'], function(arrayCopy, assign, assignDefaults) {
|
||||
define(['./assign', '../internal/assignDefaults', '../function/restParam'], function(assign, assignDefaults, restParam) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -19,14 +19,14 @@ define(['../internal/arrayCopy', './assign', '../internal/assignDefaults'], func
|
||||
* _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
|
||||
* // => { 'user': 'barney', 'age': 36 }
|
||||
*/
|
||||
function defaults(object) {
|
||||
var defaults = restParam(function(args) {
|
||||
var object = args[0];
|
||||
if (object == null) {
|
||||
return object;
|
||||
}
|
||||
var args = arrayCopy(arguments);
|
||||
args.push(assignDefaults);
|
||||
return assign.apply(undefined, args);
|
||||
}
|
||||
});
|
||||
|
||||
return defaults;
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
define(['../internal/baseCallback', '../internal/baseFind', '../internal/baseForOwn'], function(baseCallback, baseFind, baseForOwn) {
|
||||
define(['../internal/baseForOwn', '../internal/createFindKey'], function(baseForOwn, createFindKey) {
|
||||
|
||||
/**
|
||||
* This method is like `_.findIndex` except that it returns the key of the
|
||||
* first element `predicate` returns truthy for, instead of the element itself.
|
||||
* This method is like `_.find` except that it returns the key of the first
|
||||
* element `predicate` returns truthy for instead of the element itself.
|
||||
*
|
||||
* If a property name is provided for `predicate` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
@@ -48,10 +48,7 @@ define(['../internal/baseCallback', '../internal/baseFind', '../internal/baseFor
|
||||
* _.findKey(users, 'active');
|
||||
* // => 'barney'
|
||||
*/
|
||||
function findKey(object, predicate, thisArg) {
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
return baseFind(object, predicate, baseForOwn, true);
|
||||
}
|
||||
var findKey = createFindKey(baseForOwn);
|
||||
|
||||
return findKey;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['../internal/baseCallback', '../internal/baseFind', '../internal/baseForOwnRight'], function(baseCallback, baseFind, baseForOwnRight) {
|
||||
define(['../internal/baseForOwnRight', '../internal/createFindKey'], function(baseForOwnRight, createFindKey) {
|
||||
|
||||
/**
|
||||
* This method is like `_.findKey` except that it iterates over elements of
|
||||
@@ -48,10 +48,7 @@ define(['../internal/baseCallback', '../internal/baseFind', '../internal/baseFor
|
||||
* _.findLastKey(users, 'active');
|
||||
* // => 'pebbles'
|
||||
*/
|
||||
function findLastKey(object, predicate, thisArg) {
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
return baseFind(object, predicate, baseForOwnRight, true);
|
||||
}
|
||||
var findLastKey = createFindKey(baseForOwnRight);
|
||||
|
||||
return findLastKey;
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
define(['../internal/baseFor', '../internal/bindCallback', './keysIn'], function(baseFor, bindCallback, keysIn) {
|
||||
define(['../internal/baseFor', '../internal/createForIn'], function(baseFor, createForIn) {
|
||||
|
||||
/**
|
||||
* Iterates over own and inherited enumerable properties of an object invoking
|
||||
* `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked
|
||||
* with three arguments; (value, key, object). Iterator functions may exit
|
||||
* with three arguments: (value, key, object). Iterator functions may exit
|
||||
* iteration early by explicitly returning `false`.
|
||||
*
|
||||
* @static
|
||||
@@ -27,12 +27,7 @@ define(['../internal/baseFor', '../internal/bindCallback', './keysIn'], function
|
||||
* });
|
||||
* // => logs 'a', 'b', and 'c' (iteration order is not guaranteed)
|
||||
*/
|
||||
function forIn(object, iteratee, thisArg) {
|
||||
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') {
|
||||
iteratee = bindCallback(iteratee, thisArg, 3);
|
||||
}
|
||||
return baseFor(object, iteratee, keysIn);
|
||||
}
|
||||
var forIn = createForIn(baseFor);
|
||||
|
||||
return forIn;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['../internal/baseForRight', '../internal/bindCallback', './keysIn'], function(baseForRight, bindCallback, keysIn) {
|
||||
define(['../internal/baseForRight', '../internal/createForIn'], function(baseForRight, createForIn) {
|
||||
|
||||
/**
|
||||
* This method is like `_.forIn` except that it iterates over properties of
|
||||
@@ -25,10 +25,7 @@ define(['../internal/baseForRight', '../internal/bindCallback', './keysIn'], fun
|
||||
* });
|
||||
* // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
|
||||
*/
|
||||
function forInRight(object, iteratee, thisArg) {
|
||||
iteratee = bindCallback(iteratee, thisArg, 3);
|
||||
return baseForRight(object, iteratee, keysIn);
|
||||
}
|
||||
var forInRight = createForIn(baseForRight);
|
||||
|
||||
return forInRight;
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
define(['../internal/baseForOwn', '../internal/bindCallback'], function(baseForOwn, bindCallback) {
|
||||
define(['../internal/baseForOwn', '../internal/createForOwn'], function(baseForOwn, createForOwn) {
|
||||
|
||||
/**
|
||||
* Iterates over own enumerable properties of an object invoking `iteratee`
|
||||
* for each property. The `iteratee` is bound to `thisArg` and invoked with
|
||||
* three arguments; (value, key, object). Iterator functions may exit iteration
|
||||
* three arguments: (value, key, object). Iterator functions may exit iteration
|
||||
* early by explicitly returning `false`.
|
||||
*
|
||||
* @static
|
||||
@@ -27,12 +27,7 @@ define(['../internal/baseForOwn', '../internal/bindCallback'], function(baseForO
|
||||
* });
|
||||
* // => logs 'a' and 'b' (iteration order is not guaranteed)
|
||||
*/
|
||||
function forOwn(object, iteratee, thisArg) {
|
||||
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') {
|
||||
iteratee = bindCallback(iteratee, thisArg, 3);
|
||||
}
|
||||
return baseForOwn(object, iteratee);
|
||||
}
|
||||
var forOwn = createForOwn(baseForOwn);
|
||||
|
||||
return forOwn;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['../internal/baseForRight', '../internal/bindCallback', './keys'], function(baseForRight, bindCallback, keys) {
|
||||
define(['../internal/baseForOwnRight', '../internal/createForOwn'], function(baseForOwnRight, createForOwn) {
|
||||
|
||||
/**
|
||||
* This method is like `_.forOwn` except that it iterates over properties of
|
||||
@@ -25,10 +25,7 @@ define(['../internal/baseForRight', '../internal/bindCallback', './keys'], funct
|
||||
* });
|
||||
* // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'
|
||||
*/
|
||||
function forOwnRight(object, iteratee, thisArg) {
|
||||
iteratee = bindCallback(iteratee, thisArg, 3);
|
||||
return baseForRight(object, iteratee, keys);
|
||||
}
|
||||
var forOwnRight = createForOwn(baseForOwnRight);
|
||||
|
||||
return forOwnRight;
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ define(['../internal/baseCallback', '../internal/baseForOwn'], function(baseCall
|
||||
/**
|
||||
* Creates an object with the same keys as `object` and values generated by
|
||||
* running each own enumerable property of `object` through `iteratee`. The
|
||||
* iteratee function is bound to `thisArg` and invoked with three arguments;
|
||||
* iteratee function is bound to `thisArg` and invoked with three arguments:
|
||||
* (value, key, object).
|
||||
*
|
||||
* If a property name is provided for `iteratee` the created `_.property`
|
||||
|
||||
@@ -7,7 +7,7 @@ define(['../internal/baseMerge', '../internal/createAssigner'], function(baseMer
|
||||
* provided it is invoked to produce the merged values of the destination and
|
||||
* source properties. If `customizer` returns `undefined` merging is handled
|
||||
* by the method instead. The `customizer` is bound to `thisArg` and invoked
|
||||
* with five arguments; (objectValue, sourceValue, key, object, source).
|
||||
* with five arguments: (objectValue, sourceValue, key, object, source).
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['../internal/arrayMap', '../internal/baseDifference', '../internal/baseFlatten', '../internal/bindCallback', './keysIn', '../internal/pickByArray', '../internal/pickByCallback'], function(arrayMap, baseDifference, baseFlatten, bindCallback, keysIn, pickByArray, pickByCallback) {
|
||||
define(['../internal/arrayMap', '../internal/baseDifference', '../internal/baseFlatten', '../internal/bindCallback', './keysIn', '../internal/pickByArray', '../internal/pickByCallback', '../function/restParam'], function(arrayMap, baseDifference, baseFlatten, bindCallback, keysIn, pickByArray, pickByCallback, restParam) {
|
||||
|
||||
/**
|
||||
* The opposite of `_.pick`; this method creates an object composed of the
|
||||
@@ -6,7 +6,7 @@ define(['../internal/arrayMap', '../internal/baseDifference', '../internal/baseF
|
||||
* 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` omitting the properties `predicate` returns truthy for. The
|
||||
* predicate is bound to `thisArg` and invoked with three arguments;
|
||||
* predicate is bound to `thisArg` and invoked with three arguments:
|
||||
* (value, key, object).
|
||||
*
|
||||
* @static
|
||||
@@ -28,19 +28,19 @@ define(['../internal/arrayMap', '../internal/baseDifference', '../internal/baseF
|
||||
* _.omit(object, _.isNumber);
|
||||
* // => { 'user': 'fred' }
|
||||
*/
|
||||
function omit(object, predicate, thisArg) {
|
||||
var omit = restParam(function(object, props) {
|
||||
if (object == null) {
|
||||
return {};
|
||||
}
|
||||
if (typeof predicate != 'function') {
|
||||
var props = arrayMap(baseFlatten(arguments, false, false, 1), String);
|
||||
if (typeof props[0] != 'function') {
|
||||
var props = arrayMap(baseFlatten(props), String);
|
||||
return pickByArray(object, baseDifference(keysIn(object), props));
|
||||
}
|
||||
predicate = bindCallback(predicate, thisArg, 3);
|
||||
var predicate = bindCallback(props[0], props[1], 3);
|
||||
return pickByCallback(object, function(value, key, object) {
|
||||
return !predicate(value, key, object);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return omit;
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@ define(['../internal/arrayEach', '../internal/baseCallback', '../internal/baseCr
|
||||
* `accumulator` object which is the result of running each of its own enumerable
|
||||
* properties through `iteratee`, with each invocation potentially mutating
|
||||
* the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked
|
||||
* with four arguments; (accumulator, value, key, object). Iterator functions
|
||||
* with four arguments: (accumulator, value, key, object). Iterator functions
|
||||
* may exit iteration early by explicitly returning `false`.
|
||||
*
|
||||
* @static
|
||||
|
||||
Reference in New Issue
Block a user