Bump to v4.17.5.

This commit is contained in:
John-David Dalton
2018-02-02 21:16:59 -08:00
parent 955537d67f
commit 6339af7cb1
16 changed files with 225 additions and 113 deletions

View File

@@ -1,8 +1,14 @@
define(['./_apply', './assignInWith', './_baseRest', './_customDefaultsAssignIn'], function(apply, assignInWith, baseRest, customDefaultsAssignIn) {
define(['./_baseRest', './eq', './_isIterateeCall', './keysIn'], function(baseRest, eq, isIterateeCall, keysIn) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Assigns own and inherited enumerable string keyed properties of source
* objects to the destination object for all destination properties that
@@ -24,9 +30,35 @@ define(['./_apply', './assignInWith', './_baseRest', './_customDefaultsAssignIn'
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var defaults = baseRest(function(args) {
args.push(undefined, customDefaultsAssignIn);
return apply(assignInWith, undefined, args);
var defaults = baseRest(function(object, sources) {
object = Object(object);
var index = -1;
var length = sources.length;
var guard = length > 2 ? sources[2] : undefined;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
length = 1;
}
while (++index < length) {
var source = sources[index];
var props = keysIn(source);
var propsIndex = -1;
var propsLength = props.length;
while (++propsIndex < propsLength) {
var key = props[propsIndex];
var value = object[key];
if (value === undefined ||
(eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
object[key] = source[key];
}
}
}
return object;
});
return defaults;