createDefaults.js
731 Bytes
define(['../function/restParam'], function(restParam) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/**
* Creates a `_.defaults` or `_.defaultsDeep` function.
*
* @private
* @param {Function} assigner The function to assign values.
* @param {Function} customizer The function to customize assigned values.
* @returns {Function} Returns the new defaults function.
*/
function createDefaults(assigner, customizer) {
return restParam(function(args) {
var object = args[0];
if (object == null) {
return object;
}
args.push(customizer);
return assigner.apply(undefined, args);
});
}
return createDefaults;
});