You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
600 B
JavaScript
23 lines
600 B
JavaScript
9 years ago
|
var restParam = require('../function/restParam');
|
||
|
|
||
|
/**
|
||
|
* 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);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
module.exports = createDefaults;
|