Compare commits

...

3 Commits

Author SHA1 Message Date
John-David Dalton
e2aef0def9 Bump to v4.3.0. 2016-02-08 00:43:24 -08:00
John-David Dalton
bd7f722175 Bulk update. 2016-02-03 23:26:07 -08:00
John-David Dalton
d8bc95999f Bump to v4.2.1. 2016-02-03 01:09:45 -08:00
58 changed files with 647 additions and 184 deletions

33
LICENSE
View File

@@ -1,22 +1,23 @@
The MIT License (MIT)
Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas, Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/> DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining a copy
a copy of this software and associated documentation files (the of this software and associated documentation files (the "Software"), to deal
"Software"), to deal in the Software without restriction, including in the Software without restriction, including without limitation the rights
without limitation the rights to use, copy, modify, merge, publish, to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
distribute, sublicense, and/or sell copies of the Software, and to copies of the Software, and to permit persons to whom the Software is
permit persons to whom the Software is furnished to do so, subject to furnished to do so, subject to the following conditions:
the following conditions:
The above copyright notice and this permission notice shall be The above copyright notice and this permission notice shall be included in all
included in all copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE.

View File

@@ -1,4 +1,4 @@
# lodash v4.2.0 # lodash v4.3.0
The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.
@@ -28,29 +28,13 @@ var chunk = require('lodash/chunk');
var extend = require('lodash/fp/extend'); var extend = require('lodash/fp/extend');
``` ```
See the [package source](https://github.com/lodash/lodash/tree/4.2.0-npm) for more details. See the [package source](https://github.com/lodash/lodash/tree/4.3.0-npm) for more details.
**Note:**<br> **Note:**<br>
Dont assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br> Dont assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br>
Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash by default. Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash by default.
## Module formats
Lodash is available in a variety of other builds & module formats.
* [lodash](https://www.npmjs.com/package/lodash) & [per method packages](https://www.npmjs.com/browse/keyword/lodash-modularized)
* [lodash-amd](https://www.npmjs.com/package/lodash-amd)
* [lodash-es](https://www.npmjs.com/package/lodash-es) & [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash)
## Further Reading
* [API Documentation](https://lodash.com/docs)
* [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences)
* [Changelog](https://github.com/lodash/lodash/wiki/Changelog)
* [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap)
* [More Resources](https://github.com/lodash/lodash/wiki/Resources)
## Support ## Support
Tested in Chrome 47-48, Firefox 43-44, IE 9-11, Edge 13, Safari 8-9, Node.js 0.10, 0.12, 4, & 5, & PhantomJS 1.9.8. Tested in Chrome 47-48, Firefox 43-44, IE 9-11, Edge 13, Safari 8-9, Node.js 0.10, 0.12, 4, & 5, & PhantomJS 1.9.8.<br>
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing. Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available.

View File

@@ -3,6 +3,7 @@ var Stack = require('./_Stack'),
assignValue = require('./_assignValue'), assignValue = require('./_assignValue'),
baseAssign = require('./_baseAssign'), baseAssign = require('./_baseAssign'),
baseForOwn = require('./_baseForOwn'), baseForOwn = require('./_baseForOwn'),
cloneBuffer = require('./_cloneBuffer'),
copyArray = require('./_copyArray'), copyArray = require('./_copyArray'),
copySymbols = require('./_copySymbols'), copySymbols = require('./_copySymbols'),
getTag = require('./_getTag'), getTag = require('./_getTag'),
@@ -10,6 +11,7 @@ var Stack = require('./_Stack'),
initCloneByTag = require('./_initCloneByTag'), initCloneByTag = require('./_initCloneByTag'),
initCloneObject = require('./_initCloneObject'), initCloneObject = require('./_initCloneObject'),
isArray = require('./isArray'), isArray = require('./isArray'),
isBuffer = require('./isBuffer'),
isHostObject = require('./_isHostObject'), isHostObject = require('./_isHostObject'),
isObject = require('./isObject'); isObject = require('./isObject');
@@ -91,6 +93,9 @@ function baseClone(value, isDeep, customizer, key, object, stack) {
var tag = getTag(value), var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag; isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag || tag == argsTag || (isFunc && !object)) { if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
if (isHostObject(value)) { if (isHostObject(value)) {
return object ? value : {}; return object ? value : {};

View File

@@ -8,7 +8,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* @private * @private
* @param {Function} func The function to delay. * @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation. * @param {number} wait The number of milliseconds to delay invocation.
* @param {Object} args The arguments provide to `func`. * @param {Object} args The arguments to provide to `func`.
* @returns {number} Returns the timer id. * @returns {number} Returns the timer id.
*/ */
function baseDelay(func, wait, args) { function baseDelay(func, wait, args) {

View File

@@ -3,7 +3,7 @@ var arrayFilter = require('./_arrayFilter'),
/** /**
* The base implementation of `_.functions` which creates an array of * The base implementation of `_.functions` which creates an array of
* `object` function property names filtered from those provided. * `object` function property names filtered from `props`.
* *
* @private * @private
* @param {Object} object The object to inspect. * @param {Object} object The object to inspect.

19
_cloneArrayBuffer.js Normal file
View File

@@ -0,0 +1,19 @@
var Uint8Array = require('./_Uint8Array');
/**
* Creates a clone of `arrayBuffer`.
*
* @private
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function cloneArrayBuffer(arrayBuffer) {
var Ctor = arrayBuffer.constructor,
result = new Ctor(arrayBuffer.byteLength),
view = new Uint8Array(result);
view.set(new Uint8Array(arrayBuffer));
return result;
}
module.exports = cloneArrayBuffer;

View File

@@ -1,18 +1,19 @@
var Uint8Array = require('./_Uint8Array');
/** /**
* Creates a clone of `buffer`. * Creates a clone of `buffer`.
* *
* @private * @private
* @param {ArrayBuffer} buffer The array buffer to clone. * @param {Buffer} buffer The buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer. * @param {boolean} [isDeep] Specify a deep clone.
* @returns {Buffer} Returns the cloned buffer.
*/ */
function cloneBuffer(buffer) { function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var Ctor = buffer.constructor, var Ctor = buffer.constructor,
result = new Ctor(buffer.byteLength), result = new Ctor(buffer.length);
view = new Uint8Array(result);
view.set(new Uint8Array(buffer)); buffer.copy(result);
return result; return result;
} }

View File

@@ -1,4 +1,4 @@
var cloneBuffer = require('./_cloneBuffer'); var cloneArrayBuffer = require('./_cloneArrayBuffer');
/** /**
* Creates a clone of `typedArray`. * Creates a clone of `typedArray`.
@@ -12,7 +12,7 @@ function cloneTypedArray(typedArray, isDeep) {
var buffer = typedArray.buffer, var buffer = typedArray.buffer,
Ctor = typedArray.constructor; Ctor = typedArray.constructor;
return new Ctor(isDeep ? cloneBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length);
} }
module.exports = cloneTypedArray; module.exports = cloneTypedArray;

View File

@@ -1,10 +1,12 @@
var Map = require('./_Map'), var Map = require('./_Map'),
Set = require('./_Set'); Set = require('./_Set'),
WeakMap = require('./_WeakMap');
/** `Object#toString` result references. */ /** `Object#toString` result references. */
var mapTag = '[object Map]', var mapTag = '[object Map]',
objectTag = '[object Object]', objectTag = '[object Object]',
setTag = '[object Set]'; setTag = '[object Set]',
weakMapTag = '[object WeakMap]';
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = Object.prototype; var objectProto = Object.prototype;
@@ -18,9 +20,10 @@ var funcToString = Function.prototype.toString;
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;
/** Used to detect maps and sets. */ /** Used to detect maps, sets, and weakmaps. */
var mapCtorString = Map ? funcToString.call(Map) : '', var mapCtorString = Map ? funcToString.call(Map) : '',
setCtorString = Set ? funcToString.call(Set) : ''; setCtorString = Set ? funcToString.call(Set) : '',
weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';
/** /**
* Gets the `toStringTag` of `value`. * Gets the `toStringTag` of `value`.
@@ -33,19 +36,20 @@ function getTag(value) {
return objectToString.call(value); return objectToString.call(value);
} }
// Fallback for IE 11 providing `toStringTag` values for maps and sets. // Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag)) { if ((Map && getTag(new Map) != mapTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) { getTag = function(value) {
var result = objectToString.call(value), var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : null, Ctor = result == objectTag ? value.constructor : null,
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
if (ctorString) { if (ctorString) {
if (ctorString == mapCtorString) { switch (ctorString) {
return mapTag; case mapCtorString: return mapTag;
} case setCtorString: return setTag;
if (ctorString == setCtorString) { case weakMapCtorString: return weakMapTag;
return setTag;
} }
} }
return result; return result;

View File

@@ -1,4 +1,4 @@
var cloneBuffer = require('./_cloneBuffer'), var cloneArrayBuffer = require('./_cloneArrayBuffer'),
cloneMap = require('./_cloneMap'), cloneMap = require('./_cloneMap'),
cloneRegExp = require('./_cloneRegExp'), cloneRegExp = require('./_cloneRegExp'),
cloneSet = require('./_cloneSet'), cloneSet = require('./_cloneSet'),
@@ -42,7 +42,7 @@ function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor; var Ctor = object.constructor;
switch (tag) { switch (tag) {
case arrayBufferTag: case arrayBufferTag:
return cloneBuffer(object); return cloneArrayBuffer(object);
case boolTag: case boolTag:
case dateTag: case dateTag:

View File

@@ -4,7 +4,7 @@ var eq = require('./eq'),
isObject = require('./isObject'); isObject = require('./isObject');
/** /**
* Checks if the provided arguments are from an iteratee call. * Checks if the given arguments are from an iteratee call.
* *
* @private * @private
* @param {*} value The potential iteratee value argument. * @param {*} value The potential iteratee value argument.

3
add.js
View File

@@ -14,6 +14,9 @@
*/ */
function add(augend, addend) { function add(augend, addend) {
var result; var result;
if (augend === undefined && addend === undefined) {
return 0;
}
if (augend !== undefined) { if (augend !== undefined) {
result = augend; result = augend;
} }

View File

@@ -44,10 +44,15 @@ var BIND_FLAG = 1,
var bind = rest(function(func, thisArg, partials) { var bind = rest(function(func, thisArg, partials) {
var bitmask = BIND_FLAG; var bitmask = BIND_FLAG;
if (partials.length) { if (partials.length) {
var holders = replaceHolders(partials, bind.placeholder); var placeholder = bind.placeholder,
holders = replaceHolders(partials, placeholder);
bitmask |= PARTIAL_FLAG; bitmask |= PARTIAL_FLAG;
} }
return createWrapper(func, bitmask, thisArg, partials, holders); return createWrapper(func, bitmask, thisArg, partials, holders);
}); });
// Assign default placeholders.
bind.placeholder = {};
module.exports = bind; module.exports = bind;

View File

@@ -54,10 +54,15 @@ var BIND_FLAG = 1,
var bindKey = rest(function(object, key, partials) { var bindKey = rest(function(object, key, partials) {
var bitmask = BIND_FLAG | BIND_KEY_FLAG; var bitmask = BIND_FLAG | BIND_KEY_FLAG;
if (partials.length) { if (partials.length) {
var holders = replaceHolders(partials, bindKey.placeholder); var placeholder = bindKey.placeholder,
holders = replaceHolders(partials, placeholder);
bitmask |= PARTIAL_FLAG; bitmask |= PARTIAL_FLAG;
} }
return createWrapper(key, bitmask, object, partials, holders); return createWrapper(key, bitmask, object, partials, holders);
}); });
// Assign default placeholders.
bindKey.placeholder = {};
module.exports = bindKey; module.exports = bindKey;

16
core.js
View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* lodash 4.2.0 (Custom Build) <https://lodash.com/> * lodash 4.3.0 (Custom Build) <https://lodash.com/>
* Build: `lodash core -o ./dist/lodash.core.js` * Build: `lodash core -o ./dist/lodash.core.js`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@@ -13,7 +13,7 @@
var undefined; var undefined;
/** Used as the semantic version number. */ /** Used as the semantic version number. */
var VERSION = '4.2.0'; var VERSION = '4.3.0';
/** Used to compose bitmasks for wrapper metadata. */ /** Used to compose bitmasks for wrapper metadata. */
var BIND_FLAG = 1, var BIND_FLAG = 1,
@@ -576,7 +576,7 @@
* @private * @private
* @param {Function} func The function to delay. * @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation. * @param {number} wait The number of milliseconds to delay invocation.
* @param {Object} args The arguments provide to `func`. * @param {Object} args The arguments to provide to `func`.
* @returns {number} Returns the timer id. * @returns {number} Returns the timer id.
*/ */
function baseDelay(func, wait, args) { function baseDelay(func, wait, args) {
@@ -692,7 +692,7 @@
/** /**
* The base implementation of `_.functions` which creates an array of * The base implementation of `_.functions` which creates an array of
* `object` function property names filtered from those provided. * `object` function property names filtered from `props`.
* *
* @private * @private
* @param {Object} object The object to inspect. * @param {Object} object The object to inspect.
@@ -1924,7 +1924,7 @@
* Reduces `collection` to a value which is the accumulated result of running * Reduces `collection` to a value which is the accumulated result of running
* each element in `collection` through `iteratee`, where each successive * each element in `collection` through `iteratee`, where each successive
* invocation is supplied the return value of the previous. If `accumulator` * invocation is supplied the return value of the previous. If `accumulator`
* is not provided the first element of `collection` is used as the initial * is not given the first element of `collection` is used as the initial
* value. The iteratee is invoked with four arguments: * value. The iteratee is invoked with four arguments:
* (accumulator, value, index|key, collection). * (accumulator, value, index|key, collection).
* *
@@ -3099,7 +3099,7 @@
/** /**
* Creates an object that inherits from the `prototype` object. If a `properties` * Creates an object that inherits from the `prototype` object. If a `properties`
* object is provided its own enumerable properties are assigned to the created object. * object is given its own enumerable properties are assigned to the created object.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -3407,7 +3407,7 @@
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
* This method returns the first argument provided to it. * This method returns the first argument given to it.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -3592,7 +3592,7 @@
} }
/** /**
* Generates a unique ID. If `prefix` is provided the ID is appended to it. * Generates a unique ID. If `prefix` is given the ID is appended to it.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -3,7 +3,7 @@ var baseAssign = require('./_baseAssign'),
/** /**
* Creates an object that inherits from the `prototype` object. If a `properties` * Creates an object that inherits from the `prototype` object. If a `properties`
* object is provided its own enumerable properties are assigned to the created object. * object is given its own enumerable properties are assigned to the created object.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -50,4 +50,7 @@ function curry(func, arity, guard) {
return result; return result;
} }
// Assign default placeholders.
curry.placeholder = {};
module.exports = curry; module.exports = curry;

View File

@@ -47,4 +47,7 @@ function curryRight(func, arity, guard) {
return result; return result;
} }
// Assign default placeholders.
curryRight.placeholder = {};
module.exports = curryRight; module.exports = curryRight;

View File

@@ -19,7 +19,7 @@ var nativeMax = Math.max;
* to the debounced function return the result of the last `func` invocation. * to the debounced function return the result of the last `func` invocation.
* *
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
* on the trailing edge of the timeout only if the the debounced function is * on the trailing edge of the timeout only if the debounced function is
* invoked more than once during the `wait` timeout. * invoked more than once during the `wait` timeout.
* *
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
@@ -135,7 +135,7 @@ function debounce(func, wait, options) {
if (maxWait === false) { if (maxWait === false) {
var leadingCall = leading && !timeoutId; var leadingCall = leading && !timeoutId;
} else { } else {
if (!maxTimeoutId && !leading) { if (!lastCalled && !maxTimeoutId && !leading) {
lastCalled = stamp; lastCalled = stamp;
} }
var remaining = maxWait - (stamp - lastCalled), var remaining = maxWait - (stamp - lastCalled),

View File

@@ -5,7 +5,7 @@ var baseDifference = require('./_baseDifference'),
/** /**
* Creates an array of unique `array` values not included in the other * Creates an array of unique `array` values not included in the other
* provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
* @static * @static

View File

@@ -1,9 +1,9 @@
var createFlow = require('./_createFlow'); var createFlow = require('./_createFlow');
/** /**
* Creates a function that returns the result of invoking the provided * Creates a function that returns the result of invoking the given functions
* functions with the `this` binding of the created function, where each * with the `this` binding of the created function, where each successive
* successive invocation is supplied the return value of the previous. * invocation is supplied the return value of the previous.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -2,7 +2,7 @@ var createFlow = require('./_createFlow');
/** /**
* This method is like `_.flow` except that it creates a function that * This method is like `_.flow` except that it creates a function that
* invokes the provided functions from right to left. * invokes the given functions from right to left.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -9,9 +9,17 @@ var mapping = require('./_mapping'),
* @param {Object} util The util object. * @param {Object} util The util object.
* @param {string} name The name of the function to wrap. * @param {string} name The name of the function to wrap.
* @param {Function} func The function to wrap. * @param {Function} func The function to wrap.
* @param {Object} [options] The options object.
* @param {boolean} [options.cap=true] Specify capping iteratee arguments.
* @param {boolean} [options.curry=true] Specify currying.
* @param {boolean} [options.fixed=true] Specify fixed arity.
* @param {boolean} [options.immutable=true] Specify immutable operations.
* @param {boolean} [options.rearg=true] Specify rearranging arguments.
* @returns {Function|Object} Returns the converted function or object. * @returns {Function|Object} Returns the converted function or object.
*/ */
function baseConvert(util, name, func) { function baseConvert(util, name, func, options) {
options || (options = {});
if (typeof func != 'function') { if (typeof func != 'function') {
func = name; func = name;
name = undefined; name = undefined;
@@ -19,6 +27,16 @@ function baseConvert(util, name, func) {
if (func == null) { if (func == null) {
throw new TypeError; throw new TypeError;
} }
var config = {
'cap': 'cap' in options ? options.cap : true,
'curry': 'curry' in options ? options.curry : true,
'fixed': 'fixed' in options ? options.fixed : true,
'immutable': 'immutable' in options ? options.immutable : true,
'rearg': 'rearg' in options ? options.rearg : true
};
var forceRearg = ('rearg' in options) && options.rearg;
var isLib = name === undefined && typeof func.VERSION == 'string'; var isLib = name === undefined && typeof func.VERSION == 'string';
var _ = isLib ? func : { var _ = isLib ? func : {
@@ -30,7 +48,7 @@ function baseConvert(util, name, func) {
'iteratee': util.iteratee, 'iteratee': util.iteratee,
'keys': util.keys, 'keys': util.keys,
'rearg': util.rearg, 'rearg': util.rearg,
'rest': util.rest 'spread': util.spread
}; };
var ary = _.ary, var ary = _.ary,
@@ -107,6 +125,9 @@ function baseConvert(util, name, func) {
var func = arguments[0], var func = arguments[0],
arity = arguments[1]; arity = arguments[1];
if (!config.cap) {
return iteratee(func, arity);
}
arity = arity > 2 ? (arity - 2) : 1; arity = arity > 2 ? (arity - 2) : 1;
func = iteratee(func); func = iteratee(func);
var length = func.length; var length = func.length;
@@ -145,7 +166,7 @@ function baseConvert(util, name, func) {
}, },
'runInContext': function(runInContext) { 'runInContext': function(runInContext) {
return function(context) { return function(context) {
return baseConvert(util, runInContext(context)); return baseConvert(util, runInContext(context), undefined, options);
}; };
} }
}; };
@@ -156,14 +177,17 @@ function baseConvert(util, name, func) {
if (wrapper) { if (wrapper) {
return wrapper(func); return wrapper(func);
} }
if (mutateMap.array[name]) { var wrapped = func;
func = immutWrap(func, cloneArray); if (config.immutable) {
} if (mutateMap.array[name]) {
else if (mutateMap.object[name]) { wrapped = immutWrap(func, cloneArray);
func = immutWrap(func, createCloner(func)); }
} else if (mutateMap.object[name]) {
else if (mutateMap.set[name]) { wrapped = immutWrap(func, createCloner(func));
func = immutWrap(func, cloneDeep); }
else if (mutateMap.set[name]) {
wrapped = immutWrap(func, cloneDeep);
}
} }
var result; var result;
each(mapping.caps, function(cap) { each(mapping.caps, function(cap) {
@@ -173,19 +197,22 @@ function baseConvert(util, name, func) {
reargIndexes = mapping.iterateeRearg[name], reargIndexes = mapping.iterateeRearg[name],
spreadStart = mapping.methodSpread[name]; spreadStart = mapping.methodSpread[name];
result = spreadStart === undefined if (config.fixed) {
? ary(func, cap) result = spreadStart === undefined
: spread(func, spreadStart); ? ary(wrapped, cap)
: spread(wrapped, spreadStart);
if (cap > 1 && !mapping.skipRearg[name]) { }
if (config.rearg && cap > 1 && (forceRearg || !mapping.skipRearg[name])) {
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]); result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]);
} }
if (reargIndexes) { if (config.cap) {
result = iterateeRearg(result, reargIndexes); if (reargIndexes) {
} else if (aryN) { result = iterateeRearg(result, reargIndexes);
result = iterateeAry(result, aryN); } else if (aryN) {
result = iterateeAry(result, aryN);
}
} }
if (cap > 1) { if (config.curry && cap > 1) {
result = curry(result, cap); result = curry(result, cap);
} }
return false; return false;
@@ -196,7 +223,7 @@ function baseConvert(util, name, func) {
result || (result = func); result || (result = func);
if (mapping.placeholder[name]) { if (mapping.placeholder[name]) {
result.placeholder = placeholder; func.placeholder = result.placeholder = placeholder;
} }
return result; return result;
}; };
@@ -204,8 +231,8 @@ function baseConvert(util, name, func) {
if (!isLib) { if (!isLib) {
return wrap(name, func); return wrap(name, func);
} }
// Add placeholder alias. // Add placeholder.
_.__ = placeholder; _.placeholder = placeholder;
// Iterate over methods for the current ary cap. // Iterate over methods for the current ary cap.
var pairs = []; var pairs = [];

View File

@@ -4,10 +4,11 @@ var baseConvert = require('./_baseConvert');
* Converts `lodash` to an immutable auto-curried iteratee-first data-last version. * Converts `lodash` to an immutable auto-curried iteratee-first data-last version.
* *
* @param {Function} lodash The lodash function. * @param {Function} lodash The lodash function.
* @param {Object} [options] The options object. See `baseConvert` for more details.
* @returns {Function} Returns the converted `lodash`. * @returns {Function} Returns the converted `lodash`.
*/ */
function browserConvert(lodash) { function browserConvert(lodash, options) {
return baseConvert(lodash, lodash); return baseConvert(lodash, lodash, undefined, options);
} }
module.exports = browserConvert; module.exports = browserConvert;

View File

@@ -1,5 +1,6 @@
/** Used to map aliases to their real names. */ /** Used to map aliases to their real names. */
exports.aliasToReal = { exports.aliasToReal = {
'__': 'placeholder',
'all': 'some', 'all': 'some',
'allPass': 'overEvery', 'allPass': 'overEvery',
'apply': 'spread', 'apply': 'spread',
@@ -60,9 +61,9 @@ exports.aryMethod = {
'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex', 'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy', 'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile', 'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile',
'takeWhile', 'tap', 'throttle', 'thru', 'times', 'truncate', 'union', 'uniqBy', 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', 'trimCharsEnd',
'uniqWith', 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', 'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset',
'zipObjectDeep' 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep'
], ],
3: [ 3: [
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith', 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
@@ -212,15 +213,23 @@ exports.realToAlias = (function() {
exports.rename = { exports.rename = {
'curryN': 'curry', 'curryN': 'curry',
'curryRightN': 'curryRight', 'curryRightN': 'curryRight',
'getOr': 'get' 'getOr': 'get',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
'trimCharsStart': 'trimStart'
}; };
/** Used to track methods that skip `_.rearg`. */ /** Used to track methods that skip `_.rearg`. */
exports.skipRearg = { exports.skipRearg = {
'add': true,
'assign': true, 'assign': true,
'assignIn': true, 'assignIn': true,
'concat': true, 'concat': true,
'difference': true, 'difference': true,
'gt': true,
'gte': true,
'lt': true,
'lte': true,
'matchesProperty': true, 'matchesProperty': true,
'merge': true, 'merge': true,
'partial': true, 'partial': true,
@@ -228,6 +237,7 @@ exports.skipRearg = {
'random': true, 'random': true,
'range': true, 'range': true,
'rangeRight': true, 'rangeRight': true,
'subtract': true,
'zip': true, 'zip': true,
'zipObject': true 'zipObject': true
}; };

View File

@@ -7,10 +7,11 @@ var baseConvert = require('./_baseConvert'),
* *
* @param {string} name The name of the function to wrap. * @param {string} name The name of the function to wrap.
* @param {Function} [func] The function to wrap. * @param {Function} [func] The function to wrap.
* @param {Object} [options] The options object. See `baseConvert` for more details.
* @returns {Function|Object} Returns the converted function or object. * @returns {Function|Object} Returns the converted function or object.
*/ */
function convert(name, func) { function convert(name, func, options) {
return baseConvert(util, name, func); return baseConvert(util, name, func, options);
} }
module.exports = convert; module.exports = convert;

1
fp/isArrayBuffer.js Normal file
View File

@@ -0,0 +1 @@
module.exports = require('../isArrayBuffer');

1
fp/isBuffer.js Normal file
View File

@@ -0,0 +1 @@
module.exports = require('../isBuffer');

1
fp/isMap.js Normal file
View File

@@ -0,0 +1 @@
module.exports = require('../isMap');

1
fp/isSet.js Normal file
View File

@@ -0,0 +1 @@
module.exports = require('../isSet');

1
fp/isWeakMap.js Normal file
View File

@@ -0,0 +1 @@
module.exports = require('../isWeakMap');

1
fp/isWeakSet.js Normal file
View File

@@ -0,0 +1 @@
module.exports = require('../isWeakSet');

2
fp/trimChars.js Normal file
View File

@@ -0,0 +1,2 @@
var convert = require('./convert');
module.exports = convert('trimChars', require('../trim'));

2
fp/trimCharsEnd.js Normal file
View File

@@ -0,0 +1,2 @@
var convert = require('./convert');
module.exports = convert('trimCharsEnd', require('../trimEnd'));

2
fp/trimCharsStart.js Normal file
View File

@@ -0,0 +1,2 @@
var convert = require('./convert');
module.exports = convert('trimCharsStart', require('../trimStart'));

View File

@@ -1,5 +1,5 @@
/** /**
* This method returns the first argument provided to it. * This method returns the first argument given to it.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -4,8 +4,8 @@ var arrayMap = require('./_arrayMap'),
toArrayLikeObject = require('./_toArrayLikeObject'); toArrayLikeObject = require('./_toArrayLikeObject');
/** /**
* Creates an array of unique values that are included in all of the provided * Creates an array of unique values that are included in all given arrays
* arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
* @static * @static

35
isArrayBuffer.js Normal file
View File

@@ -0,0 +1,35 @@
var isObjectLike = require('./isObjectLike');
var arrayBufferTag = '[object ArrayBuffer]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* Checks if `value` is classified as an `ArrayBuffer` object.
*
* @static
* @memberOf _
* @type Function
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArrayBuffer(new ArrayBuffer(2));
* // => true
*
* _.isArrayBuffer(new Array(2));
* // => false
*/
function isArrayBuffer(value) {
return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
}
module.exports = isArrayBuffer;

42
isBuffer.js Normal file
View File

@@ -0,0 +1,42 @@
var constant = require('./constant'),
root = require('./_root');
/** Used to determine if values are of the language type `Object`. */
var objectTypes = {
'function': true,
'object': true
};
/** Detect free variable `exports`. */
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null;
/** Detect free variable `module`. */
var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null;
/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined;
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = !Buffer ? constant(false) : function(value) {
return value instanceof Buffer;
};
module.exports = isBuffer;

27
isMap.js Normal file
View File

@@ -0,0 +1,27 @@
var getTag = require('./_getTag'),
isObjectLike = require('./isObjectLike');
/** `Object#toString` result references. */
var mapTag = '[object Map]';
/**
* Checks if `value` is classified as a `Map` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isMap(new Map);
* // => true
*
* _.isMap(new WeakMap);
* // => false
*/
function isMap(value) {
return isObjectLike(value) && getTag(value) == mapTag;
}
module.exports = isMap;

27
isSet.js Normal file
View File

@@ -0,0 +1,27 @@
var getTag = require('./_getTag'),
isObjectLike = require('./isObjectLike');
/** `Object#toString` result references. */
var setTag = '[object Set]';
/**
* Checks if `value` is classified as a `Set` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isSet(new Set);
* // => true
*
* _.isSet(new WeakSet);
* // => false
*/
function isSet(value) {
return isObjectLike(value) && getTag(value) == setTag;
}
module.exports = isSet;

27
isWeakMap.js Normal file
View File

@@ -0,0 +1,27 @@
var getTag = require('./_getTag'),
isObjectLike = require('./isObjectLike');
/** `Object#toString` result references. */
var weakMapTag = '[object WeakMap]';
/**
* Checks if `value` is classified as a `WeakMap` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isWeakMap(new WeakMap);
* // => true
*
* _.isWeakMap(new Map);
* // => false
*/
function isWeakMap(value) {
return isObjectLike(value) && getTag(value) == weakMapTag;
}
module.exports = isWeakMap;

35
isWeakSet.js Normal file
View File

@@ -0,0 +1,35 @@
var isObjectLike = require('./isObjectLike');
/** `Object#toString` result references. */
var weakSetTag = '[object WeakSet]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* Checks if `value` is classified as a `WeakSet` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isWeakSet(new WeakSet);
* // => true
*
* _.isWeakSet(new Set);
* // => false
*/
function isWeakSet(value) {
return isObjectLike(value) && objectToString.call(value) == weakSetTag;
}
module.exports = isWeakSet;

View File

@@ -8,9 +8,11 @@ module.exports = {
'gte': require('./gte'), 'gte': require('./gte'),
'isArguments': require('./isArguments'), 'isArguments': require('./isArguments'),
'isArray': require('./isArray'), 'isArray': require('./isArray'),
'isArrayBuffer': require('./isArrayBuffer'),
'isArrayLike': require('./isArrayLike'), 'isArrayLike': require('./isArrayLike'),
'isArrayLikeObject': require('./isArrayLikeObject'), 'isArrayLikeObject': require('./isArrayLikeObject'),
'isBoolean': require('./isBoolean'), 'isBoolean': require('./isBoolean'),
'isBuffer': require('./isBuffer'),
'isDate': require('./isDate'), 'isDate': require('./isDate'),
'isElement': require('./isElement'), 'isElement': require('./isElement'),
'isEmpty': require('./isEmpty'), 'isEmpty': require('./isEmpty'),
@@ -21,6 +23,7 @@ module.exports = {
'isFunction': require('./isFunction'), 'isFunction': require('./isFunction'),
'isInteger': require('./isInteger'), 'isInteger': require('./isInteger'),
'isLength': require('./isLength'), 'isLength': require('./isLength'),
'isMap': require('./isMap'),
'isMatch': require('./isMatch'), 'isMatch': require('./isMatch'),
'isMatchWith': require('./isMatchWith'), 'isMatchWith': require('./isMatchWith'),
'isNaN': require('./isNaN'), 'isNaN': require('./isNaN'),
@@ -33,10 +36,13 @@ module.exports = {
'isPlainObject': require('./isPlainObject'), 'isPlainObject': require('./isPlainObject'),
'isRegExp': require('./isRegExp'), 'isRegExp': require('./isRegExp'),
'isSafeInteger': require('./isSafeInteger'), 'isSafeInteger': require('./isSafeInteger'),
'isSet': require('./isSet'),
'isString': require('./isString'), 'isString': require('./isString'),
'isSymbol': require('./isSymbol'), 'isSymbol': require('./isSymbol'),
'isTypedArray': require('./isTypedArray'), 'isTypedArray': require('./isTypedArray'),
'isUndefined': require('./isUndefined'), 'isUndefined': require('./isUndefined'),
'isWeakMap': require('./isWeakMap'),
'isWeakSet': require('./isWeakSet'),
'lt': require('./lt'), 'lt': require('./lt'),
'lte': require('./lte'), 'lte': require('./lte'),
'toArray': require('./toArray'), 'toArray': require('./toArray'),

277
lodash.js
View File

@@ -1,6 +1,6 @@
/** /**
* @license * @license
* lodash 4.2.0 (Custom Build) <https://lodash.com/> * lodash 4.3.0 (Custom Build) <https://lodash.com/>
* Build: `lodash -d -o ./foo/lodash.js` * Build: `lodash -d -o ./foo/lodash.js`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@@ -13,7 +13,7 @@
var undefined; var undefined;
/** Used as the semantic version number. */ /** Used as the semantic version number. */
var VERSION = '4.2.0'; var VERSION = '4.3.0';
/** Used to compose bitmasks for wrapper metadata. */ /** Used to compose bitmasks for wrapper metadata. */
var BIND_FLAG = 1, var BIND_FLAG = 1,
@@ -82,7 +82,8 @@
setTag = '[object Set]', setTag = '[object Set]',
stringTag = '[object String]', stringTag = '[object String]',
symbolTag = '[object Symbol]', symbolTag = '[object Symbol]',
weakMapTag = '[object WeakMap]'; weakMapTag = '[object WeakMap]',
weakSetTag = '[object WeakSet]';
var arrayBufferTag = '[object ArrayBuffer]', var arrayBufferTag = '[object ArrayBuffer]',
float32Tag = '[object Float32Array]', float32Tag = '[object Float32Array]',
@@ -231,8 +232,8 @@
/** Used to assign default `context` object properties. */ /** Used to assign default `context` object properties. */
var contextProps = [ var contextProps = [
'Array', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function', 'Array', 'Buffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_',
'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
@@ -1306,7 +1307,8 @@
); );
/** Built-in value references. */ /** Built-in value references. */
var Reflect = context.Reflect, var Buffer = moduleExports ? context.Buffer : undefined,
Reflect = context.Reflect,
Symbol = context.Symbol, Symbol = context.Symbol,
Uint8Array = context.Uint8Array, Uint8Array = context.Uint8Array,
clearTimeout = context.clearTimeout, clearTimeout = context.clearTimeout,
@@ -1339,9 +1341,10 @@
/** Used to store function metadata. */ /** Used to store function metadata. */
var metaMap = WeakMap && new WeakMap; var metaMap = WeakMap && new WeakMap;
/** Used to detect maps and sets. */ /** Used to detect maps, sets, and weakmaps. */
var mapCtorString = Map ? funcToString.call(Map) : '', var mapCtorString = Map ? funcToString.call(Map) : '',
setCtorString = Set ? funcToString.call(Set) : ''; setCtorString = Set ? funcToString.call(Set) : '',
weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';
/** Used to convert symbols to primitives and strings. */ /** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined, var symbolProto = Symbol ? Symbol.prototype : undefined,
@@ -2251,6 +2254,9 @@
var tag = getTag(value), var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag; isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag || tag == argsTag || (isFunc && !object)) { if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
if (isHostObject(value)) { if (isHostObject(value)) {
return object ? value : {}; return object ? value : {};
@@ -2336,7 +2342,7 @@
* @private * @private
* @param {Function} func The function to delay. * @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation. * @param {number} wait The number of milliseconds to delay invocation.
* @param {Object} args The arguments provide to `func`. * @param {Object} args The arguments to provide to `func`.
* @returns {number} Returns the timer id. * @returns {number} Returns the timer id.
*/ */
function baseDelay(func, wait, args) { function baseDelay(func, wait, args) {
@@ -2581,7 +2587,7 @@
/** /**
* The base implementation of `_.functions` which creates an array of * The base implementation of `_.functions` which creates an array of
* `object` function property names filtered from those provided. * `object` function property names filtered from `props`.
* *
* @private * @private
* @param {Object} object The object to inspect. * @param {Object} object The object to inspect.
@@ -3708,18 +3714,37 @@
} }
/** /**
* Creates a clone of `buffer`. * Creates a clone of `buffer`.
* *
* @private * @private
* @param {ArrayBuffer} buffer The array buffer to clone. * @param {Buffer} buffer The buffer to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Buffer} Returns the cloned buffer.
*/
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var Ctor = buffer.constructor,
result = new Ctor(buffer.length);
buffer.copy(result);
return result;
}
/**
* Creates a clone of `arrayBuffer`.
*
* @private
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer. * @returns {ArrayBuffer} Returns the cloned array buffer.
*/ */
function cloneBuffer(buffer) { function cloneArrayBuffer(arrayBuffer) {
var Ctor = buffer.constructor, var Ctor = arrayBuffer.constructor,
result = new Ctor(buffer.byteLength), result = new Ctor(arrayBuffer.byteLength),
view = new Uint8Array(result); view = new Uint8Array(result);
view.set(new Uint8Array(buffer)); view.set(new Uint8Array(arrayBuffer));
return result; return result;
} }
@@ -3785,7 +3810,7 @@
var buffer = typedArray.buffer, var buffer = typedArray.buffer,
Ctor = typedArray.constructor; Ctor = typedArray.constructor;
return new Ctor(isDeep ? cloneBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length); return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length);
} }
/** /**
@@ -4123,7 +4148,7 @@
index = length, index = length,
args = Array(length), args = Array(length),
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func, fn = (this && this !== root && this instanceof wrapper) ? Ctor : func,
placeholder = wrapper.placeholder; placeholder = lodash.placeholder || wrapper.placeholder;
while (index--) { while (index--) {
args[index] = arguments[index]; args[index] = arguments[index];
@@ -4239,7 +4264,7 @@
args = composeArgsRight(args, partialsRight, holdersRight); args = composeArgsRight(args, partialsRight, holdersRight);
} }
if (isCurry || isCurryRight) { if (isCurry || isCurryRight) {
var placeholder = wrapper.placeholder, var placeholder = lodash.placeholder || wrapper.placeholder,
argsHolders = replaceHolders(args, placeholder); argsHolders = replaceHolders(args, placeholder);
length -= argsHolders.length; length -= argsHolders.length;
@@ -4853,19 +4878,20 @@
return objectToString.call(value); return objectToString.call(value);
} }
// Fallback for IE 11 providing `toStringTag` values for maps and sets. // Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag)) { if ((Map && getTag(new Map) != mapTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) { getTag = function(value) {
var result = objectToString.call(value), var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : null, Ctor = result == objectTag ? value.constructor : null,
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : ''; ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
if (ctorString) { if (ctorString) {
if (ctorString == mapCtorString) { switch (ctorString) {
return mapTag; case mapCtorString: return mapTag;
} case setCtorString: return setTag;
if (ctorString == setCtorString) { case weakMapCtorString: return weakMapTag;
return setTag;
} }
} }
return result; return result;
@@ -4979,7 +5005,7 @@
var Ctor = object.constructor; var Ctor = object.constructor;
switch (tag) { switch (tag) {
case arrayBufferTag: case arrayBufferTag:
return cloneBuffer(object); return cloneArrayBuffer(object);
case boolTag: case boolTag:
case dateTag: case dateTag:
@@ -5026,7 +5052,7 @@
} }
/** /**
* Checks if the provided arguments are from an iteratee call. * Checks if the given arguments are from an iteratee call.
* *
* @private * @private
* @param {*} value The potential iteratee value argument. * @param {*} value The potential iteratee value argument.
@@ -5434,7 +5460,7 @@
/** /**
* Creates an array of unique `array` values not included in the other * Creates an array of unique `array` values not included in the other
* provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
* @static * @static
@@ -5914,8 +5940,8 @@
} }
/** /**
* Creates an array of unique values that are included in all of the provided * Creates an array of unique values that are included in all given arrays
* arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
* @static * @static
@@ -6080,7 +6106,7 @@
} }
/** /**
* Removes all provided values from `array` using * Removes all given values from `array` using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
@@ -6129,7 +6155,7 @@
/** /**
* This method is like `_.pullAll` except that it accepts `iteratee` which is * This method is like `_.pullAll` except that it accepts `iteratee` which is
* invoked for each element of `array` and `values` to to generate the criterion * invoked for each element of `array` and `values` to generate the criterion
* by which uniqueness is computed. The iteratee is invoked with one argument: (value). * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
* *
* **Note:** Unlike `_.differenceBy`, this method mutates `array`. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
@@ -6637,8 +6663,8 @@
} }
/** /**
* Creates an array of unique values, in order, from all of the provided arrays * Creates an array of unique values, in order, from all given arrays using
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
* @static * @static
@@ -6849,7 +6875,7 @@
} }
/** /**
* Creates an array excluding all provided values using * Creates an array excluding all given values using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
@@ -6872,7 +6898,7 @@
/** /**
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
* of the provided arrays. * of the given arrays.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -7898,7 +7924,7 @@
* Reduces `collection` to a value which is the accumulated result of running * Reduces `collection` to a value which is the accumulated result of running
* each element in `collection` through `iteratee`, where each successive * each element in `collection` through `iteratee`, where each successive
* invocation is supplied the return value of the previous. If `accumulator` * invocation is supplied the return value of the previous. If `accumulator`
* is not provided the first element of `collection` is used as the initial * is not given the first element of `collection` is used as the initial
* value. The iteratee is invoked with four arguments: * value. The iteratee is invoked with four arguments:
* (accumulator, value, index|key, collection). * (accumulator, value, index|key, collection).
* *
@@ -8346,7 +8372,9 @@
var bind = rest(function(func, thisArg, partials) { var bind = rest(function(func, thisArg, partials) {
var bitmask = BIND_FLAG; var bitmask = BIND_FLAG;
if (partials.length) { if (partials.length) {
var holders = replaceHolders(partials, bind.placeholder); var placeholder = lodash.placeholder || bind.placeholder,
holders = replaceHolders(partials, placeholder);
bitmask |= PARTIAL_FLAG; bitmask |= PARTIAL_FLAG;
} }
return createWrapper(func, bitmask, thisArg, partials, holders); return createWrapper(func, bitmask, thisArg, partials, holders);
@@ -8399,7 +8427,9 @@
var bindKey = rest(function(object, key, partials) { var bindKey = rest(function(object, key, partials) {
var bitmask = BIND_FLAG | BIND_KEY_FLAG; var bitmask = BIND_FLAG | BIND_KEY_FLAG;
if (partials.length) { if (partials.length) {
var holders = replaceHolders(partials, bindKey.placeholder); var placeholder = lodash.placeholder || bindKey.placeholder,
holders = replaceHolders(partials, placeholder);
bitmask |= PARTIAL_FLAG; bitmask |= PARTIAL_FLAG;
} }
return createWrapper(key, bitmask, object, partials, holders); return createWrapper(key, bitmask, object, partials, holders);
@@ -8448,7 +8478,7 @@
function curry(func, arity, guard) { function curry(func, arity, guard) {
arity = guard ? undefined : arity; arity = guard ? undefined : arity;
var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity); var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curry.placeholder; result.placeholder = lodash.placeholder || curry.placeholder;
return result; return result;
} }
@@ -8492,7 +8522,7 @@
function curryRight(func, arity, guard) { function curryRight(func, arity, guard) {
arity = guard ? undefined : arity; arity = guard ? undefined : arity;
var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity); var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curryRight.placeholder; result.placeholder = lodash.placeholder || curryRight.placeholder;
return result; return result;
} }
@@ -8507,7 +8537,7 @@
* to the debounced function return the result of the last `func` invocation. * to the debounced function return the result of the last `func` invocation.
* *
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
* on the trailing edge of the timeout only if the the debounced function is * on the trailing edge of the timeout only if the debounced function is
* invoked more than once during the `wait` timeout. * invoked more than once during the `wait` timeout.
* *
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
@@ -8623,7 +8653,7 @@
if (maxWait === false) { if (maxWait === false) {
var leadingCall = leading && !timeoutId; var leadingCall = leading && !timeoutId;
} else { } else {
if (!maxTimeoutId && !leading) { if (!lastCalled && !maxTimeoutId && !leading) {
lastCalled = stamp; lastCalled = stamp;
} }
var remaining = maxWait - (stamp - lastCalled), var remaining = maxWait - (stamp - lastCalled),
@@ -8914,7 +8944,9 @@
* // => 'hi fred' * // => 'hi fred'
*/ */
var partial = rest(function(func, partials) { var partial = rest(function(func, partials) {
var holders = replaceHolders(partials, partial.placeholder); var placeholder = lodash.placeholder || partial.placeholder,
holders = replaceHolders(partials, placeholder);
return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);
}); });
@@ -8950,7 +8982,9 @@
* // => 'hello fred' * // => 'hello fred'
*/ */
var partialRight = rest(function(func, partials) { var partialRight = rest(function(func, partials) {
var holders = replaceHolders(partials, partialRight.placeholder); var placeholder = lodash.placeholder || partialRight.placeholder,
holders = replaceHolders(partials, placeholder);
return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
}); });
@@ -9089,7 +9123,7 @@
* result of the last `func` invocation. * result of the last `func` invocation.
* *
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
* on the trailing edge of the timeout only if the the throttled function is * on the trailing edge of the timeout only if the throttled function is
* invoked more than once during the `wait` timeout. * invoked more than once during the `wait` timeout.
* *
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
@@ -9418,6 +9452,27 @@
*/ */
var isArray = Array.isArray; var isArray = Array.isArray;
/**
* Checks if `value` is classified as an `ArrayBuffer` object.
*
* @static
* @memberOf _
* @type Function
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArrayBuffer(new ArrayBuffer(2));
* // => true
*
* _.isArrayBuffer(new Array(2));
* // => false
*/
function isArrayBuffer(value) {
return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
}
/** /**
* Checks if `value` is array-like. A value is considered array-like if it's * Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or * not a function and has a `value.length` that's an integer greater than or
@@ -9497,6 +9552,26 @@
(isObjectLike(value) && objectToString.call(value) == boolTag); (isObjectLike(value) && objectToString.call(value) == boolTag);
} }
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = !Buffer ? constant(false) : function(value) {
return value instanceof Buffer;
};
/** /**
* Checks if `value` is classified as a `Date` object. * Checks if `value` is classified as a `Date` object.
* *
@@ -9830,6 +9905,26 @@
return !!value && typeof value == 'object'; return !!value && typeof value == 'object';
} }
/**
* Checks if `value` is classified as a `Map` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isMap(new Map);
* // => true
*
* _.isMap(new WeakMap);
* // => false
*/
function isMap(value) {
return isObjectLike(value) && getTag(value) == mapTag;
}
/** /**
* Performs a deep comparison between `object` and `source` to determine if * Performs a deep comparison between `object` and `source` to determine if
* `object` contains equivalent property values. * `object` contains equivalent property values.
@@ -10115,6 +10210,26 @@
return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
} }
/**
* Checks if `value` is classified as a `Set` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isSet(new Set);
* // => true
*
* _.isSet(new WeakSet);
* // => false
*/
function isSet(value) {
return isObjectLike(value) && getTag(value) == setTag;
}
/** /**
* Checks if `value` is classified as a `String` primitive or object. * Checks if `value` is classified as a `String` primitive or object.
* *
@@ -10197,6 +10312,46 @@
return value === undefined; return value === undefined;
} }
/**
* Checks if `value` is classified as a `WeakMap` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isWeakMap(new WeakMap);
* // => true
*
* _.isWeakMap(new Map);
* // => false
*/
function isWeakMap(value) {
return isObjectLike(value) && getTag(value) == weakMapTag;
}
/**
* Checks if `value` is classified as a `WeakSet` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isWeakSet(new WeakSet);
* // => true
*
* _.isWeakSet(new Set);
* // => false
*/
function isWeakSet(value) {
return isObjectLike(value) && objectToString.call(value) == weakSetTag;
}
/** /**
* Checks if `value` is less than `other`. * Checks if `value` is less than `other`.
* *
@@ -10631,7 +10786,7 @@
/** /**
* Creates an object that inherits from the `prototype` object. If a `properties` * Creates an object that inherits from the `prototype` object. If a `properties`
* object is provided its own enumerable properties are assigned to the created object. * object is given its own enumerable properties are assigned to the created object.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -12397,7 +12552,7 @@
* in "interpolate" delimiters, HTML-escape interpolated data properties in * in "interpolate" delimiters, HTML-escape interpolated data properties in
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
* properties may be accessed as free variables in the template. If a setting * properties may be accessed as free variables in the template. If a setting
* object is provided it takes precedence over `_.templateSettings` values. * object is given it takes precedence over `_.templateSettings` values.
* *
* **Note:** In the development build `_.template` utilizes * **Note:** In the development build `_.template` utilizes
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
@@ -13075,9 +13230,9 @@
} }
/** /**
* Creates a function that returns the result of invoking the provided * Creates a function that returns the result of invoking the given functions
* functions with the `this` binding of the created function, where each * with the `this` binding of the created function, where each successive
* successive invocation is supplied the return value of the previous. * invocation is supplied the return value of the previous.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -13098,7 +13253,7 @@
/** /**
* This method is like `_.flow` except that it creates a function that * This method is like `_.flow` except that it creates a function that
* invokes the provided functions from right to left. * invokes the given functions from right to left.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -13118,7 +13273,7 @@
var flowRight = createFlow(true); var flowRight = createFlow(true);
/** /**
* This method returns the first argument provided to it. * This method returns the first argument given to it.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -13670,7 +13825,7 @@
} }
/** /**
* Generates a unique ID. If `prefix` is provided the ID is appended to it. * Generates a unique ID. If `prefix` is given the ID is appended to it.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -13708,6 +13863,9 @@
*/ */
function add(augend, addend) { function add(augend, addend) {
var result; var result;
if (augend === undefined && addend === undefined) {
return 0;
}
if (augend !== undefined) { if (augend !== undefined) {
result = augend; result = augend;
} }
@@ -13918,6 +14076,9 @@
*/ */
function subtract(minuend, subtrahend) { function subtract(minuend, subtrahend) {
var result; var result;
if (minuend === undefined && subtrahend === undefined) {
return 0;
}
if (minuend !== undefined) { if (minuend !== undefined) {
result = minuend; result = minuend;
} }
@@ -14204,9 +14365,11 @@
lodash.invoke = invoke; lodash.invoke = invoke;
lodash.isArguments = isArguments; lodash.isArguments = isArguments;
lodash.isArray = isArray; lodash.isArray = isArray;
lodash.isArrayBuffer = isArrayBuffer;
lodash.isArrayLike = isArrayLike; lodash.isArrayLike = isArrayLike;
lodash.isArrayLikeObject = isArrayLikeObject; lodash.isArrayLikeObject = isArrayLikeObject;
lodash.isBoolean = isBoolean; lodash.isBoolean = isBoolean;
lodash.isBuffer = isBuffer;
lodash.isDate = isDate; lodash.isDate = isDate;
lodash.isElement = isElement; lodash.isElement = isElement;
lodash.isEmpty = isEmpty; lodash.isEmpty = isEmpty;
@@ -14217,6 +14380,7 @@
lodash.isFunction = isFunction; lodash.isFunction = isFunction;
lodash.isInteger = isInteger; lodash.isInteger = isInteger;
lodash.isLength = isLength; lodash.isLength = isLength;
lodash.isMap = isMap;
lodash.isMatch = isMatch; lodash.isMatch = isMatch;
lodash.isMatchWith = isMatchWith; lodash.isMatchWith = isMatchWith;
lodash.isNaN = isNaN; lodash.isNaN = isNaN;
@@ -14229,10 +14393,13 @@
lodash.isPlainObject = isPlainObject; lodash.isPlainObject = isPlainObject;
lodash.isRegExp = isRegExp; lodash.isRegExp = isRegExp;
lodash.isSafeInteger = isSafeInteger; lodash.isSafeInteger = isSafeInteger;
lodash.isSet = isSet;
lodash.isString = isString; lodash.isString = isString;
lodash.isSymbol = isSymbol; lodash.isSymbol = isSymbol;
lodash.isTypedArray = isTypedArray; lodash.isTypedArray = isTypedArray;
lodash.isUndefined = isUndefined; lodash.isUndefined = isUndefined;
lodash.isWeakMap = isWeakMap;
lodash.isWeakSet = isWeakSet;
lodash.join = join; lodash.join = join;
lodash.kebabCase = kebabCase; lodash.kebabCase = kebabCase;
lodash.last = last; lodash.last = last;

View File

@@ -1,6 +1,6 @@
{ {
"name": "lodash", "name": "lodash",
"version": "4.2.0", "version": "4.3.0",
"description": "Lodash modular utilities.", "description": "Lodash modular utilities.",
"homepage": "https://lodash.com/", "homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg", "icon": "https://lodash.com/icon.svg",

View File

@@ -38,8 +38,13 @@ var PARTIAL_FLAG = 32;
* // => 'hi fred' * // => 'hi fred'
*/ */
var partial = rest(function(func, partials) { var partial = rest(function(func, partials) {
var holders = replaceHolders(partials, partial.placeholder); var placeholder = partial.placeholder,
holders = replaceHolders(partials, placeholder);
return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders); return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);
}); });
// Assign default placeholders.
partial.placeholder = {};
module.exports = partial; module.exports = partial;

View File

@@ -37,8 +37,13 @@ var PARTIAL_RIGHT_FLAG = 64;
* // => 'hello fred' * // => 'hello fred'
*/ */
var partialRight = rest(function(func, partials) { var partialRight = rest(function(func, partials) {
var holders = replaceHolders(partials, partialRight.placeholder); var placeholder = partialRight.placeholder,
holders = replaceHolders(partials, placeholder);
return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
}); });
// Assign default placeholders.
partialRight.placeholder = {};
module.exports = partialRight; module.exports = partialRight;

View File

@@ -2,7 +2,7 @@ var pullAll = require('./pullAll'),
rest = require('./rest'); rest = require('./rest');
/** /**
* Removes all provided values from `array` using * Removes all given values from `array` using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *

View File

@@ -3,7 +3,7 @@ var baseIteratee = require('./_baseIteratee'),
/** /**
* This method is like `_.pullAll` except that it accepts `iteratee` which is * This method is like `_.pullAll` except that it accepts `iteratee` which is
* invoked for each element of `array` and `values` to to generate the criterion * invoked for each element of `array` and `values` to generate the criterion
* by which uniqueness is computed. The iteratee is invoked with one argument: (value). * by which uniqueness is computed. The iteratee is invoked with one argument: (value).
* *
* **Note:** Unlike `_.differenceBy`, this method mutates `array`. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.

View File

@@ -8,7 +8,7 @@ var arrayReduce = require('./_arrayReduce'),
* Reduces `collection` to a value which is the accumulated result of running * Reduces `collection` to a value which is the accumulated result of running
* each element in `collection` through `iteratee`, where each successive * each element in `collection` through `iteratee`, where each successive
* invocation is supplied the return value of the previous. If `accumulator` * invocation is supplied the return value of the previous. If `accumulator`
* is not provided the first element of `collection` is used as the initial * is not given the first element of `collection` is used as the initial
* value. The iteratee is invoked with four arguments: * value. The iteratee is invoked with four arguments:
* (accumulator, value, index|key, collection). * (accumulator, value, index|key, collection).
* *

View File

@@ -14,6 +14,9 @@
*/ */
function subtract(minuend, subtrahend) { function subtract(minuend, subtrahend) {
var result; var result;
if (minuend === undefined && subtrahend === undefined) {
return 0;
}
if (minuend !== undefined) { if (minuend !== undefined) {
result = minuend; result = minuend;
} }

View File

@@ -29,7 +29,7 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
* in "interpolate" delimiters, HTML-escape interpolated data properties in * in "interpolate" delimiters, HTML-escape interpolated data properties in
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
* properties may be accessed as free variables in the template. If a setting * properties may be accessed as free variables in the template. If a setting
* object is provided it takes precedence over `_.templateSettings` values. * object is given it takes precedence over `_.templateSettings` values.
* *
* **Note:** In the development build `_.template` utilizes * **Note:** In the development build `_.template` utilizes
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)

View File

@@ -15,7 +15,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* result of the last `func` invocation. * result of the last `func` invocation.
* *
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
* on the trailing edge of the timeout only if the the throttled function is * on the trailing edge of the timeout only if the throttled function is
* invoked more than once during the `wait` timeout. * invoked more than once during the `wait` timeout.
* *
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation) * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)

View File

@@ -3,8 +3,8 @@ var baseFlatten = require('./_baseFlatten'),
rest = require('./rest'); rest = require('./rest');
/** /**
* Creates an array of unique values, in order, from all of the provided arrays * Creates an array of unique values, in order, from all given arrays using
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
* @static * @static

View File

@@ -4,7 +4,7 @@ var toString = require('./toString');
var idCounter = 0; var idCounter = 0;
/** /**
* Generates a unique ID. If `prefix` is provided the ID is appended to it. * Generates a unique ID. If `prefix` is given the ID is appended to it.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -3,7 +3,7 @@ var baseDifference = require('./_baseDifference'),
rest = require('./rest'); rest = require('./rest');
/** /**
* Creates an array excluding all provided values using * Creates an array excluding all given values using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *

2
xor.js
View File

@@ -5,7 +5,7 @@ var arrayFilter = require('./_arrayFilter'),
/** /**
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
* of the provided arrays. * of the given arrays.
* *
* @static * @static
* @memberOf _ * @memberOf _