Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / assignOwnDefaults.js
1 /** Used for native method references. */
2 var objectProto = Object.prototype;
3
4 /** Used to check objects for own properties. */
5 var hasOwnProperty = objectProto.hasOwnProperty;
6
7 /**
8  * Used by `_.template` to customize its `_.assign` use.
9  *
10  * **Note:** This function is like `assignDefaults` except that it ignores
11  * inherited property values when checking if a property is `undefined`.
12  *
13  * @private
14  * @param {*} objectValue The destination object property value.
15  * @param {*} sourceValue The source object property value.
16  * @param {string} key The key associated with the object and source values.
17  * @param {Object} object The destination object.
18  * @returns {*} Returns the value to assign to the destination object.
19  */
20 function assignOwnDefaults(objectValue, sourceValue, key, object) {
21   return (objectValue === undefined || !hasOwnProperty.call(object, key))
22     ? sourceValue
23     : objectValue;
24 }
25
26 module.exports = assignOwnDefaults;