mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Refine Object.prototype check in _.defaults.
This commit is contained in:
11
lodash.js
11
lodash.js
@@ -2189,12 +2189,15 @@
|
||||
* @param {*} objValue The destination value.
|
||||
* @param {*} srcValue The source value.
|
||||
* @param {string} key The key of the property to assign.
|
||||
* @param {Object} object The parent object of `objValue`.
|
||||
* @returns {*} Returns the value to assign.
|
||||
*/
|
||||
function assignInDefaults(objValue, srcValue, key) {
|
||||
return (objValue === undefined || objValue === objectProto[key])
|
||||
? srcValue
|
||||
: objValue;
|
||||
function assignInDefaults(objValue, srcValue, key, object) {
|
||||
if (objValue === undefined ||
|
||||
(objValue === objectProto[key] && !hasOwnProperty.call(object, key))) {
|
||||
return srcValue;
|
||||
}
|
||||
return objValue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user