mirror of
https://github.com/nodejs/node.git
synced 2025-08-18 07:08:50 +02:00

PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
22 lines
600 B
JavaScript
22 lines
600 B
JavaScript
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;
|