Commit project
This commit is contained in:
parent
28471965a0
commit
3ac017a5ad
1030 changed files with 94062 additions and 0 deletions
63
node_modules/lodash.defaults/index.js
generated
vendored
Normal file
63
node_modules/lodash.defaults/index.js
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* lodash 3.1.2 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modern modularize exports="npm" -o ./`
|
||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
* Available under MIT license <https://lodash.com/license>
|
||||
*/
|
||||
var assign = require('lodash.assign'),
|
||||
restParam = require('lodash.restparam');
|
||||
|
||||
/**
|
||||
* Used by `_.defaults` to customize its `_.assign` use.
|
||||
*
|
||||
* @private
|
||||
* @param {*} objectValue The destination object property value.
|
||||
* @param {*} sourceValue The source object property value.
|
||||
* @returns {*} Returns the value to assign to the destination object.
|
||||
*/
|
||||
function assignDefaults(objectValue, sourceValue) {
|
||||
return objectValue === undefined ? sourceValue : objectValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns own enumerable properties of source object(s) to the destination
|
||||
* object for all destination properties that resolve to `undefined`. Once a
|
||||
* property is set, additional values of the same property are ignored.
|
||||
*
|
||||
* **Note:** This method mutates `object`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The destination object.
|
||||
* @param {...Object} [sources] The source objects.
|
||||
* @returns {Object} Returns `object`.
|
||||
* @example
|
||||
*
|
||||
* _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
|
||||
* // => { 'user': 'barney', 'age': 36 }
|
||||
*/
|
||||
var defaults = createDefaults(assign, assignDefaults);
|
||||
|
||||
module.exports = defaults;
|
Loading…
Add table
Add a link
Reference in a new issue