Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / assignWith.js
1 var keys = require('../object/keys');
2
3 /**
4  * A specialized version of `_.assign` for customizing assigned values without
5  * support for argument juggling, multiple sources, and `this` binding `customizer`
6  * functions.
7  *
8  * @private
9  * @param {Object} object The destination object.
10  * @param {Object} source The source object.
11  * @param {Function} customizer The function to customize assigned values.
12  * @returns {Object} Returns `object`.
13  */
14 function assignWith(object, source, customizer) {
15   var index = -1,
16       props = keys(source),
17       length = props.length;
18
19   while (++index < length) {
20     var key = props[index],
21         value = object[key],
22         result = customizer(value, source[key], key, object, source);
23
24     if ((result === result ? (result !== value) : (value === value)) ||
25         (value === undefined && !(key in object))) {
26       object[key] = result;
27     }
28   }
29   return object;
30 }
31
32 module.exports = assignWith;