Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / globule / node_modules / lodash / _assignInDefaults.js
1 var eq = require('./eq');
2
3 /** Used for built-in method references. */
4 var objectProto = Object.prototype;
5
6 /** Used to check objects for own properties. */
7 var hasOwnProperty = objectProto.hasOwnProperty;
8
9 /**
10  * Used by `_.defaults` to customize its `_.assignIn` use.
11  *
12  * @private
13  * @param {*} objValue The destination value.
14  * @param {*} srcValue The source value.
15  * @param {string} key The key of the property to assign.
16  * @param {Object} object The parent object of `objValue`.
17  * @returns {*} Returns the value to assign.
18  */
19 function assignInDefaults(objValue, srcValue, key, object) {
20   if (objValue === undefined ||
21       (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
22     return srcValue;
23   }
24   return objValue;
25 }
26
27 module.exports = assignInDefaults;