mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Bump to v3.0.0.
This commit is contained in:
26
internal/assignOwnDefaults.js
Normal file
26
internal/assignOwnDefaults.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/** Used for native method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Used by `_.template` to customize its `_.assign` use.
|
||||
*
|
||||
* **Note:** This method is like `assignDefaults` except that it ignores
|
||||
* inherited property values when checking if a property is `undefined`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} objectValue The destination object property value.
|
||||
* @param {*} sourceValue The source object property value.
|
||||
* @param {string} key The key associated with the object and source values.
|
||||
* @param {Object} object The destination object.
|
||||
* @returns {*} Returns the value to assign to the destination object.
|
||||
*/
|
||||
function assignOwnDefaults(objectValue, sourceValue, key, object) {
|
||||
return (typeof objectValue == 'undefined' || !hasOwnProperty.call(object, key))
|
||||
? sourceValue
|
||||
: objectValue;
|
||||
}
|
||||
|
||||
export default assignOwnDefaults;
|
||||
Reference in New Issue
Block a user