mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Make the guard checks in _.assign and _.defaults more thorough.
This commit is contained in:
33
dist/lodash.js
vendored
33
dist/lodash.js
vendored
@@ -4202,6 +4202,9 @@
|
||||
* binding of `thisArg` and prepends any additional `bind` arguments to those
|
||||
* provided to the bound function.
|
||||
*
|
||||
* Note: Unlike native `Function#bind` this method does not set the `length`
|
||||
* property of bound functions.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Functions
|
||||
@@ -4231,6 +4234,8 @@
|
||||
* of method names. If no method names are provided all the function properties
|
||||
* of `object` will be bound.
|
||||
*
|
||||
* Note: This method does not set the `length` property of bound functions.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Functions
|
||||
@@ -4359,6 +4364,8 @@
|
||||
* remaining `func` arguments, and so on. The arity of `func` can be specified
|
||||
* if `func.length` is not sufficient.
|
||||
*
|
||||
* Note: This method does not set the `length` property of curried functions.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Functions
|
||||
@@ -4667,6 +4674,9 @@
|
||||
* `partial` arguments prepended to those provided to the new function. This
|
||||
* method is similar to `_.bind` except it does **not** alter the `this` binding.
|
||||
*
|
||||
* Note: This method does not set the `length` property of partially applied
|
||||
* functions.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Functions
|
||||
@@ -4688,6 +4698,9 @@
|
||||
* This method is like `_.partial` except that `partial` arguments are
|
||||
* appended to those provided to the new function.
|
||||
*
|
||||
* Note: This method does not set the `length` property of partially applied
|
||||
* functions.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Functions
|
||||
@@ -4822,10 +4835,10 @@
|
||||
* defaults(object, { 'name': 'fred', 'employer': 'slate' });
|
||||
* // => { 'name': 'barney', 'employer': 'slate' }
|
||||
*/
|
||||
function assign(object, source, guard) {
|
||||
function assign(object, source) {
|
||||
var args = arguments,
|
||||
argsIndex = 0,
|
||||
argsLength = typeof guard == 'number' ? 2 : args.length;
|
||||
argsLength = args[3] && args[3][args[2]] === source ? 2 : args.length;
|
||||
|
||||
if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {
|
||||
var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);
|
||||
@@ -4991,8 +5004,6 @@
|
||||
* @category Objects
|
||||
* @param {Object} object The destination object.
|
||||
* @param {...Object} [source] The source objects.
|
||||
* @param- {Object} [guard] Allows working with `_.reduce` without using its
|
||||
* `key` and `object` arguments as sources.
|
||||
* @returns {Object} Returns the destination object.
|
||||
* @example
|
||||
*
|
||||
@@ -5000,10 +5011,10 @@
|
||||
* _.defaults(object, { 'name': 'fred', 'employer': 'slate' });
|
||||
* // => { 'name': 'barney', 'employer': 'slate' }
|
||||
*/
|
||||
function defaults(object, source, guard) {
|
||||
function defaults(object, source) {
|
||||
var args = arguments,
|
||||
argsIndex = 0,
|
||||
argsLength = typeof guard == 'number' ? 2 : args.length;
|
||||
argsLength = args[3] && args[3][args[2]] === source ? 2 : args.length;
|
||||
|
||||
while (++argsIndex < argsLength) {
|
||||
source = args[argsIndex];
|
||||
@@ -5544,8 +5555,8 @@
|
||||
/**
|
||||
* Checks if `value` is, or can be coerced to, a finite number.
|
||||
*
|
||||
* Note: This is not the same as native `isFinite` which will return true for
|
||||
* booleans and empty strings. See the [ES5 spec](http://es5.github.io/#x15.1.2.5)
|
||||
* Note: This method is not the same as native `isFinite` which will return
|
||||
* `true` for booleans and empty strings. See the [ES5 spec](http://es5.github.io/#x15.1.2.5)
|
||||
* for more details.
|
||||
*
|
||||
* @static
|
||||
@@ -5622,8 +5633,8 @@
|
||||
/**
|
||||
* Checks if `value` is `NaN`.
|
||||
*
|
||||
* Note: This is not the same as native `isNaN` which will return `true` for
|
||||
* `undefined` and other non-numeric values. See the [ES5 spec](http://es5.github.io/#x15.1.2.4)
|
||||
* Note: This method is not the same as native `isNaN` which will return `true`
|
||||
* for `undefined` and other non-numeric values. See the [ES5 spec](http://es5.github.io/#x15.1.2.4)
|
||||
* for more details.
|
||||
*
|
||||
* @static
|
||||
@@ -6059,7 +6070,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* An alternative to `_.reduce` this method transforms `object` to a new
|
||||
* An alternative to `_.reduce`; this method transforms `object` to a new
|
||||
* `accumulator` object which is the result of running each of its own
|
||||
* enumerable properties through a callback, with each callback execution
|
||||
* potentially mutating the `accumulator` object. The callback is bound to
|
||||
|
||||
Reference in New Issue
Block a user