diff --git a/LICENSE b/LICENSE
index b054ca5a3..bcbe13d67 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,22 +1,23 @@
+The MIT License (MIT)
+
Copyright 2012-2016 The Dojo Foundation
Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index e0208a9bf..585d27957 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# lodash-amd v4.2.1
+# lodash-amd v4.3.0
The [lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
@@ -27,4 +27,4 @@ require({
});
```
-See the [package source](https://github.com/lodash/lodash/tree/4.2.1-amd) for more details.
+See the [package source](https://github.com/lodash/lodash/tree/4.3.0-amd) for more details.
diff --git a/_baseClone.js b/_baseClone.js
index 78dcf7ad5..1335e5d3d 100644
--- a/_baseClone.js
+++ b/_baseClone.js
@@ -1,4 +1,4 @@
-define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_baseForOwn', './_copyArray', './_copySymbols', './_getTag', './_initCloneArray', './_initCloneByTag', './_initCloneObject', './isArray', './_isHostObject', './isObject'], function(Stack, arrayEach, assignValue, baseAssign, baseForOwn, copyArray, copySymbols, getTag, initCloneArray, initCloneByTag, initCloneObject, isArray, isHostObject, isObject) {
+define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_baseForOwn', './_cloneBuffer', './_copyArray', './_copySymbols', './_getTag', './_initCloneArray', './_initCloneByTag', './_initCloneObject', './isArray', './isBuffer', './_isHostObject', './isObject'], function(Stack, arrayEach, assignValue, baseAssign, baseForOwn, cloneBuffer, copyArray, copySymbols, getTag, initCloneArray, initCloneByTag, initCloneObject, isArray, isBuffer, isHostObject, isObject) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
@@ -81,6 +81,9 @@ define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_baseF
var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag;
+ if (isBuffer(value)) {
+ return cloneBuffer(value, isDeep);
+ }
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
if (isHostObject(value)) {
return object ? value : {};
diff --git a/_baseDelay.js b/_baseDelay.js
index 54ab68132..e12fbcc67 100644
--- a/_baseDelay.js
+++ b/_baseDelay.js
@@ -13,7 +13,7 @@ define([], function() {
* @private
* @param {Function} func The function to delay.
* @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.
*/
function baseDelay(func, wait, args) {
diff --git a/_baseFunctions.js b/_baseFunctions.js
index 5bf9e6e05..fe7393f19 100644
--- a/_baseFunctions.js
+++ b/_baseFunctions.js
@@ -2,7 +2,7 @@ define(['./_arrayFilter', './isFunction'], function(arrayFilter, isFunction) {
/**
* 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
* @param {Object} object The object to inspect.
diff --git a/_cloneArrayBuffer.js b/_cloneArrayBuffer.js
new file mode 100644
index 000000000..0dbe74921
--- /dev/null
+++ b/_cloneArrayBuffer.js
@@ -0,0 +1,20 @@
+define(['./_Uint8Array'], function(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;
+ }
+
+ return cloneArrayBuffer;
+});
diff --git a/_cloneBuffer.js b/_cloneBuffer.js
index a9067fe2c..cb11b1250 100644
--- a/_cloneBuffer.js
+++ b/_cloneBuffer.js
@@ -1,18 +1,21 @@
-define(['./_Uint8Array'], function(Uint8Array) {
+define([], function() {
/**
- * Creates a clone of `buffer`.
+ * Creates a clone of `buffer`.
*
* @private
- * @param {ArrayBuffer} buffer The array buffer to clone.
- * @returns {ArrayBuffer} Returns the cloned array buffer.
+ * @param {Buffer} buffer The buffer to clone.
+ * @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,
- result = new Ctor(buffer.byteLength),
- view = new Uint8Array(result);
+ result = new Ctor(buffer.length);
- view.set(new Uint8Array(buffer));
+ buffer.copy(result);
return result;
}
diff --git a/_cloneTypedArray.js b/_cloneTypedArray.js
index f9d0613dd..d59bc39ed 100644
--- a/_cloneTypedArray.js
+++ b/_cloneTypedArray.js
@@ -1,4 +1,4 @@
-define(['./_cloneBuffer'], function(cloneBuffer) {
+define(['./_cloneArrayBuffer'], function(cloneArrayBuffer) {
/**
* Creates a clone of `typedArray`.
@@ -12,7 +12,7 @@ define(['./_cloneBuffer'], function(cloneBuffer) {
var buffer = typedArray.buffer,
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);
}
return cloneTypedArray;
diff --git a/_getTag.js b/_getTag.js
index 7317171b5..35336f592 100644
--- a/_getTag.js
+++ b/_getTag.js
@@ -1,9 +1,10 @@
-define(['./_Map', './_Set'], function(Map, Set) {
+define(['./_Map', './_Set', './_WeakMap'], function(Map, Set, WeakMap) {
/** `Object#toString` result references. */
var mapTag = '[object Map]',
objectTag = '[object Object]',
- setTag = '[object Set]';
+ setTag = '[object Set]',
+ weakMapTag = '[object WeakMap]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
@@ -17,9 +18,10 @@ define(['./_Map', './_Set'], function(Map, Set) {
*/
var objectToString = objectProto.toString;
- /** Used to detect maps and sets. */
+ /** Used to detect maps, sets, and weakmaps. */
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`.
@@ -32,19 +34,20 @@ define(['./_Map', './_Set'], function(Map, Set) {
return objectToString.call(value);
}
- // Fallback for IE 11 providing `toStringTag` values for maps and sets.
- if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag)) {
+ // Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
+ if ((Map && getTag(new Map) != mapTag) ||
+ (Set && getTag(new Set) != setTag) ||
+ (WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : null,
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
if (ctorString) {
- if (ctorString == mapCtorString) {
- return mapTag;
- }
- if (ctorString == setCtorString) {
- return setTag;
+ switch (ctorString) {
+ case mapCtorString: return mapTag;
+ case setCtorString: return setTag;
+ case weakMapCtorString: return weakMapTag;
}
}
return result;
diff --git a/_initCloneByTag.js b/_initCloneByTag.js
index d9f8d4994..d81ee8152 100644
--- a/_initCloneByTag.js
+++ b/_initCloneByTag.js
@@ -1,4 +1,4 @@
-define(['./_cloneBuffer', './_cloneMap', './_cloneRegExp', './_cloneSet', './_cloneSymbol', './_cloneTypedArray'], function(cloneBuffer, cloneMap, cloneRegExp, cloneSet, cloneSymbol, cloneTypedArray) {
+define(['./_cloneArrayBuffer', './_cloneMap', './_cloneRegExp', './_cloneSet', './_cloneSymbol', './_cloneTypedArray'], function(cloneArrayBuffer, cloneMap, cloneRegExp, cloneSet, cloneSymbol, cloneTypedArray) {
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
@@ -37,7 +37,7 @@ define(['./_cloneBuffer', './_cloneMap', './_cloneRegExp', './_cloneSet', './_cl
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
- return cloneBuffer(object);
+ return cloneArrayBuffer(object);
case boolTag:
case dateTag:
diff --git a/_isIterateeCall.js b/_isIterateeCall.js
index fa2c0b7b7..4aedaef0d 100644
--- a/_isIterateeCall.js
+++ b/_isIterateeCall.js
@@ -1,7 +1,7 @@
define(['./eq', './isArrayLike', './_isIndex', './isObject'], function(eq, isArrayLike, isIndex, isObject) {
/**
- * Checks if the provided arguments are from an iteratee call.
+ * Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
diff --git a/add.js b/add.js
index 7b8eb9b4b..82f145a58 100644
--- a/add.js
+++ b/add.js
@@ -19,6 +19,9 @@ define([], function() {
*/
function add(augend, addend) {
var result;
+ if (augend === undefined && addend === undefined) {
+ return 0;
+ }
if (augend !== undefined) {
result = augend;
}
diff --git a/bind.js b/bind.js
index 1e7bfde87..ab8096d1c 100644
--- a/bind.js
+++ b/bind.js
@@ -50,5 +50,8 @@ define(['./_createWrapper', './_replaceHolders', './rest'], function(createWrapp
return createWrapper(func, bitmask, thisArg, partials, holders);
});
+ // Assign default placeholders.
+ bind.placeholder = {};
+
return bind;
});
diff --git a/bindKey.js b/bindKey.js
index 8053f3a53..ae9be8963 100644
--- a/bindKey.js
+++ b/bindKey.js
@@ -60,5 +60,8 @@ define(['./_createWrapper', './_replaceHolders', './rest'], function(createWrapp
return createWrapper(key, bitmask, object, partials, holders);
});
+ // Assign default placeholders.
+ bindKey.placeholder = {};
+
return bindKey;
});
diff --git a/create.js b/create.js
index 1e3d7bfa6..dd93fbec1 100644
--- a/create.js
+++ b/create.js
@@ -2,7 +2,7 @@ define(['./_baseAssign', './_baseCreate'], function(baseAssign, baseCreate) {
/**
* 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
* @memberOf _
diff --git a/curry.js b/curry.js
index a7584ba0c..9cba3b1c5 100644
--- a/curry.js
+++ b/curry.js
@@ -53,5 +53,8 @@ define(['./_createWrapper'], function(createWrapper) {
return result;
}
+ // Assign default placeholders.
+ curry.placeholder = {};
+
return curry;
});
diff --git a/curryRight.js b/curryRight.js
index 5fa232432..8040a5768 100644
--- a/curryRight.js
+++ b/curryRight.js
@@ -50,5 +50,8 @@ define(['./_createWrapper'], function(createWrapper) {
return result;
}
+ // Assign default placeholders.
+ curryRight.placeholder = {};
+
return curryRight;
});
diff --git a/debounce.js b/debounce.js
index dd75abb5c..e5c183870 100644
--- a/debounce.js
+++ b/debounce.js
@@ -136,7 +136,7 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
if (maxWait === false) {
var leadingCall = leading && !timeoutId;
} else {
- if (!maxTimeoutId && !leading) {
+ if (!lastCalled && !maxTimeoutId && !leading) {
lastCalled = stamp;
}
var remaining = maxWait - (stamp - lastCalled),
diff --git a/difference.js b/difference.js
index 9c5623f02..33e0fb748 100644
--- a/difference.js
+++ b/difference.js
@@ -2,7 +2,7 @@ define(['./_baseDifference', './_baseFlatten', './isArrayLikeObject', './rest'],
/**
* 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.
*
* @static
diff --git a/flow.js b/flow.js
index 215204c6a..4c961d905 100644
--- a/flow.js
+++ b/flow.js
@@ -1,9 +1,9 @@
define(['./_createFlow'], function(createFlow) {
/**
- * Creates a function that returns the result of invoking the provided
- * functions with the `this` binding of the created function, where each
- * successive invocation is supplied the return value of the previous.
+ * Creates a function that returns the result of invoking the given functions
+ * with the `this` binding of the created function, where each successive
+ * invocation is supplied the return value of the previous.
*
* @static
* @memberOf _
diff --git a/flowRight.js b/flowRight.js
index a8bb87b02..60719180e 100644
--- a/flowRight.js
+++ b/flowRight.js
@@ -2,7 +2,7 @@ define(['./_createFlow'], function(createFlow) {
/**
* 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
* @memberOf _
diff --git a/identity.js b/identity.js
index 1a774cc4c..316cc6848 100644
--- a/identity.js
+++ b/identity.js
@@ -1,7 +1,7 @@
define([], function() {
/**
- * This method returns the first argument provided to it.
+ * This method returns the first argument given to it.
*
* @static
* @memberOf _
diff --git a/intersection.js b/intersection.js
index 7ecbf34b3..e955cfec8 100644
--- a/intersection.js
+++ b/intersection.js
@@ -1,8 +1,8 @@
define(['./_arrayMap', './_baseIntersection', './rest', './_toArrayLikeObject'], function(arrayMap, baseIntersection, rest, toArrayLikeObject) {
/**
- * Creates an array of unique values that are included in all of the provided
- * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * Creates an array of unique values that are included in all given arrays
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
diff --git a/isArrayBuffer.js b/isArrayBuffer.js
new file mode 100644
index 000000000..03eabe254
--- /dev/null
+++ b/isArrayBuffer.js
@@ -0,0 +1,36 @@
+define(['./isObjectLike'], function(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;
+ }
+
+ return isArrayBuffer;
+});
diff --git a/isBuffer.js b/isBuffer.js
new file mode 100644
index 000000000..af0aef0b9
--- /dev/null
+++ b/isBuffer.js
@@ -0,0 +1,45 @@
+define(['./constant', './_root'], function(constant, root) {
+
+ /** Used as a safe reference for `undefined` in pre-ES5 environments. */
+ var undefined;
+
+ /** 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;
+ };
+
+ return isBuffer;
+});
diff --git a/isMap.js b/isMap.js
new file mode 100644
index 000000000..d1f26cc30
--- /dev/null
+++ b/isMap.js
@@ -0,0 +1,27 @@
+define(['./_getTag', './isObjectLike'], function(getTag, 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;
+ }
+
+ return isMap;
+});
diff --git a/isSet.js b/isSet.js
new file mode 100644
index 000000000..6dde3d9b6
--- /dev/null
+++ b/isSet.js
@@ -0,0 +1,27 @@
+define(['./_getTag', './isObjectLike'], function(getTag, 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;
+ }
+
+ return isSet;
+});
diff --git a/isWeakMap.js b/isWeakMap.js
new file mode 100644
index 000000000..83fecb1db
--- /dev/null
+++ b/isWeakMap.js
@@ -0,0 +1,27 @@
+define(['./_getTag', './isObjectLike'], function(getTag, 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;
+ }
+
+ return isWeakMap;
+});
diff --git a/isWeakSet.js b/isWeakSet.js
new file mode 100644
index 000000000..52eb3fd7c
--- /dev/null
+++ b/isWeakSet.js
@@ -0,0 +1,36 @@
+define(['./isObjectLike'], function(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;
+ }
+
+ return isWeakSet;
+});
diff --git a/lang.js b/lang.js
index eeb5591a0..7933e4931 100644
--- a/lang.js
+++ b/lang.js
@@ -1,4 +1,4 @@
-define(['./clone', './cloneDeep', './cloneDeepWith', './cloneWith', './eq', './gt', './gte', './isArguments', './isArray', './isArrayLike', './isArrayLikeObject', './isBoolean', './isDate', './isElement', './isEmpty', './isEqual', './isEqualWith', './isError', './isFinite', './isFunction', './isInteger', './isLength', './isMatch', './isMatchWith', './isNaN', './isNative', './isNil', './isNull', './isNumber', './isObject', './isObjectLike', './isPlainObject', './isRegExp', './isSafeInteger', './isString', './isSymbol', './isTypedArray', './isUndefined', './lt', './lte', './toArray', './toInteger', './toLength', './toNumber', './toPlainObject', './toSafeInteger', './toString'], function(clone, cloneDeep, cloneDeepWith, cloneWith, eq, gt, gte, isArguments, isArray, isArrayLike, isArrayLikeObject, isBoolean, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isString, isSymbol, isTypedArray, isUndefined, lt, lte, toArray, toInteger, toLength, toNumber, toPlainObject, toSafeInteger, toString) {
+define(['./clone', './cloneDeep', './cloneDeepWith', './cloneWith', './eq', './gt', './gte', './isArguments', './isArray', './isArrayBuffer', './isArrayLike', './isArrayLikeObject', './isBoolean', './isBuffer', './isDate', './isElement', './isEmpty', './isEqual', './isEqualWith', './isError', './isFinite', './isFunction', './isInteger', './isLength', './isMap', './isMatch', './isMatchWith', './isNaN', './isNative', './isNil', './isNull', './isNumber', './isObject', './isObjectLike', './isPlainObject', './isRegExp', './isSafeInteger', './isSet', './isString', './isSymbol', './isTypedArray', './isUndefined', './isWeakMap', './isWeakSet', './lt', './lte', './toArray', './toInteger', './toLength', './toNumber', './toPlainObject', './toSafeInteger', './toString'], function(clone, cloneDeep, cloneDeepWith, cloneWith, eq, gt, gte, isArguments, isArray, isArrayBuffer, isArrayLike, isArrayLikeObject, isBoolean, isBuffer, isDate, isElement, isEmpty, isEqual, isEqualWith, isError, isFinite, isFunction, isInteger, isLength, isMap, isMatch, isMatchWith, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isRegExp, isSafeInteger, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet, lt, lte, toArray, toInteger, toLength, toNumber, toPlainObject, toSafeInteger, toString) {
return {
'clone': clone,
'cloneDeep': cloneDeep,
@@ -9,9 +9,11 @@ define(['./clone', './cloneDeep', './cloneDeepWith', './cloneWith', './eq', './g
'gte': gte,
'isArguments': isArguments,
'isArray': isArray,
+ 'isArrayBuffer': isArrayBuffer,
'isArrayLike': isArrayLike,
'isArrayLikeObject': isArrayLikeObject,
'isBoolean': isBoolean,
+ 'isBuffer': isBuffer,
'isDate': isDate,
'isElement': isElement,
'isEmpty': isEmpty,
@@ -22,6 +24,7 @@ define(['./clone', './cloneDeep', './cloneDeepWith', './cloneWith', './eq', './g
'isFunction': isFunction,
'isInteger': isInteger,
'isLength': isLength,
+ 'isMap': isMap,
'isMatch': isMatch,
'isMatchWith': isMatchWith,
'isNaN': isNaN,
@@ -34,10 +37,13 @@ define(['./clone', './cloneDeep', './cloneDeepWith', './cloneWith', './eq', './g
'isPlainObject': isPlainObject,
'isRegExp': isRegExp,
'isSafeInteger': isSafeInteger,
+ 'isSet': isSet,
'isString': isString,
'isSymbol': isSymbol,
'isTypedArray': isTypedArray,
'isUndefined': isUndefined,
+ 'isWeakMap': isWeakMap,
+ 'isWeakSet': isWeakSet,
'lt': lt,
'lte': lte,
'toArray': toArray,
diff --git a/main.js b/main.js
index b83e37850..65803e259 100644
--- a/main.js
+++ b/main.js
@@ -1,6 +1,6 @@
/**
* @license
- * lodash 4.2.1 (Custom Build)
+ * lodash 4.3.0 (Custom Build)
* Build: `lodash exports="amd" -d -o ./main.js`
* Copyright 2012-2016 The Dojo Foundation
* Based on Underscore.js 1.8.3
@@ -13,7 +13,7 @@
var undefined;
/** Used as the semantic version number. */
- var VERSION = '4.2.1';
+ var VERSION = '4.3.0';
/** Used to compose bitmasks for wrapper metadata. */
var BIND_FLAG = 1,
@@ -82,7 +82,8 @@
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
- weakMapTag = '[object WeakMap]';
+ weakMapTag = '[object WeakMap]',
+ weakSetTag = '[object WeakSet]';
var arrayBufferTag = '[object ArrayBuffer]',
float32Tag = '[object Float32Array]',
@@ -231,8 +232,8 @@
/** Used to assign default `context` object properties. */
var contextProps = [
- 'Array', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function',
- 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
+ 'Array', 'Buffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
+ 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_',
'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
@@ -348,6 +349,9 @@
/** Detect free variable `window`. */
var freeWindow = checkGlobal(objectTypes[typeof window] && window);
+ /** Detect the popular CommonJS extension `module.exports`. */
+ var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null;
+
/** Detect `this` as the global object. */
var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
@@ -1303,7 +1307,8 @@
);
/** Built-in value references. */
- var Reflect = context.Reflect,
+ var Buffer = moduleExports ? context.Buffer : undefined,
+ Reflect = context.Reflect,
Symbol = context.Symbol,
Uint8Array = context.Uint8Array,
clearTimeout = context.clearTimeout,
@@ -1336,9 +1341,10 @@
/** Used to store function metadata. */
var metaMap = WeakMap && new WeakMap;
- /** Used to detect maps and sets. */
+ /** Used to detect maps, sets, and weakmaps. */
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. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
@@ -2248,6 +2254,9 @@
var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag;
+ if (isBuffer(value)) {
+ return cloneBuffer(value, isDeep);
+ }
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
if (isHostObject(value)) {
return object ? value : {};
@@ -2333,7 +2342,7 @@
* @private
* @param {Function} func The function to delay.
* @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.
*/
function baseDelay(func, wait, args) {
@@ -2578,7 +2587,7 @@
/**
* 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
* @param {Object} object The object to inspect.
@@ -3705,18 +3714,37 @@
}
/**
- * Creates a clone of `buffer`.
+ * Creates a clone of `buffer`.
*
* @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.
*/
- function cloneBuffer(buffer) {
- var Ctor = buffer.constructor,
- result = new Ctor(buffer.byteLength),
+ function cloneArrayBuffer(arrayBuffer) {
+ var Ctor = arrayBuffer.constructor,
+ result = new Ctor(arrayBuffer.byteLength),
view = new Uint8Array(result);
- view.set(new Uint8Array(buffer));
+ view.set(new Uint8Array(arrayBuffer));
return result;
}
@@ -3782,7 +3810,7 @@
var buffer = typedArray.buffer,
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);
}
/**
@@ -4850,19 +4878,20 @@
return objectToString.call(value);
}
- // Fallback for IE 11 providing `toStringTag` values for maps and sets.
- if ((Map && getTag(new Map) != mapTag) || (Set && getTag(new Set) != setTag)) {
+ // Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
+ if ((Map && getTag(new Map) != mapTag) ||
+ (Set && getTag(new Set) != setTag) ||
+ (WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = objectToString.call(value),
Ctor = result == objectTag ? value.constructor : null,
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
if (ctorString) {
- if (ctorString == mapCtorString) {
- return mapTag;
- }
- if (ctorString == setCtorString) {
- return setTag;
+ switch (ctorString) {
+ case mapCtorString: return mapTag;
+ case setCtorString: return setTag;
+ case weakMapCtorString: return weakMapTag;
}
}
return result;
@@ -4976,7 +5005,7 @@
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
- return cloneBuffer(object);
+ return cloneArrayBuffer(object);
case boolTag:
case dateTag:
@@ -5023,7 +5052,7 @@
}
/**
- * Checks if the provided arguments are from an iteratee call.
+ * Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
@@ -5431,7 +5460,7 @@
/**
* 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.
*
* @static
@@ -5911,8 +5940,8 @@
}
/**
- * Creates an array of unique values that are included in all of the provided
- * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * Creates an array of unique values that are included in all given arrays
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
@@ -6077,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)
* for equality comparisons.
*
@@ -6634,8 +6663,8 @@
}
/**
- * Creates an array of unique values, in order, from all of the provided arrays
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * Creates an array of unique values, in order, from all given arrays using
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
@@ -6846,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)
* for equality comparisons.
*
@@ -6869,7 +6898,7 @@
/**
* 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
* @memberOf _
@@ -7895,7 +7924,7 @@
* Reduces `collection` to a value which is the accumulated result of running
* each element in `collection` through `iteratee`, where each successive
* 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:
* (accumulator, value, index|key, collection).
*
@@ -8624,7 +8653,7 @@
if (maxWait === false) {
var leadingCall = leading && !timeoutId;
} else {
- if (!maxTimeoutId && !leading) {
+ if (!lastCalled && !maxTimeoutId && !leading) {
lastCalled = stamp;
}
var remaining = maxWait - (stamp - lastCalled),
@@ -9423,6 +9452,27 @@
*/
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
* not a function and has a `value.length` that's an integer greater than or
@@ -9502,6 +9552,26 @@
(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.
*
@@ -9835,6 +9905,26 @@
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
* `object` contains equivalent property values.
@@ -10120,6 +10210,26 @@
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.
*
@@ -10202,6 +10312,46 @@
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`.
*
@@ -10636,7 +10786,7 @@
/**
* 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
* @memberOf _
@@ -12402,7 +12552,7 @@
* in "interpolate" delimiters, HTML-escape interpolated data properties in
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
* 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
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
@@ -13080,9 +13230,9 @@
}
/**
- * Creates a function that returns the result of invoking the provided
- * functions with the `this` binding of the created function, where each
- * successive invocation is supplied the return value of the previous.
+ * Creates a function that returns the result of invoking the given functions
+ * with the `this` binding of the created function, where each successive
+ * invocation is supplied the return value of the previous.
*
* @static
* @memberOf _
@@ -13103,7 +13253,7 @@
/**
* 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
* @memberOf _
@@ -13123,7 +13273,7 @@
var flowRight = createFlow(true);
/**
- * This method returns the first argument provided to it.
+ * This method returns the first argument given to it.
*
* @static
* @memberOf _
@@ -13675,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
* @memberOf _
@@ -13713,6 +13863,9 @@
*/
function add(augend, addend) {
var result;
+ if (augend === undefined && addend === undefined) {
+ return 0;
+ }
if (augend !== undefined) {
result = augend;
}
@@ -13923,6 +14076,9 @@
*/
function subtract(minuend, subtrahend) {
var result;
+ if (minuend === undefined && subtrahend === undefined) {
+ return 0;
+ }
if (minuend !== undefined) {
result = minuend;
}
@@ -14209,9 +14365,11 @@
lodash.invoke = invoke;
lodash.isArguments = isArguments;
lodash.isArray = isArray;
+ lodash.isArrayBuffer = isArrayBuffer;
lodash.isArrayLike = isArrayLike;
lodash.isArrayLikeObject = isArrayLikeObject;
lodash.isBoolean = isBoolean;
+ lodash.isBuffer = isBuffer;
lodash.isDate = isDate;
lodash.isElement = isElement;
lodash.isEmpty = isEmpty;
@@ -14222,6 +14380,7 @@
lodash.isFunction = isFunction;
lodash.isInteger = isInteger;
lodash.isLength = isLength;
+ lodash.isMap = isMap;
lodash.isMatch = isMatch;
lodash.isMatchWith = isMatchWith;
lodash.isNaN = isNaN;
@@ -14234,10 +14393,13 @@
lodash.isPlainObject = isPlainObject;
lodash.isRegExp = isRegExp;
lodash.isSafeInteger = isSafeInteger;
+ lodash.isSet = isSet;
lodash.isString = isString;
lodash.isSymbol = isSymbol;
lodash.isTypedArray = isTypedArray;
lodash.isUndefined = isUndefined;
+ lodash.isWeakMap = isWeakMap;
+ lodash.isWeakSet = isWeakSet;
lodash.join = join;
lodash.kebabCase = kebabCase;
lodash.last = last;
diff --git a/package.json b/package.json
index 0b4dd2dd3..6fef2de90 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash-amd",
- "version": "4.2.1",
+ "version": "4.3.0",
"description": "Lodash exported as AMD modules.",
"homepage": "https://lodash.com/custom-builds",
"license": "MIT",
diff --git a/partial.js b/partial.js
index 2212f4fbe..3c7a3ce33 100644
--- a/partial.js
+++ b/partial.js
@@ -45,5 +45,8 @@ define(['./_createWrapper', './_replaceHolders', './rest'], function(createWrapp
return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);
});
+ // Assign default placeholders.
+ partial.placeholder = {};
+
return partial;
});
diff --git a/partialRight.js b/partialRight.js
index 64aecd97a..0ccf3eee2 100644
--- a/partialRight.js
+++ b/partialRight.js
@@ -44,5 +44,8 @@ define(['./_createWrapper', './_replaceHolders', './rest'], function(createWrapp
return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
});
+ // Assign default placeholders.
+ partialRight.placeholder = {};
+
return partialRight;
});
diff --git a/pull.js b/pull.js
index 9af99b733..45b6f89a1 100644
--- a/pull.js
+++ b/pull.js
@@ -1,7 +1,7 @@
define(['./pullAll', './rest'], function(pullAll, 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)
* for equality comparisons.
*
diff --git a/reduce.js b/reduce.js
index 46ed1fa71..ed81bc3c4 100644
--- a/reduce.js
+++ b/reduce.js
@@ -4,7 +4,7 @@ define(['./_arrayReduce', './_baseEach', './_baseIteratee', './_baseReduce', './
* Reduces `collection` to a value which is the accumulated result of running
* each element in `collection` through `iteratee`, where each successive
* 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:
* (accumulator, value, index|key, collection).
*
diff --git a/subtract.js b/subtract.js
index 258936405..d1edb2946 100644
--- a/subtract.js
+++ b/subtract.js
@@ -19,6 +19,9 @@ define([], function() {
*/
function subtract(minuend, subtrahend) {
var result;
+ if (minuend === undefined && subtrahend === undefined) {
+ return 0;
+ }
if (minuend !== undefined) {
result = minuend;
}
diff --git a/template.js b/template.js
index 04fe6aa14..3d6943b28 100644
--- a/template.js
+++ b/template.js
@@ -22,7 +22,7 @@ define(['./_assignInDefaults', './assignInWith', './attempt', './_baseValues', '
* in "interpolate" delimiters, HTML-escape interpolated data properties in
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
* 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
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
diff --git a/union.js b/union.js
index a3eb63ce7..de8fa5193 100644
--- a/union.js
+++ b/union.js
@@ -1,8 +1,8 @@
define(['./_baseFlatten', './_baseUniq', './rest'], function(baseFlatten, baseUniq, rest) {
/**
- * Creates an array of unique values, in order, from all of the provided arrays
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * Creates an array of unique values, in order, from all given arrays using
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
diff --git a/uniqueId.js b/uniqueId.js
index debf6d106..96b9973a7 100644
--- a/uniqueId.js
+++ b/uniqueId.js
@@ -4,7 +4,7 @@ define(['./toString'], function(toString) {
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
* @memberOf _
diff --git a/without.js b/without.js
index ffce92935..ca0416dbc 100644
--- a/without.js
+++ b/without.js
@@ -1,7 +1,7 @@
define(['./_baseDifference', './isArrayLikeObject', './rest'], function(baseDifference, isArrayLikeObject, 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)
* for equality comparisons.
*
diff --git a/xor.js b/xor.js
index 24d09b039..2545748c4 100644
--- a/xor.js
+++ b/xor.js
@@ -2,7 +2,7 @@ define(['./_arrayFilter', './_baseXor', './isArrayLikeObject', './rest'], functi
/**
* 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
* @memberOf _