diff --git a/LICENSE b/LICENSE
index bcbe13d67..e0c69d560 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,23 +1,47 @@
-The MIT License (MIT)
+Copyright jQuery Foundation and other contributors
-Copyright 2012-2016 The Dojo Foundation
-Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
+Based on Underscore.js, copyright 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:
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/lodash/lodash
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
+The following license applies to all parts of this software except as
+documented below:
-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.
+====
+
+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 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.
+
+====
+
+Copyright and related rights for sample code are waived via CC0. Sample
+code is defined as all source code displayed within the prose of the
+documentation.
+
+CC0: http://creativecommons.org/publicdomain/zero/1.0/
+
+====
+
+Files located in the node_modules and vendor directories are externally
+maintained libraries used by this software which have their own
+licenses; we recommend you read them, as their terms may differ from the
+terms above.
diff --git a/README.md b/README.md
index 965a5afd4..3d1a4c360 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# lodash-es v4.6.1
+# lodash-es v4.7.0
The [lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
$ lodash modularize exports=es -o ./
```
-See the [package source](https://github.com/lodash/lodash/tree/4.6.1-es) for more details.
+See the [package source](https://github.com/lodash/lodash/tree/4.7.0-es) for more details.
diff --git a/_DataView.js b/_DataView.js
new file mode 100644
index 000000000..5c99e3f73
--- /dev/null
+++ b/_DataView.js
@@ -0,0 +1,7 @@
+import getNative from './_getNative';
+import root from './_root';
+
+/* Built-in method references that are verified to be native. */
+var DataView = getNative(root, 'DataView');
+
+export default DataView;
diff --git a/_LazyWrapper.js b/_LazyWrapper.js
index 9a4a2ad50..79e509fc9 100644
--- a/_LazyWrapper.js
+++ b/_LazyWrapper.js
@@ -21,6 +21,7 @@ function LazyWrapper(value) {
this.__views__ = [];
}
+// Ensure `LazyWrapper` is an instance of `baseLodash`.
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
diff --git a/_LodashWrapper.js b/_LodashWrapper.js
index b7e44407d..068b8e727 100644
--- a/_LodashWrapper.js
+++ b/_LodashWrapper.js
@@ -6,7 +6,7 @@ import baseLodash from './_baseLodash';
*
* @private
* @param {*} value The value to wrap.
- * @param {boolean} [chainAll] Enable chaining for all wrapper methods.
+ * @param {boolean} [chainAll] Enable explicit method chain sequences.
*/
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
diff --git a/_MapCache.js b/_MapCache.js
index 3ca6da713..f549d0716 100644
--- a/_MapCache.js
+++ b/_MapCache.js
@@ -22,7 +22,7 @@ function MapCache(values) {
}
}
-// Add functions to the `MapCache`.
+// Add methods to `MapCache`.
MapCache.prototype.clear = mapClear;
MapCache.prototype['delete'] = mapDelete;
MapCache.prototype.get = mapGet;
diff --git a/_Promise.js b/_Promise.js
new file mode 100644
index 000000000..e56a9fdd9
--- /dev/null
+++ b/_Promise.js
@@ -0,0 +1,7 @@
+import getNative from './_getNative';
+import root from './_root';
+
+/* Built-in method references that are verified to be native. */
+var Promise = getNative(root, 'Promise');
+
+export default Promise;
diff --git a/_SetCache.js b/_SetCache.js
index 616f7c036..1fdc2ce8b 100644
--- a/_SetCache.js
+++ b/_SetCache.js
@@ -19,7 +19,7 @@ function SetCache(values) {
}
}
-// Add functions to the `SetCache`.
+// Add methods to `SetCache`.
SetCache.prototype.push = cachePush;
export default SetCache;
diff --git a/_Stack.js b/_Stack.js
index 50b7ebb56..43dd238ac 100644
--- a/_Stack.js
+++ b/_Stack.js
@@ -22,7 +22,7 @@ function Stack(values) {
}
}
-// Add functions to the `Stack` cache.
+// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
diff --git a/_arrayEvery.js b/_arrayEvery.js
index dcf4460ef..c2ab8922f 100644
--- a/_arrayEvery.js
+++ b/_arrayEvery.js
@@ -5,7 +5,8 @@
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`.
*/
function arrayEvery(array, predicate) {
var index = -1,
diff --git a/_arrayReduce.js b/_arrayReduce.js
index 15ce42904..2f9db33f5 100644
--- a/_arrayReduce.js
+++ b/_arrayReduce.js
@@ -6,7 +6,8 @@
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
- * @param {boolean} [initAccum] Specify using the first element of `array` as the initial value.
+ * @param {boolean} [initAccum] Specify using the first element of `array` as
+ * the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduce(array, iteratee, accumulator, initAccum) {
diff --git a/_arrayReduceRight.js b/_arrayReduceRight.js
index b05bff76a..0f9d810bd 100644
--- a/_arrayReduceRight.js
+++ b/_arrayReduceRight.js
@@ -6,7 +6,8 @@
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
- * @param {boolean} [initAccum] Specify using the last element of `array` as the initial value.
+ * @param {boolean} [initAccum] Specify using the last element of `array` as
+ * the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
diff --git a/_arraySome.js b/_arraySome.js
index 0e3f1850f..b8700dede 100644
--- a/_arraySome.js
+++ b/_arraySome.js
@@ -5,7 +5,8 @@
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
diff --git a/_assocDelete.js b/_assocDelete.js
index 215bea701..dbdb350a5 100644
--- a/_assocDelete.js
+++ b/_assocDelete.js
@@ -10,7 +10,7 @@ var splice = arrayProto.splice;
* Removes `key` and its value from the associative array.
*
* @private
- * @param {Array} array The array to query.
+ * @param {Array} array The array to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
diff --git a/_assocIndexOf.js b/_assocIndexOf.js
index a80dd4fce..86abb1547 100644
--- a/_assocIndexOf.js
+++ b/_assocIndexOf.js
@@ -1,8 +1,7 @@
import eq from './eq';
/**
- * Gets the index at which the first occurrence of `key` is found in `array`
- * of key-value pairs.
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to search.
diff --git a/_baseCastArrayLikeObject.js b/_baseCastArrayLikeObject.js
index 3c139b2bb..5bf6e11a1 100644
--- a/_baseCastArrayLikeObject.js
+++ b/_baseCastArrayLikeObject.js
@@ -5,7 +5,7 @@ import isArrayLikeObject from './isArrayLikeObject';
*
* @private
* @param {*} value The value to inspect.
- * @returns {Array} Returns the array-like object.
+ * @returns {Array|Object} Returns the cast array-like object.
*/
function baseCastArrayLikeObject(value) {
return isArrayLikeObject(value) ? value : [];
diff --git a/_baseCastFunction.js b/_baseCastFunction.js
index dfa272ecc..169d6c3aa 100644
--- a/_baseCastFunction.js
+++ b/_baseCastFunction.js
@@ -5,7 +5,7 @@ import identity from './identity';
*
* @private
* @param {*} value The value to inspect.
- * @returns {Array} Returns the array-like object.
+ * @returns {Function} Returns cast function.
*/
function baseCastFunction(value) {
return typeof value == 'function' ? value : identity;
diff --git a/_baseCastKey.js b/_baseCastKey.js
new file mode 100644
index 000000000..cd2d475c9
--- /dev/null
+++ b/_baseCastKey.js
@@ -0,0 +1,14 @@
+import isSymbol from './isSymbol';
+
+/**
+ * Casts `value` to a string if it's not a string or symbol.
+ *
+ * @private
+ * @param {*} value The value to inspect.
+ * @returns {string|symbol} Returns the cast key.
+ */
+function baseCastKey(key) {
+ return (typeof key == 'string' || isSymbol(key)) ? key : (key + '');
+}
+
+export default baseCastKey;
diff --git a/_baseClone.js b/_baseClone.js
index deb2f1c65..10ce1d0ff 100644
--- a/_baseClone.js
+++ b/_baseClone.js
@@ -2,10 +2,10 @@ import Stack from './_Stack';
import arrayEach from './_arrayEach';
import assignValue from './_assignValue';
import baseAssign from './_baseAssign';
-import baseForOwn from './_baseForOwn';
import cloneBuffer from './_cloneBuffer';
import copyArray from './_copyArray';
import copySymbols from './_copySymbols';
+import getAllKeys from './_getAllKeys';
import getTag from './_getTag';
import initCloneArray from './_initCloneArray';
import initCloneByTag from './_initCloneByTag';
@@ -14,6 +14,7 @@ import isArray from './isArray';
import isBuffer from './isBuffer';
import isHostObject from './_isHostObject';
import isObject from './isObject';
+import keys from './keys';
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
@@ -33,6 +34,7 @@ var argsTag = '[object Arguments]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
+ dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
@@ -46,16 +48,16 @@ var arrayBufferTag = '[object ArrayBuffer]',
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] =
-cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
-cloneableTags[dateTag] = cloneableTags[float32Tag] =
-cloneableTags[float64Tag] = cloneableTags[int8Tag] =
-cloneableTags[int16Tag] = cloneableTags[int32Tag] =
-cloneableTags[mapTag] = cloneableTags[numberTag] =
-cloneableTags[objectTag] = cloneableTags[regexpTag] =
-cloneableTags[setTag] = cloneableTags[stringTag] =
-cloneableTags[symbolTag] = cloneableTags[uint8Tag] =
-cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] =
-cloneableTags[uint32Tag] = true;
+cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
+cloneableTags[boolTag] = cloneableTags[dateTag] =
+cloneableTags[float32Tag] = cloneableTags[float64Tag] =
+cloneableTags[int8Tag] = cloneableTags[int16Tag] =
+cloneableTags[int32Tag] = cloneableTags[mapTag] =
+cloneableTags[numberTag] = cloneableTags[objectTag] =
+cloneableTags[regexpTag] = cloneableTags[setTag] =
+cloneableTags[stringTag] = cloneableTags[symbolTag] =
+cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
+cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] =
cloneableTags[weakMapTag] = false;
@@ -103,14 +105,13 @@ function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
}
result = initCloneObject(isFunc ? {} : value);
if (!isDeep) {
- result = baseAssign(result, value);
- return isFull ? copySymbols(value, result) : result;
+ return copySymbols(value, baseAssign(result, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
- result = initCloneByTag(value, tag, isDeep);
+ result = initCloneByTag(value, tag, baseClone, isDeep);
}
}
// Check for circular references and return its corresponding clone.
@@ -121,11 +122,18 @@ function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
}
stack.set(value, result);
+ if (!isArr) {
+ var props = isFull ? getAllKeys(value) : keys(value);
+ }
// Recursively populate clone (susceptible to call stack limits).
- (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
+ arrayEach(props || value, function(subValue, key) {
+ if (props) {
+ key = subValue;
+ subValue = value[key];
+ }
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
});
- return (isFull && !isArr) ? copySymbols(value, result) : result;
+ return result;
}
export default baseClone;
diff --git a/_baseConforms.js b/_baseConforms.js
index bbcb3253f..c8623a1c7 100644
--- a/_baseConforms.js
+++ b/_baseConforms.js
@@ -21,7 +21,8 @@ function baseConforms(source) {
predicate = source[key],
value = object[key];
- if ((value === undefined && !(key in Object(object))) || !predicate(value)) {
+ if ((value === undefined &&
+ !(key in Object(object))) || !predicate(value)) {
return false;
}
}
diff --git a/_baseDifference.js b/_baseDifference.js
index c65b4222e..f38753b8e 100644
--- a/_baseDifference.js
+++ b/_baseDifference.js
@@ -9,8 +9,8 @@ import cacheHas from './_cacheHas';
var LARGE_ARRAY_SIZE = 200;
/**
- * The base implementation of methods like `_.difference` without support for
- * excluding multiple arrays or iteratee shorthands.
+ * The base implementation of methods like `_.difference` without support
+ * for excluding multiple arrays or iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
diff --git a/_baseEvery.js b/_baseEvery.js
index 8de3a4d89..d4b2ddd9c 100644
--- a/_baseEvery.js
+++ b/_baseEvery.js
@@ -6,7 +6,8 @@ import baseEach from './_baseEach';
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`
*/
function baseEvery(collection, predicate) {
var result = true;
diff --git a/_baseFind.js b/_baseFind.js
index c59775e72..a6d965bd8 100644
--- a/_baseFind.js
+++ b/_baseFind.js
@@ -7,7 +7,8 @@
* @param {Array|Object} collection The collection to search.
* @param {Function} predicate The function invoked per iteration.
* @param {Function} eachFunc The function to iterate over `collection`.
- * @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself.
+ * @param {boolean} [retKey] Specify returning the key of the found element
+ * instead of the element itself.
* @returns {*} Returns the found element or its key, else `undefined`.
*/
function baseFind(collection, predicate, eachFunc, retKey) {
diff --git a/_baseFor.js b/_baseFor.js
index 8c300c8f7..7dbcfb36f 100644
--- a/_baseFor.js
+++ b/_baseFor.js
@@ -1,10 +1,9 @@
import createBaseFor from './_createBaseFor';
/**
- * The base implementation of `baseForIn` and `baseForOwn` which iterates
- * over `object` properties returned by `keysFunc` invoking `iteratee` for
- * each property. Iteratee functions may exit iteration early by explicitly
- * returning `false`.
+ * The base implementation of `baseForOwn` which iterates over `object`
+ * properties returned by `keysFunc` invoking `iteratee` for each property.
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
diff --git a/_baseForIn.js b/_baseForIn.js
deleted file mode 100644
index 5f9d91527..000000000
--- a/_baseForIn.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import baseFor from './_baseFor';
-import keysIn from './keysIn';
-
-/**
- * The base implementation of `_.forIn` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Object} Returns `object`.
- */
-function baseForIn(object, iteratee) {
- return object == null ? object : baseFor(object, iteratee, keysIn);
-}
-
-export default baseForIn;
diff --git a/_baseGet.js b/_baseGet.js
index 93383ecfd..0b7194ff6 100644
--- a/_baseGet.js
+++ b/_baseGet.js
@@ -10,7 +10,7 @@ import isKey from './_isKey';
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
- path = isKey(path, object) ? [path + ''] : baseCastPath(path);
+ path = isKey(path, object) ? [path] : baseCastPath(path);
var index = 0,
length = path.length;
diff --git a/_baseGetAllKeys.js b/_baseGetAllKeys.js
new file mode 100644
index 000000000..7c9487948
--- /dev/null
+++ b/_baseGetAllKeys.js
@@ -0,0 +1,22 @@
+import arrayPush from './_arrayPush';
+import isArray from './isArray';
+
+/**
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
+ * symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @param {Function} keysFunc The function to get the keys of `object`.
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
+ * @returns {Array} Returns the array of property names and symbols.
+ */
+function baseGetAllKeys(object, keysFunc, symbolsFunc) {
+ var result = keysFunc(object);
+ return isArray(object)
+ ? result
+ : arrayPush(result, symbolsFunc(object));
+}
+
+export default baseGetAllKeys;
diff --git a/_baseHas.js b/_baseHas.js
index a2e44f345..8fdb4406b 100644
--- a/_baseHas.js
+++ b/_baseHas.js
@@ -1,12 +1,11 @@
+import getPrototype from './_getPrototype';
+
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
-/** Built-in value references. */
-var getPrototypeOf = Object.getPrototypeOf;
-
/**
* The base implementation of `_.has` without support for deep paths.
*
@@ -20,7 +19,7 @@ function baseHas(object, key) {
// that are composed entirely of index properties, return `false` for
// `hasOwnProperty` checks of them.
return hasOwnProperty.call(object, key) ||
- (typeof object == 'object' && key in object && getPrototypeOf(object) === null);
+ (typeof object == 'object' && key in object && getPrototype(object) === null);
}
export default baseHas;
diff --git a/_baseIsEqualDeep.js b/_baseIsEqualDeep.js
index 41484522a..c8160a8bb 100644
--- a/_baseIsEqualDeep.js
+++ b/_baseIsEqualDeep.js
@@ -31,7 +31,8 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparisons.
- * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details.
+ * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
+ * for more details.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
@@ -64,8 +65,11 @@ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
+ var objUnwrapped = objIsWrapped ? object.value() : object,
+ othUnwrapped = othIsWrapped ? other.value() : other;
+
stack || (stack = new Stack);
- return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack);
+ return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
}
}
if (!isSameTag) {
diff --git a/_baseIsMatch.js b/_baseIsMatch.js
index a0b0b84a7..e720351dc 100644
--- a/_baseIsMatch.js
+++ b/_baseIsMatch.js
@@ -44,9 +44,10 @@ function baseIsMatch(object, source, matchData, customizer) {
return false;
}
} else {
- var stack = new Stack,
- result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined;
-
+ var stack = new Stack;
+ if (customizer) {
+ var result = customizer(objValue, srcValue, key, object, source, stack);
+ }
if (!(result === undefined
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
: result
diff --git a/_baseIteratee.js b/_baseIteratee.js
index e8bd0aa28..0a3d36658 100644
--- a/_baseIteratee.js
+++ b/_baseIteratee.js
@@ -12,14 +12,15 @@ import property from './property';
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
- var type = typeof value;
- if (type == 'function') {
+ // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
+ // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
+ if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
- if (type == 'object') {
+ if (typeof value == 'object') {
return isArray(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
diff --git a/_baseLodash.js b/_baseLodash.js
index 8633ead98..10aed0849 100644
--- a/_baseLodash.js
+++ b/_baseLodash.js
@@ -1,5 +1,5 @@
/**
- * The function whose prototype all chaining wrappers inherit from.
+ * The function whose prototype chain sequence wrappers inherit from.
*
* @private
*/
diff --git a/_baseMean.js b/_baseMean.js
new file mode 100644
index 000000000..70d0a2065
--- /dev/null
+++ b/_baseMean.js
@@ -0,0 +1,20 @@
+import baseSum from './_baseSum';
+
+/** Used as references for various `Number` constants. */
+var NAN = 0 / 0;
+
+/**
+ * The base implementation of `_.mean` and `_.meanBy` without support for
+ * iteratee shorthands.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {number} Returns the mean.
+ */
+function baseMean(array, iteratee) {
+ var length = array ? array.length : 0;
+ return length ? (baseSum(array, iteratee) / length) : NAN;
+}
+
+export default baseMean;
diff --git a/_baseMerge.js b/_baseMerge.js
index 0869eacdd..d6747a3a6 100644
--- a/_baseMerge.js
+++ b/_baseMerge.js
@@ -15,16 +15,16 @@ import keysIn from './keysIn';
* @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values.
- * @param {Object} [stack] Tracks traversed source values and their merged counterparts.
+ * @param {Object} [stack] Tracks traversed source values and their merged
+ * counterparts.
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
- var props = (isArray(source) || isTypedArray(source))
- ? undefined
- : keysIn(source);
-
+ if (!(isArray(source) || isTypedArray(source))) {
+ var props = keysIn(source);
+ }
arrayEach(props || source, function(srcValue, key) {
if (props) {
key = srcValue;
diff --git a/_baseMergeDeep.js b/_baseMergeDeep.js
index dff6c2dff..1e5e001f8 100644
--- a/_baseMergeDeep.js
+++ b/_baseMergeDeep.js
@@ -22,7 +22,8 @@ import toPlainObject from './toPlainObject';
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
- * @param {Object} [stack] Tracks traversed source values and their merged counterparts.
+ * @param {Object} [stack] Tracks traversed source values and their merged
+ * counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = object[key],
@@ -50,7 +51,7 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta
}
else {
isCommon = false;
- newValue = baseClone(srcValue, !customizer);
+ newValue = baseClone(srcValue, true);
}
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
@@ -59,7 +60,7 @@ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, sta
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
isCommon = false;
- newValue = baseClone(srcValue, !customizer);
+ newValue = baseClone(srcValue, true);
}
else {
newValue = objValue;
diff --git a/_baseOrderBy.js b/_baseOrderBy.js
index 9f892d07c..4a200e570 100644
--- a/_baseOrderBy.js
+++ b/_baseOrderBy.js
@@ -3,6 +3,7 @@ import baseIteratee from './_baseIteratee';
import baseMap from './_baseMap';
import baseSortBy from './_baseSortBy';
import compareMultiple from './_compareMultiple';
+import identity from './identity';
/**
* The base implementation of `_.orderBy` without param guards.
@@ -15,7 +16,7 @@ import compareMultiple from './_compareMultiple';
*/
function baseOrderBy(collection, iteratees, orders) {
var index = -1;
- iteratees = arrayMap(iteratees.length ? iteratees : Array(1), baseIteratee);
+ iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseIteratee);
var result = baseMap(collection, function(value, key, collection) {
var criteria = arrayMap(iteratees, function(iteratee) {
diff --git a/_basePick.js b/_basePick.js
index c942ef137..e877fb1b3 100644
--- a/_basePick.js
+++ b/_basePick.js
@@ -2,11 +2,11 @@ import arrayReduce from './_arrayReduce';
/**
* The base implementation of `_.pick` without support for individual
- * property names.
+ * property identifiers.
*
* @private
* @param {Object} object The source object.
- * @param {string[]} props The property names to pick.
+ * @param {string[]} props The property identifiers to pick.
* @returns {Object} Returns the new object.
*/
function basePick(object, props) {
diff --git a/_basePickBy.js b/_basePickBy.js
index 32efc66b5..3b88367ea 100644
--- a/_basePickBy.js
+++ b/_basePickBy.js
@@ -1,4 +1,4 @@
-import baseForIn from './_baseForIn';
+import getAllKeysIn from './_getAllKeysIn';
/**
* The base implementation of `_.pickBy` without support for iteratee shorthands.
@@ -9,12 +9,19 @@ import baseForIn from './_baseForIn';
* @returns {Object} Returns the new object.
*/
function basePickBy(object, predicate) {
- var result = {};
- baseForIn(object, function(value, key) {
+ var index = -1,
+ props = getAllKeysIn(object),
+ length = props.length,
+ result = {};
+
+ while (++index < length) {
+ var key = props[index],
+ value = object[key];
+
if (predicate(value, key)) {
result[key] = value;
}
- });
+ }
return result;
}
diff --git a/_baseReduce.js b/_baseReduce.js
index 3fb676aa9..069fed50f 100644
--- a/_baseReduce.js
+++ b/_baseReduce.js
@@ -6,7 +6,8 @@
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} accumulator The initial value.
- * @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value.
+ * @param {boolean} initAccum Specify using the first or last element of
+ * `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value.
*/
diff --git a/_baseRepeat.js b/_baseRepeat.js
new file mode 100644
index 000000000..594539a7a
--- /dev/null
+++ b/_baseRepeat.js
@@ -0,0 +1,35 @@
+/** Used as references for various `Number` constants. */
+var MAX_SAFE_INTEGER = 9007199254740991;
+
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeFloor = Math.floor;
+
+/**
+ * The base implementation of `_.repeat` which doesn't coerce arguments.
+ *
+ * @private
+ * @param {string} string The string to repeat.
+ * @param {number} n The number of times to repeat the string.
+ * @returns {string} Returns the repeated string.
+ */
+function baseRepeat(string, n) {
+ var result = '';
+ if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
+ return result;
+ }
+ // Leverage the exponentiation by squaring algorithm for a faster repeat.
+ // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
+ do {
+ if (n % 2) {
+ result += string;
+ }
+ n = nativeFloor(n / 2);
+ if (n) {
+ string += string;
+ }
+ } while (n);
+
+ return result;
+}
+
+export default baseRepeat;
diff --git a/_baseSet.js b/_baseSet.js
index de4debfd3..6e96a08ea 100644
--- a/_baseSet.js
+++ b/_baseSet.js
@@ -15,7 +15,7 @@ import isObject from './isObject';
* @returns {Object} Returns `object`.
*/
function baseSet(object, path, value, customizer) {
- path = isKey(path, object) ? [path + ''] : baseCastPath(path);
+ path = isKey(path, object) ? [path] : baseCastPath(path);
var index = -1,
length = path.length,
diff --git a/_baseSome.js b/_baseSome.js
index def0a3203..94f065eae 100644
--- a/_baseSome.js
+++ b/_baseSome.js
@@ -6,7 +6,8 @@ import baseEach from './_baseEach';
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
*/
function baseSome(collection, predicate) {
var result;
diff --git a/_baseSortedIndexBy.js b/_baseSortedIndexBy.js
index 8c035ec3b..136ae1f9f 100644
--- a/_baseSortedIndexBy.js
+++ b/_baseSortedIndexBy.js
@@ -16,7 +16,8 @@ var nativeFloor = Math.floor,
* @param {*} value The value to evaluate.
* @param {Function} iteratee The iteratee invoked per element.
* @param {boolean} [retHighest] Specify returning the highest qualified index.
- * @returns {number} Returns the index at which `value` should be inserted into `array`.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
*/
function baseSortedIndexBy(array, value, iteratee, retHighest) {
value = iteratee(value);
diff --git a/_baseSum.js b/_baseSum.js
index c0e4ea5e3..61b3da44f 100644
--- a/_baseSum.js
+++ b/_baseSum.js
@@ -1,5 +1,6 @@
/**
- * The base implementation of `_.sum` without support for iteratee shorthands.
+ * The base implementation of `_.sum` and `_.sumBy` without support for
+ * iteratee shorthands.
*
* @private
* @param {Array} array The array to iterate over.
diff --git a/_baseUnset.js b/_baseUnset.js
index 6666c9c54..7b937db9a 100644
--- a/_baseUnset.js
+++ b/_baseUnset.js
@@ -13,7 +13,7 @@ import parent from './_parent';
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
- path = isKey(path, object) ? [path + ''] : baseCastPath(path);
+ path = isKey(path, object) ? [path] : baseCastPath(path);
object = parent(object, path);
var key = last(path);
return (object != null && has(object, key)) ? delete object[key] : true;
diff --git a/_baseZipObject.js b/_baseZipObject.js
index 98f29af3a..f6f4a3cc5 100644
--- a/_baseZipObject.js
+++ b/_baseZipObject.js
@@ -2,7 +2,7 @@
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
*
* @private
- * @param {Array} props The property names.
+ * @param {Array} props The property identifiers.
* @param {Array} values The property values.
* @param {Function} assignFunc The function to assign values.
* @returns {Object} Returns the new object.
@@ -14,7 +14,8 @@ function baseZipObject(props, values, assignFunc) {
result = {};
while (++index < length) {
- assignFunc(result, props[index], index < valsLength ? values[index] : undefined);
+ var value = index < valsLength ? values[index] : undefined;
+ assignFunc(result, props[index], value);
}
return result;
}
diff --git a/_cloneDataView.js b/_cloneDataView.js
new file mode 100644
index 000000000..211b6b2c3
--- /dev/null
+++ b/_cloneDataView.js
@@ -0,0 +1,16 @@
+import cloneArrayBuffer from './_cloneArrayBuffer';
+
+/**
+ * Creates a clone of `dataView`.
+ *
+ * @private
+ * @param {Object} dataView The data view to clone.
+ * @param {boolean} [isDeep] Specify a deep clone.
+ * @returns {Object} Returns the cloned data view.
+ */
+function cloneDataView(dataView, isDeep) {
+ var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
+}
+
+export default cloneDataView;
diff --git a/_cloneMap.js b/_cloneMap.js
index 122e72c0d..cf29f2ef3 100644
--- a/_cloneMap.js
+++ b/_cloneMap.js
@@ -7,10 +7,13 @@ import mapToArray from './_mapToArray';
*
* @private
* @param {Object} map The map to clone.
+ * @param {Function} cloneFunc The function to clone values.
+ * @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned map.
*/
-function cloneMap(map) {
- return arrayReduce(mapToArray(map), addMapEntry, new map.constructor);
+function cloneMap(map, isDeep, cloneFunc) {
+ var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
+ return arrayReduce(array, addMapEntry, new map.constructor);
}
export default cloneMap;
diff --git a/_cloneSet.js b/_cloneSet.js
index 2189362e4..3cc5bf948 100644
--- a/_cloneSet.js
+++ b/_cloneSet.js
@@ -7,10 +7,13 @@ import setToArray from './_setToArray';
*
* @private
* @param {Object} set The set to clone.
+ * @param {Function} cloneFunc The function to clone values.
+ * @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned set.
*/
-function cloneSet(set) {
- return arrayReduce(setToArray(set), addSetEntry, new set.constructor);
+function cloneSet(set, isDeep, cloneFunc) {
+ var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
+ return arrayReduce(array, addSetEntry, new set.constructor);
}
export default cloneSet;
diff --git a/_compareMultiple.js b/_compareMultiple.js
index 7e2887b7a..2f34783e6 100644
--- a/_compareMultiple.js
+++ b/_compareMultiple.js
@@ -37,7 +37,7 @@ function compareMultiple(object, other, orders) {
// for more details.
//
// This also ensures a stable sort in V8 and other engines.
- // See https://code.google.com/p/v8/issues/detail?id=90 for more details.
+ // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
return object.index - other.index;
}
diff --git a/_copyObject.js b/_copyObject.js
index 3a22a6394..4028fc0bd 100644
--- a/_copyObject.js
+++ b/_copyObject.js
@@ -5,7 +5,7 @@ import copyObjectWith from './_copyObjectWith';
*
* @private
* @param {Object} source The object to copy properties from.
- * @param {Array} props The property names to copy.
+ * @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @returns {Object} Returns `object`.
*/
diff --git a/_copyObjectWith.js b/_copyObjectWith.js
index 596505be6..76d8d6af5 100644
--- a/_copyObjectWith.js
+++ b/_copyObjectWith.js
@@ -6,7 +6,7 @@ import assignValue from './_assignValue';
*
* @private
* @param {Object} source The object to copy properties from.
- * @param {Array} props The property names to copy.
+ * @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
diff --git a/_createBaseFor.js b/_createBaseFor.js
index 97249e7de..ac15c59af 100644
--- a/_createBaseFor.js
+++ b/_createBaseFor.js
@@ -1,5 +1,5 @@
/**
- * Creates a base function for methods like `_.forIn`.
+ * Creates a base function for methods like `_.forIn` and `_.forOwn`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
diff --git a/_createBaseWrapper.js b/_createBaseWrapper.js
index 90df28ff4..d14365731 100644
--- a/_createBaseWrapper.js
+++ b/_createBaseWrapper.js
@@ -10,7 +10,8 @@ var BIND_FLAG = 1;
*
* @private
* @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
+ * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
+ * for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new wrapped function.
*/
diff --git a/_createCurryWrapper.js b/_createCurryWrapper.js
index 8d727c88a..69db47654 100644
--- a/_createCurryWrapper.js
+++ b/_createCurryWrapper.js
@@ -11,7 +11,8 @@ import root from './_root';
*
* @private
* @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
+ * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
+ * for more details.
* @param {number} arity The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
diff --git a/_createFlow.js b/_createFlow.js
index e9e1d5e35..8472b9761 100644
--- a/_createFlow.js
+++ b/_createFlow.js
@@ -58,7 +58,9 @@ function createFlow(fromRight) {
) {
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
} else {
- wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
+ wrapper = (func.length == 1 && isLaziable(func))
+ ? wrapper[funcName]()
+ : wrapper.thru(func);
}
}
return function() {
diff --git a/_createHybridWrapper.js b/_createHybridWrapper.js
index 8fdab8b72..37752f2d5 100644
--- a/_createHybridWrapper.js
+++ b/_createHybridWrapper.js
@@ -22,11 +22,14 @@ var BIND_FLAG = 1,
*
* @private
* @param {Function|string} func The function or method name to wrap.
- * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
+ * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
+ * for more details.
* @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partials] The arguments to prepend to those provided to the new function.
+ * @param {Array} [partials] The arguments to prepend to those provided to
+ * the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
- * @param {Array} [partialsRight] The arguments to append to those provided to the new function.
+ * @param {Array} [partialsRight] The arguments to append to those provided
+ * to the new function.
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
diff --git a/_createMathOperation.js b/_createMathOperation.js
new file mode 100644
index 000000000..4b35b2cd9
--- /dev/null
+++ b/_createMathOperation.js
@@ -0,0 +1,24 @@
+/**
+ * Creates a function that performs a mathematical operation on two values.
+ *
+ * @private
+ * @param {Function} operator The function to perform the operation.
+ * @returns {Function} Returns the new mathematical operation function.
+ */
+function createMathOperation(operator) {
+ return function(value, other) {
+ var result;
+ if (value === undefined && other === undefined) {
+ return 0;
+ }
+ if (value !== undefined) {
+ result = value;
+ }
+ if (other !== undefined) {
+ result = result === undefined ? other : operator(result, other);
+ }
+ return result;
+ };
+}
+
+export default createMathOperation;
diff --git a/_createPadding.js b/_createPadding.js
index 1a5d41b5e..29d5fd138 100644
--- a/_createPadding.js
+++ b/_createPadding.js
@@ -1,7 +1,6 @@
-import repeat from './repeat';
+import baseRepeat from './_baseRepeat';
import stringSize from './_stringSize';
import stringToArray from './_stringToArray';
-import toInteger from './toInteger';
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
@@ -23,25 +22,21 @@ var nativeCeil = Math.ceil;
* is truncated if the number of characters exceeds `length`.
*
* @private
- * @param {string} string The string to create padding for.
- * @param {number} [length=0] The padding length.
+ * @param {number} length The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padding for `string`.
*/
-function createPadding(string, length, chars) {
- length = toInteger(length);
-
- var strLength = stringSize(string);
- if (!length || strLength >= length) {
- return '';
- }
- var padLength = length - strLength;
+function createPadding(length, chars) {
chars = chars === undefined ? ' ' : (chars + '');
- var result = repeat(chars, nativeCeil(padLength / stringSize(chars)));
+ var charsLength = chars.length;
+ if (charsLength < 2) {
+ return charsLength ? baseRepeat(chars, length) : chars;
+ }
+ var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
return reHasComplexSymbol.test(chars)
- ? stringToArray(result).slice(0, padLength).join('')
- : result.slice(0, padLength);
+ ? stringToArray(result).slice(0, length).join('')
+ : result.slice(0, length);
}
export default createPadding;
diff --git a/_createPartialWrapper.js b/_createPartialWrapper.js
index fb1940dff..22b86d0a2 100644
--- a/_createPartialWrapper.js
+++ b/_createPartialWrapper.js
@@ -12,9 +12,11 @@ var BIND_FLAG = 1;
*
* @private
* @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
+ * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
+ * for more details.
* @param {*} thisArg The `this` binding of `func`.
- * @param {Array} partials The arguments to prepend to those provided to the new function.
+ * @param {Array} partials The arguments to prepend to those provided to
+ * the new function.
* @returns {Function} Returns the new wrapped function.
*/
function createPartialWrapper(func, bitmask, thisArg, partials) {
diff --git a/_createRecurryWrapper.js b/_createRecurryWrapper.js
index a2add3dbb..94a71bd75 100644
--- a/_createRecurryWrapper.js
+++ b/_createRecurryWrapper.js
@@ -15,11 +15,13 @@ var BIND_FLAG = 1,
*
* @private
* @param {Function} func The function to wrap.
- * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
+ * @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
+ * for more details.
* @param {Function} wrapFunc The function to create the `func` wrapper.
* @param {*} placeholder The placeholder value.
* @param {*} [thisArg] The `this` binding of `func`.
- * @param {Array} [partials] The arguments to prepend to those provided to the new function.
+ * @param {Array} [partials] The arguments to prepend to those provided to
+ * the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
diff --git a/_equalArrays.js b/_equalArrays.js
index ce870e5e2..a36357bbb 100644
--- a/_equalArrays.js
+++ b/_equalArrays.js
@@ -13,7 +13,8 @@ var UNORDERED_COMPARE_FLAG = 1,
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` for more details.
+ * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
+ * for more details.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
@@ -55,12 +56,16 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
// Recursively compare arrays (susceptible to call stack limits).
if (isUnordered) {
if (!arraySome(other, function(othValue) {
- return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack);
+ return arrValue === othValue ||
+ equalFunc(arrValue, othValue, customizer, bitmask, stack);
})) {
result = false;
break;
}
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
+ } else if (!(
+ arrValue === othValue ||
+ equalFunc(arrValue, othValue, customizer, bitmask, stack)
+ )) {
result = false;
break;
}
diff --git a/_equalByTag.js b/_equalByTag.js
index bc9e540b8..036d8d28f 100644
--- a/_equalByTag.js
+++ b/_equalByTag.js
@@ -19,7 +19,8 @@ var boolTag = '[object Boolean]',
stringTag = '[object String]',
symbolTag = '[object Symbol]';
-var arrayBufferTag = '[object ArrayBuffer]';
+var arrayBufferTag = '[object ArrayBuffer]',
+ dataViewTag = '[object DataView]';
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
@@ -38,12 +39,21 @@ var symbolProto = Symbol ? Symbol.prototype : undefined,
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` for more details.
+ * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
+ * for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
switch (tag) {
+ case dataViewTag:
+ if ((object.byteLength != other.byteLength) ||
+ (object.byteOffset != other.byteOffset)) {
+ return false;
+ }
+ object = object.buffer;
+ other = other.buffer;
+
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
@@ -53,8 +63,9 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
case boolTag:
case dateTag:
- // Coerce dates and booleans to numbers, dates to milliseconds and booleans
- // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
+ // Coerce dates and booleans to numbers, dates to milliseconds and
+ // booleans to `1` or `0` treating invalid dates coerced to `NaN` as
+ // not equal.
return +object == +other;
case errorTag:
@@ -66,8 +77,8 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
case regexpTag:
case stringTag:
- // Coerce regexes to strings and treat strings primitives and string
- // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
+ // Coerce regexes to strings and treat strings, primitives and objects,
+ // as equal. See https://es5.github.io/#x15.10.6.4 for more details.
return object == (other + '');
case mapTag:
@@ -85,8 +96,11 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
if (stacked) {
return stacked == other;
}
+ bitmask |= UNORDERED_COMPARE_FLAG;
+ stack.set(object, other);
+
// Recursively compare objects (susceptible to call stack limits).
- return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask | UNORDERED_COMPARE_FLAG, stack.set(object, other));
+ return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
case symbolTag:
if (symbolValueOf) {
diff --git a/_equalObjects.js b/_equalObjects.js
index 24bc79606..59b7fbc9d 100644
--- a/_equalObjects.js
+++ b/_equalObjects.js
@@ -13,7 +13,8 @@ var PARTIAL_COMPARE_FLAG = 2;
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} customizer The function to customize comparisons.
- * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` for more details.
+ * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
+ * for more details.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
diff --git a/_getAllKeys.js b/_getAllKeys.js
new file mode 100644
index 000000000..468ae4a19
--- /dev/null
+++ b/_getAllKeys.js
@@ -0,0 +1,16 @@
+import baseGetAllKeys from './_baseGetAllKeys';
+import getSymbols from './_getSymbols';
+import keys from './keys';
+
+/**
+ * Creates an array of own enumerable property names and symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names and symbols.
+ */
+function getAllKeys(object) {
+ return baseGetAllKeys(object, keys, getSymbols);
+}
+
+export default getAllKeys;
diff --git a/_getAllKeysIn.js b/_getAllKeysIn.js
new file mode 100644
index 000000000..6fed31afa
--- /dev/null
+++ b/_getAllKeysIn.js
@@ -0,0 +1,17 @@
+import baseGetAllKeys from './_baseGetAllKeys';
+import getSymbolsIn from './_getSymbolsIn';
+import keysIn from './keysIn';
+
+/**
+ * Creates an array of own and inherited enumerable property names and
+ * symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of property names and symbols.
+ */
+function getAllKeysIn(object) {
+ return baseGetAllKeys(object, keysIn, getSymbolsIn);
+}
+
+export default getAllKeysIn;
diff --git a/_getLength.js b/_getLength.js
index 223a94577..db48bc193 100644
--- a/_getLength.js
+++ b/_getLength.js
@@ -3,8 +3,9 @@ import baseProperty from './_baseProperty';
/**
* Gets the "length" property value of `object`.
*
- * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
- * that affects Safari on at least iOS 8.1-8.3 ARM64.
+ * **Note:** This function is used to avoid a
+ * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
+ * Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
diff --git a/_getPrototype.js b/_getPrototype.js
new file mode 100644
index 000000000..445a0231f
--- /dev/null
+++ b/_getPrototype.js
@@ -0,0 +1,15 @@
+/* Built-in method references for those with the same name as other `lodash` methods. */
+var nativeGetPrototype = Object.getPrototypeOf;
+
+/**
+ * Gets the `[[Prototype]]` of `value`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {null|Object} Returns the `[[Prototype]]`.
+ */
+function getPrototype(value) {
+ return nativeGetPrototype(Object(value));
+}
+
+export default getPrototype;
diff --git a/_getSymbols.js b/_getSymbols.js
index 73bbca717..b83d3b9a1 100644
--- a/_getSymbols.js
+++ b/_getSymbols.js
@@ -2,14 +2,23 @@
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
/**
- * Creates an array of the own symbol properties of `object`.
+ * Creates an array of the own enumerable symbol properties of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
-var getSymbols = getOwnPropertySymbols || function() {
- return [];
-};
+function getSymbols(object) {
+ // Coerce `object` to an object to avoid non-object errors in V8.
+ // See https://bugs.chromium.org/p/v8/issues/detail?id=3443 for more details.
+ return getOwnPropertySymbols(Object(object));
+}
+
+// Fallback for IE < 11.
+if (!getOwnPropertySymbols) {
+ getSymbols = function() {
+ return [];
+ };
+}
export default getSymbols;
diff --git a/_getSymbolsIn.js b/_getSymbolsIn.js
new file mode 100644
index 000000000..509422009
--- /dev/null
+++ b/_getSymbolsIn.js
@@ -0,0 +1,25 @@
+import arrayPush from './_arrayPush';
+import getPrototype from './_getPrototype';
+import getSymbols from './_getSymbols';
+
+/** Built-in value references. */
+var getOwnPropertySymbols = Object.getOwnPropertySymbols;
+
+/**
+ * Creates an array of the own and inherited enumerable symbol properties
+ * of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of symbols.
+ */
+var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) {
+ var result = [];
+ while (object) {
+ arrayPush(result, getSymbols(object));
+ object = getPrototype(object);
+ }
+ return result;
+};
+
+export default getSymbolsIn;
diff --git a/_getTag.js b/_getTag.js
index c4c7e8bd0..9ddb3f85c 100644
--- a/_getTag.js
+++ b/_getTag.js
@@ -1,13 +1,18 @@
+import DataView from './_DataView';
import Map from './_Map';
+import Promise from './_Promise';
import Set from './_Set';
import WeakMap from './_WeakMap';
/** `Object#toString` result references. */
var mapTag = '[object Map]',
objectTag = '[object Object]',
+ promiseTag = '[object Promise]',
setTag = '[object Set]',
weakMapTag = '[object WeakMap]';
+var dataViewTag = '[object DataView]';
+
/** Used for built-in method references. */
var objectProto = Object.prototype;
@@ -21,7 +26,9 @@ var funcToString = Function.prototype.toString;
var objectToString = objectProto.toString;
/** Used to detect maps, sets, and weakmaps. */
-var mapCtorString = Map ? funcToString.call(Map) : '',
+var dataViewCtorString = DataView ? (DataView + '') : '',
+ mapCtorString = Map ? funcToString.call(Map) : '',
+ promiseCtorString = Promise ? funcToString.call(Promise) : '',
setCtorString = Set ? funcToString.call(Set) : '',
weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';
@@ -36,8 +43,11 @@ function getTag(value) {
return objectToString.call(value);
}
-// Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
-if ((Map && getTag(new Map) != mapTag) ||
+// Fallback for data views, maps, sets, and weak maps in IE 11,
+// for data views in Edge, and promises in Node.js.
+if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
+ (Map && getTag(new Map) != mapTag) ||
+ (Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
@@ -47,7 +57,9 @@ if ((Map && getTag(new Map) != mapTag) ||
if (ctorString) {
switch (ctorString) {
+ case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
+ case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
diff --git a/_hasPath.js b/_hasPath.js
index 66d8fa9f1..cdded4a9e 100644
--- a/_hasPath.js
+++ b/_hasPath.js
@@ -5,8 +5,6 @@ import isIndex from './_isIndex';
import isKey from './_isKey';
import isLength from './isLength';
import isString from './isString';
-import last from './last';
-import parent from './_parent';
/**
* Checks if `path` exists on `object`.
@@ -24,10 +22,16 @@ function hasPath(object, path, hasFunc) {
var result = hasFunc(object, path);
if (!result && !isKey(path)) {
path = baseCastPath(path);
- object = parent(object, path);
- if (object != null) {
- path = last(path);
- result = hasFunc(object, path);
+
+ var index = -1,
+ length = path.length;
+
+ while (object != null && ++index < length) {
+ var key = path[index];
+ if (!(result = hasFunc(object, key))) {
+ break;
+ }
+ object = object[key];
}
}
var length = object ? object.length : undefined;
diff --git a/_initCloneByTag.js b/_initCloneByTag.js
index 0d4ea096f..5f4e14a41 100644
--- a/_initCloneByTag.js
+++ b/_initCloneByTag.js
@@ -1,4 +1,5 @@
import cloneArrayBuffer from './_cloneArrayBuffer';
+import cloneDataView from './_cloneDataView';
import cloneMap from './_cloneMap';
import cloneRegExp from './_cloneRegExp';
import cloneSet from './_cloneSet';
@@ -16,6 +17,7 @@ var boolTag = '[object Boolean]',
symbolTag = '[object Symbol]';
var arrayBufferTag = '[object ArrayBuffer]',
+ dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
@@ -35,10 +37,11 @@ var arrayBufferTag = '[object ArrayBuffer]',
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
+ * @param {Function} cloneFunc The function to clone values.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
-function initCloneByTag(object, tag, isDeep) {
+function initCloneByTag(object, tag, cloneFunc, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
@@ -48,13 +51,16 @@ function initCloneByTag(object, tag, isDeep) {
case dateTag:
return new Ctor(+object);
+ case dataViewTag:
+ return cloneDataView(object, isDeep);
+
case float32Tag: case float64Tag:
case int8Tag: case int16Tag: case int32Tag:
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
return cloneTypedArray(object, isDeep);
case mapTag:
- return cloneMap(object);
+ return cloneMap(object, isDeep, cloneFunc);
case numberTag:
case stringTag:
@@ -64,7 +70,7 @@ function initCloneByTag(object, tag, isDeep) {
return cloneRegExp(object);
case setTag:
- return cloneSet(object);
+ return cloneSet(object, isDeep, cloneFunc);
case symbolTag:
return cloneSymbol(object);
diff --git a/_initCloneObject.js b/_initCloneObject.js
index 35a1cba07..de21f6966 100644
--- a/_initCloneObject.js
+++ b/_initCloneObject.js
@@ -1,9 +1,7 @@
import baseCreate from './_baseCreate';
+import getPrototype from './_getPrototype';
import isPrototype from './_isPrototype';
-/** Built-in value references. */
-var getPrototypeOf = Object.getPrototypeOf;
-
/**
* Initializes an object clone.
*
@@ -13,7 +11,7 @@ var getPrototypeOf = Object.getPrototypeOf;
*/
function initCloneObject(object) {
return (typeof object.constructor == 'function' && !isPrototype(object))
- ? baseCreate(getPrototypeOf(object))
+ ? baseCreate(getPrototype(object))
: {};
}
diff --git a/_isIterateeCall.js b/_isIterateeCall.js
index 23ff37d33..4eae5b2dd 100644
--- a/_isIterateeCall.js
+++ b/_isIterateeCall.js
@@ -10,7 +10,8 @@ import isObject from './isObject';
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
- * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
+ * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
+ * else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
@@ -18,8 +19,9 @@ function isIterateeCall(value, index, object) {
}
var type = typeof index;
if (type == 'number'
- ? (isArrayLike(object) && isIndex(index, object.length))
- : (type == 'string' && index in object)) {
+ ? (isArrayLike(object) && isIndex(index, object.length))
+ : (type == 'string' && index in object)
+ ) {
return eq(object[index], value);
}
return false;
diff --git a/_isKey.js b/_isKey.js
index 83db62cbf..664cb414f 100644
--- a/_isKey.js
+++ b/_isKey.js
@@ -1,4 +1,5 @@
import isArray from './isArray';
+import isSymbol from './isSymbol';
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
@@ -13,11 +14,12 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
- if (typeof value == 'number') {
+ var type = typeof value;
+ if (type == 'number' || type == 'symbol') {
return true;
}
return !isArray(value) &&
- (reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
+ (isSymbol(value) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object)));
}
diff --git a/_isLaziable.js b/_isLaziable.js
index d06ec2ddc..8ebec971b 100644
--- a/_isLaziable.js
+++ b/_isLaziable.js
@@ -8,7 +8,8 @@ import lodash from './wrapperLodash';
*
* @private
* @param {Function} func The function to check.
- * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
+ * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
+ * else `false`.
*/
function isLaziable(func) {
var funcName = getFuncName(func),
diff --git a/_mapSet.js b/_mapSet.js
index 382866226..daa61c820 100644
--- a/_mapSet.js
+++ b/_mapSet.js
@@ -11,7 +11,7 @@ import isKeyable from './_isKeyable';
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
- * @returns {Object} Returns the map cache object.
+ * @returns {Object} Returns the map cache instance.
*/
function mapSet(key, value) {
var data = this.__data__;
diff --git a/_mergeData.js b/_mergeData.js
index 224a80b00..6e230a4af 100644
--- a/_mergeData.js
+++ b/_mergeData.js
@@ -22,10 +22,11 @@ var nativeMin = Math.min;
*
* Merging metadata reduces the number of wrappers used to invoke a function.
* This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
- * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
- * modify function arguments, making the order in which they are executed important,
- * preventing the merging of metadata. However, we make an exception for a safe
- * combined case where curried functions have `_.ary` and or `_.rearg` applied.
+ * may be applied regardless of execution order. Methods like `_.ary` and
+ * `_.rearg` modify function arguments, making the order in which they are
+ * executed important, preventing the merging of metadata. However, we make
+ * an exception for a safe combined case where curried functions have `_.ary`
+ * and or `_.rearg` applied.
*
* @private
* @param {Array} data The destination metadata.
diff --git a/_mergeDefaults.js b/_mergeDefaults.js
index f8b8c2907..e469ca6ef 100644
--- a/_mergeDefaults.js
+++ b/_mergeDefaults.js
@@ -10,7 +10,8 @@ import isObject from './isObject';
* @param {string} key The key of the property to merge.
* @param {Object} object The parent object of `objValue`.
* @param {Object} source The parent object of `srcValue`.
- * @param {Object} [stack] Tracks traversed source values and their merged counterparts.
+ * @param {Object} [stack] Tracks traversed source values and their merged
+ * counterparts.
* @returns {*} Returns the value to assign.
*/
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
diff --git a/_parent.js b/_parent.js
index a799302a3..2f20c1442 100644
--- a/_parent.js
+++ b/_parent.js
@@ -1,5 +1,5 @@
+import baseGet from './_baseGet';
import baseSlice from './_baseSlice';
-import get from './get';
/**
* Gets the parent value at `path` of `object`.
@@ -10,7 +10,7 @@ import get from './get';
* @returns {*} Returns the parent value.
*/
function parent(object, path) {
- return path.length == 1 ? object : get(object, baseSlice(path, 0, -1));
+ return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
}
export default parent;
diff --git a/_setData.js b/_setData.js
index ed20702c3..bf761f2b4 100644
--- a/_setData.js
+++ b/_setData.js
@@ -9,8 +9,9 @@ var HOT_COUNT = 150,
* Sets metadata for `func`.
*
* **Note:** If this function becomes hot, i.e. is invoked a lot in a short
- * period of time, it will trip its breaker and transition to an identity function
- * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)
+ * period of time, it will trip its breaker and transition to an identity
+ * function to avoid garbage collection pauses in V8. See
+ * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
* for more details.
*
* @private
diff --git a/_stackSet.js b/_stackSet.js
index 41ec3d395..1bd39239d 100644
--- a/_stackSet.js
+++ b/_stackSet.js
@@ -12,7 +12,7 @@ var LARGE_ARRAY_SIZE = 200;
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
- * @returns {Object} Returns the stack cache object.
+ * @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__,
diff --git a/_stringToPath.js b/_stringToPath.js
index b1b0f84bb..a7d746f64 100644
--- a/_stringToPath.js
+++ b/_stringToPath.js
@@ -1,3 +1,4 @@
+import memoize from './memoize';
import toString from './toString';
/** Used to match property names within property paths. */
@@ -13,12 +14,12 @@ var reEscapeChar = /\\(\\)?/g;
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
-function stringToPath(string) {
+var stringToPath = memoize(function(string) {
var result = [];
toString(string).replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
-}
+});
export default stringToPath;
diff --git a/add.js b/add.js
index efa6e37e0..d37311069 100644
--- a/add.js
+++ b/add.js
@@ -1,8 +1,11 @@
+import createMathOperation from './_createMathOperation';
+
/**
* Adds two numbers.
*
* @static
* @memberOf _
+ * @since 3.4.0
* @category Math
* @param {number} augend The first number in an addition.
* @param {number} addend The second number in an addition.
@@ -12,18 +15,8 @@
* _.add(6, 4);
* // => 10
*/
-function add(augend, addend) {
- var result;
- if (augend === undefined && addend === undefined) {
- return 0;
- }
- if (augend !== undefined) {
- result = augend;
- }
- if (addend !== undefined) {
- result = result === undefined ? addend : (result + addend);
- }
- return result;
-}
+var add = createMathOperation(function(augend, addend) {
+ return augend + addend;
+});
export default add;
diff --git a/after.js b/after.js
index 4878c7b6f..78cce6418 100644
--- a/after.js
+++ b/after.js
@@ -9,6 +9,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {number} n The number of calls before `func` is invoked.
* @param {Function} func The function to restrict.
@@ -24,7 +25,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* _.forEach(saves, function(type) {
* asyncSave({ 'type': type, 'complete': done });
* });
- * // => logs 'done saving!' after the two async saves have completed
+ * // => Logs 'done saving!' after the two async saves have completed.
*/
function after(n, func) {
if (typeof func != 'function') {
diff --git a/ary.js b/ary.js
index bd2a68e49..8e3d3d751 100644
--- a/ary.js
+++ b/ary.js
@@ -9,10 +9,11 @@ var ARY_FLAG = 128;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Function
* @param {Function} func The function to cap arguments for.
* @param {number} [n=func.length] The arity cap.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the new function.
* @example
*
diff --git a/assign.js b/assign.js
index d56948675..add611ba9 100644
--- a/assign.js
+++ b/assign.js
@@ -18,15 +18,16 @@ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
/**
- * Assigns own enumerable properties of source objects to the destination
- * object. Source objects are applied from left to right. Subsequent sources
- * overwrite property assignments of previous sources.
+ * Assigns own enumerable string keyed properties of source objects to the
+ * destination object. Source objects are applied from left to right.
+ * Subsequent sources overwrite property assignments of previous sources.
*
* **Note:** This method mutates `object` and is loosely based on
* [`Object.assign`](https://mdn.io/Object/assign).
*
* @static
* @memberOf _
+ * @since 0.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
diff --git a/assignIn.js b/assignIn.js
index 49824959b..17cde3335 100644
--- a/assignIn.js
+++ b/assignIn.js
@@ -22,6 +22,7 @@ var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
*
* @static
* @memberOf _
+ * @since 4.0.0
* @alias extend
* @category Object
* @param {Object} object The destination object.
diff --git a/assignInWith.js b/assignInWith.js
index 4b713ae76..5c702bfac 100644
--- a/assignInWith.js
+++ b/assignInWith.js
@@ -3,15 +3,16 @@ import createAssigner from './_createAssigner';
import keysIn from './keysIn';
/**
- * This method is like `_.assignIn` except that it accepts `customizer` which
- * is invoked to produce the assigned values. If `customizer` returns `undefined`
- * assignment is handled by the method instead. The `customizer` is invoked
- * with five arguments: (objValue, srcValue, key, object, source).
+ * This method is like `_.assignIn` except that it accepts `customizer`
+ * which is invoked to produce the assigned values. If `customizer` returns
+ * `undefined` assignment is handled by the method instead. The `customizer`
+ * is invoked with five arguments: (objValue, srcValue, key, object, source).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @alias extendWith
* @category Object
* @param {Object} object The destination object.
diff --git a/assignWith.js b/assignWith.js
index 6e9d36bef..8aedc7e88 100644
--- a/assignWith.js
+++ b/assignWith.js
@@ -3,15 +3,16 @@ import createAssigner from './_createAssigner';
import keys from './keys';
/**
- * This method is like `_.assign` except that it accepts `customizer` which
- * is invoked to produce the assigned values. If `customizer` returns `undefined`
- * assignment is handled by the method instead. The `customizer` is invoked
- * with five arguments: (objValue, srcValue, key, object, source).
+ * This method is like `_.assign` except that it accepts `customizer`
+ * which is invoked to produce the assigned values. If `customizer` returns
+ * `undefined` assignment is handled by the method instead. The `customizer`
+ * is invoked with five arguments: (objValue, srcValue, key, object, source).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
diff --git a/at.js b/at.js
index 988207df3..74b5eeb9e 100644
--- a/at.js
+++ b/at.js
@@ -7,6 +7,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 1.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {...(string|string[])} [paths] The property paths of elements to pick,
diff --git a/attempt.js b/attempt.js
index 70a4ecd26..345fa2a62 100644
--- a/attempt.js
+++ b/attempt.js
@@ -8,8 +8,10 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Util
* @param {Function} func The function to attempt.
+ * @param {...*} [args] The arguments to invoke `func` with.
* @returns {*} Returns the `func` result or error object.
* @example
*
diff --git a/before.js b/before.js
index 39ace0f53..d745c8772 100644
--- a/before.js
+++ b/before.js
@@ -10,6 +10,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Function
* @param {number} n The number of calls at which `func` is no longer invoked.
* @param {Function} func The function to restrict.
diff --git a/bind.js b/bind.js
index 2cc4fc5c2..cdf551d93 100644
--- a/bind.js
+++ b/bind.js
@@ -20,6 +20,7 @@ var BIND_FLAG = 1,
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to bind.
* @param {*} thisArg The `this` binding of `func`.
diff --git a/bindAll.js b/bindAll.js
index 0d189d90d..31478b7e9 100644
--- a/bindAll.js
+++ b/bindAll.js
@@ -10,6 +10,7 @@ import rest from './rest';
* **Note:** This method doesn't set the "length" property of bound functions.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {Object} object The object to bind and assign the bound methods to.
@@ -27,7 +28,7 @@ import rest from './rest';
*
* _.bindAll(view, 'onClick');
* jQuery(element).on('click', view.onClick);
- * // => logs 'clicked docs' when clicked
+ * // => Logs 'clicked docs' when clicked.
*/
var bindAll = rest(function(object, methodNames) {
arrayEach(baseFlatten(methodNames, 1), function(key) {
diff --git a/bindKey.js b/bindKey.js
index 882b86b6f..e5ebe44eb 100644
--- a/bindKey.js
+++ b/bindKey.js
@@ -13,8 +13,8 @@ var BIND_FLAG = 1,
* any additional `_.bindKey` arguments to those provided to the bound function.
*
* This method differs from `_.bind` by allowing bound functions to reference
- * methods that may be redefined or don't yet exist.
- * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
+ * methods that may be redefined or don't yet exist. See
+ * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
* for more details.
*
* The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
@@ -22,6 +22,7 @@ var BIND_FLAG = 1,
*
* @static
* @memberOf _
+ * @since 0.10.0
* @category Function
* @param {Object} object The object to invoke the method on.
* @param {string} key The key of the method.
diff --git a/camelCase.js b/camelCase.js
index f941d428c..84f106bcd 100644
--- a/camelCase.js
+++ b/camelCase.js
@@ -6,6 +6,7 @@ import createCompounder from './_createCompounder';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the camel cased string.
@@ -14,10 +15,10 @@ import createCompounder from './_createCompounder';
* _.camelCase('Foo Bar');
* // => 'fooBar'
*
- * _.camelCase('--foo-bar');
+ * _.camelCase('--foo-bar--');
* // => 'fooBar'
*
- * _.camelCase('__foo_bar__');
+ * _.camelCase('__FOO_BAR__');
* // => 'fooBar'
*/
var camelCase = createCompounder(function(result, word, index) {
diff --git a/capitalize.js b/capitalize.js
index 828dcc6da..56ed4a133 100644
--- a/capitalize.js
+++ b/capitalize.js
@@ -7,6 +7,7 @@ import upperFirst from './upperFirst';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to capitalize.
* @returns {string} Returns the capitalized string.
diff --git a/castArray.js b/castArray.js
index 68e47079f..7513ec88d 100644
--- a/castArray.js
+++ b/castArray.js
@@ -5,6 +5,7 @@ import isArray from './isArray';
*
* @static
* @memberOf _
+ * @since 4.4.0
* @category Lang
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast array.
diff --git a/ceil.js b/ceil.js
index e12c031df..e909ae0e7 100644
--- a/ceil.js
+++ b/ceil.js
@@ -5,6 +5,7 @@ import createRound from './_createRound';
*
* @static
* @memberOf _
+ * @since 3.10.0
* @category Math
* @param {number} number The number to round up.
* @param {number} [precision=0] The precision to round up to.
diff --git a/chain.js b/chain.js
index 7d4ae2de6..088f0f621 100644
--- a/chain.js
+++ b/chain.js
@@ -1,11 +1,13 @@
import lodash from './wrapperLodash';
/**
- * Creates a `lodash` object that wraps `value` with explicit method chaining enabled.
- * The result of such method chaining must be unwrapped with `_#value`.
+ * Creates a `lodash` wrapper instance that wraps `value` with explicit method
+ * chain sequences enabled. The result of such sequences must be unwrapped
+ * with `_#value`.
*
* @static
* @memberOf _
+ * @since 1.3.0
* @category Seq
* @param {*} value The value to wrap.
* @returns {Object} Returns the new `lodash` wrapper instance.
diff --git a/chunk.js b/chunk.js
index 11328e24f..bf202884f 100644
--- a/chunk.js
+++ b/chunk.js
@@ -12,6 +12,7 @@ var nativeCeil = Math.ceil,
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to process.
* @param {number} [size=0] The length of each chunk.
diff --git a/clamp.js b/clamp.js
index 8e079db30..31a315752 100644
--- a/clamp.js
+++ b/clamp.js
@@ -6,6 +6,7 @@ import toNumber from './toNumber';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Number
* @param {number} number The number to clamp.
* @param {number} [lower] The lower bound.
diff --git a/clone.js b/clone.js
index e59661ace..09a11bea7 100644
--- a/clone.js
+++ b/clone.js
@@ -13,6 +13,7 @@ import baseClone from './_baseClone';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to clone.
* @returns {*} Returns the cloned value.
diff --git a/cloneDeep.js b/cloneDeep.js
index bd289e5bb..10ac71aa4 100644
--- a/cloneDeep.js
+++ b/cloneDeep.js
@@ -5,6 +5,7 @@ import baseClone from './_baseClone';
*
* @static
* @memberOf _
+ * @since 1.0.0
* @category Lang
* @param {*} value The value to recursively clone.
* @returns {*} Returns the deep cloned value.
diff --git a/cloneDeepWith.js b/cloneDeepWith.js
index 4c7e84bcf..3006df615 100644
--- a/cloneDeepWith.js
+++ b/cloneDeepWith.js
@@ -5,6 +5,7 @@ import baseClone from './_baseClone';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to recursively clone.
* @param {Function} [customizer] The function to customize cloning.
diff --git a/cloneWith.js b/cloneWith.js
index e269e282e..d82f22272 100644
--- a/cloneWith.js
+++ b/cloneWith.js
@@ -8,6 +8,7 @@ import baseClone from './_baseClone';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to clone.
* @param {Function} [customizer] The function to customize cloning.
diff --git a/collection.default.js b/collection.default.js
index 0165b0367..69e67acd6 100644
--- a/collection.default.js
+++ b/collection.default.js
@@ -7,6 +7,8 @@ import filter from './filter';
import find from './find';
import findLast from './findLast';
import flatMap from './flatMap';
+import flatMapDeep from './flatMapDeep';
+import flatMapDepth from './flatMapDepth';
import forEach from './forEach';
import forEachRight from './forEachRight';
import groupBy from './groupBy';
@@ -28,9 +30,9 @@ import sortBy from './sortBy';
export default {
at, countBy, each, eachRight, every,
- filter, find, findLast, flatMap, forEach,
- forEachRight, groupBy, includes, invokeMap, keyBy,
- map, orderBy, partition, reduce, reduceRight,
- reject, sample, sampleSize, shuffle, size,
- some, sortBy
+ filter, find, findLast, flatMap, flatMapDeep,
+ flatMapDepth, forEach, forEachRight, groupBy, includes,
+ invokeMap, keyBy, map, orderBy, partition,
+ reduce, reduceRight, reject, sample, sampleSize,
+ shuffle, size, some, sortBy
};
diff --git a/collection.js b/collection.js
index 6ab3ff609..728ad335f 100644
--- a/collection.js
+++ b/collection.js
@@ -7,6 +7,8 @@ export { default as filter } from './filter';
export { default as find } from './find';
export { default as findLast } from './findLast';
export { default as flatMap } from './flatMap';
+export { default as flatMapDeep } from './flatMapDeep';
+export { default as flatMapDepth } from './flatMapDepth';
export { default as forEach } from './forEach';
export { default as forEachRight } from './forEachRight';
export { default as groupBy } from './groupBy';
diff --git a/commit.js b/commit.js
index 2bda55645..11b526a64 100644
--- a/commit.js
+++ b/commit.js
@@ -1,10 +1,11 @@
import LodashWrapper from './_LodashWrapper';
/**
- * Executes the chained sequence and returns the wrapped result.
+ * Executes the chain sequence and returns the wrapped result.
*
* @name commit
* @memberOf _
+ * @since 3.2.0
* @category Seq
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
diff --git a/compact.js b/compact.js
index 8abb94333..24e98d2b6 100644
--- a/compact.js
+++ b/compact.js
@@ -4,6 +4,7 @@
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to compact.
* @returns {Array} Returns the new array of filtered values.
diff --git a/concat.js b/concat.js
index aabe137f9..39e438959 100644
--- a/concat.js
+++ b/concat.js
@@ -1,7 +1,7 @@
import arrayConcat from './_arrayConcat';
import baseFlatten from './_baseFlatten';
-import isArray from './isArray';
-import rest from './rest';
+import castArray from './castArray';
+import copyArray from './_copyArray';
/**
* Creates a new array concatenating `array` with any additional arrays
@@ -9,6 +9,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to concatenate.
* @param {...*} [values] The values to concatenate.
@@ -24,12 +25,18 @@ import rest from './rest';
* console.log(array);
* // => [1]
*/
-var concat = rest(function(array, values) {
- if (!isArray(array)) {
- array = array == null ? [] : [Object(array)];
+function concat() {
+ var length = arguments.length,
+ array = castArray(arguments[0]);
+
+ if (length < 2) {
+ return length ? copyArray(array) : [];
}
- values = baseFlatten(values, 1);
- return arrayConcat(array, values);
-});
+ var args = Array(length - 1);
+ while (length--) {
+ args[length - 1] = arguments[length];
+ }
+ return arrayConcat(array, baseFlatten(args, 1));
+}
export default concat;
diff --git a/cond.js b/cond.js
index 1451970f0..5c560ab44 100644
--- a/cond.js
+++ b/cond.js
@@ -14,6 +14,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {Array} pairs The predicate-function pairs.
* @returns {Function} Returns the new function.
@@ -35,13 +36,14 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* // => 'no match'
*/
function cond(pairs) {
- var length = pairs ? pairs.length : 0;
+ var length = pairs ? pairs.length : 0,
+ toIteratee = baseIteratee;
pairs = !length ? [] : arrayMap(pairs, function(pair) {
if (typeof pair[1] != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
- return [baseIteratee(pair[0]), pair[1]];
+ return [toIteratee(pair[0]), pair[1]];
});
return rest(function(args) {
diff --git a/conforms.js b/conforms.js
index 219b30e92..fd8f0d9fc 100644
--- a/conforms.js
+++ b/conforms.js
@@ -8,6 +8,7 @@ import baseConforms from './_baseConforms';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {Object} source The object of property predicates to conform to.
* @returns {Function} Returns the new function.
diff --git a/constant.js b/constant.js
index 6392cde9f..209e213c0 100644
--- a/constant.js
+++ b/constant.js
@@ -3,6 +3,7 @@
*
* @static
* @memberOf _
+ * @since 2.4.0
* @category Util
* @param {*} value The value to return from the new function.
* @returns {Function} Returns the new function.
diff --git a/countBy.js b/countBy.js
index 4832d00bd..67056d805 100644
--- a/countBy.js
+++ b/countBy.js
@@ -14,9 +14,11 @@ var hasOwnProperty = objectProto.hasOwnProperty;
*
* @static
* @memberOf _
+ * @since 0.5.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
diff --git a/create.js b/create.js
index 77f0530b0..7392e53bf 100644
--- a/create.js
+++ b/create.js
@@ -2,11 +2,13 @@ import baseAssign from './_baseAssign';
import baseCreate from './_baseCreate';
/**
- * Creates an object that inherits from the `prototype` object. If a `properties`
- * object is given its own enumerable properties are assigned to the created object.
+ * Creates an object that inherits from the `prototype` object. If a
+ * `properties` object is given its own enumerable string keyed properties
+ * are assigned to the created object.
*
* @static
* @memberOf _
+ * @since 2.3.0
* @category Object
* @param {Object} prototype The object to inherit from.
* @param {Object} [properties] The properties to assign to the object.
diff --git a/curry.js b/curry.js
index ce0137167..e2c85e0d7 100644
--- a/curry.js
+++ b/curry.js
@@ -17,10 +17,11 @@ var CURRY_FLAG = 8;
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Function
* @param {Function} func The function to curry.
* @param {number} [arity=func.length] The arity of `func`.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the new curried function.
* @example
*
diff --git a/curryRight.js b/curryRight.js
index 350b84a26..9f7bfb3d5 100644
--- a/curryRight.js
+++ b/curryRight.js
@@ -14,10 +14,11 @@ var CURRY_RIGHT_FLAG = 16;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Function
* @param {Function} func The function to curry.
* @param {number} [arity=func.length] The arity of `func`.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the new curried function.
* @example
*
diff --git a/debounce.js b/debounce.js
index c7852128a..77ee2abd2 100644
--- a/debounce.js
+++ b/debounce.js
@@ -6,7 +6,8 @@ import toNumber from './toNumber';
var FUNC_ERROR_TEXT = 'Expected a function';
/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeMax = Math.max;
+var nativeMax = Math.max,
+ nativeMin = Math.min;
/**
* Creates a debounced function that delays invoking `func` until after `wait`
@@ -27,16 +28,17 @@ var nativeMax = Math.max;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to debounce.
* @param {number} [wait=0] The number of milliseconds to delay.
- * @param {Object} [options] The options object.
- * @param {boolean} [options.leading=false] Specify invoking on the leading
- * edge of the timeout.
- * @param {number} [options.maxWait] The maximum time `func` is allowed to be
- * delayed before it's invoked.
- * @param {boolean} [options.trailing=true] Specify invoking on the trailing
- * edge of the timeout.
+ * @param {Object} [options={}] The options object.
+ * @param {boolean} [options.leading=false]
+ * Specify invoking on the leading edge of the timeout.
+ * @param {number} [options.maxWait]
+ * The maximum time `func` is allowed to be delayed before it's invoked.
+ * @param {boolean} [options.trailing=true]
+ * Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new debounced function.
* @example
*
@@ -58,14 +60,12 @@ var nativeMax = Math.max;
* jQuery(window).on('popstate', debounced.cancel);
*/
function debounce(func, wait, options) {
- var args,
- maxTimeoutId,
+ var lastArgs,
+ lastThis,
result,
- stamp,
- thisArg,
- timeoutId,
- trailingCall,
- lastCalled = 0,
+ timerId,
+ lastCallTime = 0,
+ lastInvokeTime = 0,
leading = false,
maxWait = false,
trailing = true;
@@ -80,92 +80,94 @@ function debounce(func, wait, options) {
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
- function cancel() {
- if (timeoutId) {
- clearTimeout(timeoutId);
- }
- if (maxTimeoutId) {
- clearTimeout(maxTimeoutId);
- }
- lastCalled = 0;
- args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;
- }
+ function invokeFunc(time) {
+ var args = lastArgs,
+ thisArg = lastThis;
- function complete(isCalled, id) {
- if (id) {
- clearTimeout(id);
- }
- maxTimeoutId = timeoutId = trailingCall = undefined;
- if (isCalled) {
- lastCalled = now();
- result = func.apply(thisArg, args);
- if (!timeoutId && !maxTimeoutId) {
- args = thisArg = undefined;
- }
- }
- }
-
- function delayed() {
- var remaining = wait - (now() - stamp);
- if (remaining <= 0 || remaining > wait) {
- complete(trailingCall, maxTimeoutId);
- } else {
- timeoutId = setTimeout(delayed, remaining);
- }
- }
-
- function flush() {
- if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {
- result = func.apply(thisArg, args);
- }
- cancel();
+ lastArgs = lastThis = undefined;
+ lastInvokeTime = time;
+ result = func.apply(thisArg, args);
return result;
}
- function maxDelayed() {
- complete(trailing, timeoutId);
+ function leadingEdge(time) {
+ // Reset any `maxWait` timer.
+ lastInvokeTime = time;
+ // Start the timer for the trailing edge.
+ timerId = setTimeout(timerExpired, wait);
+ // Invoke the leading edge.
+ return leading ? invokeFunc(time) : result;
+ }
+
+ function remainingWait(time) {
+ var timeSinceLastCall = time - lastCallTime,
+ timeSinceLastInvoke = time - lastInvokeTime,
+ result = wait - timeSinceLastCall;
+
+ return maxWait === false ? result : nativeMin(result, maxWait - timeSinceLastInvoke);
+ }
+
+ function shouldInvoke(time) {
+ var timeSinceLastCall = time - lastCallTime,
+ timeSinceLastInvoke = time - lastInvokeTime;
+
+ // Either this is the first call, activity has stopped and we're at the
+ // trailing edge, the system time has gone backwards and we're treating
+ // it as the trailing edge, or we've hit the `maxWait` limit.
+ return (!lastCallTime || (timeSinceLastCall >= wait) ||
+ (timeSinceLastCall < 0) || (maxWait !== false && timeSinceLastInvoke >= maxWait));
+ }
+
+ function timerExpired() {
+ var time = now();
+ if (shouldInvoke(time)) {
+ return trailingEdge(time);
+ }
+ // Restart the timer.
+ timerId = setTimeout(timerExpired, remainingWait(time));
+ }
+
+ function trailingEdge(time) {
+ clearTimeout(timerId);
+ timerId = undefined;
+
+ // Only invoke if we have `lastArgs` which means `func` has been
+ // debounced at least once.
+ if (trailing && lastArgs) {
+ return invokeFunc(time);
+ }
+ lastArgs = lastThis = undefined;
+ return result;
+ }
+
+ function cancel() {
+ if (timerId !== undefined) {
+ clearTimeout(timerId);
+ }
+ lastCallTime = lastInvokeTime = 0;
+ lastArgs = lastThis = timerId = undefined;
+ }
+
+ function flush() {
+ return timerId === undefined ? result : trailingEdge(now());
}
function debounced() {
- args = arguments;
- stamp = now();
- thisArg = this;
- trailingCall = trailing && (timeoutId || !leading);
+ var time = now(),
+ isInvoking = shouldInvoke(time);
- if (maxWait === false) {
- var leadingCall = leading && !timeoutId;
- } else {
- if (!lastCalled && !maxTimeoutId && !leading) {
- lastCalled = stamp;
- }
- var remaining = maxWait - (stamp - lastCalled);
+ lastArgs = arguments;
+ lastThis = this;
+ lastCallTime = time;
- var isCalled = (remaining <= 0 || remaining > maxWait) &&
- (leading || maxTimeoutId);
-
- if (isCalled) {
- if (maxTimeoutId) {
- maxTimeoutId = clearTimeout(maxTimeoutId);
- }
- lastCalled = stamp;
- result = func.apply(thisArg, args);
+ if (isInvoking) {
+ if (timerId === undefined) {
+ return leadingEdge(lastCallTime);
}
- else if (!maxTimeoutId) {
- maxTimeoutId = setTimeout(maxDelayed, remaining);
- }
- }
- if (isCalled && timeoutId) {
- timeoutId = clearTimeout(timeoutId);
- }
- else if (!timeoutId && wait !== maxWait) {
- timeoutId = setTimeout(delayed, wait);
- }
- if (leadingCall) {
- isCalled = true;
- result = func.apply(thisArg, args);
- }
- if (isCalled && !timeoutId && !maxTimeoutId) {
- args = thisArg = undefined;
+ // Handle invocations in a tight loop.
+ clearTimeout(timerId);
+ timerId = setTimeout(timerExpired, wait);
+ return invokeFunc(lastCallTime);
}
return result;
}
diff --git a/deburr.js b/deburr.js
index 97b2e636f..03085a50e 100644
--- a/deburr.js
+++ b/deburr.js
@@ -18,11 +18,14 @@ var rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']';
var reComboMark = RegExp(rsCombo, 'g');
/**
- * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
- * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
+ * Deburrs `string` by converting
+ * [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
+ * to basic latin letters and removing
+ * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to deburr.
* @returns {string} Returns the deburred string.
diff --git a/defaults.js b/defaults.js
index 26f822284..24872320e 100644
--- a/defaults.js
+++ b/defaults.js
@@ -4,14 +4,15 @@ import assignInWith from './assignInWith';
import rest from './rest';
/**
- * Assigns own and inherited enumerable properties of source objects to the
- * destination object for all destination properties that resolve to `undefined`.
- * Source objects are applied from left to right. Once a property is set,
- * additional values of the same property are ignored.
+ * Assigns own and inherited enumerable string keyed properties of source
+ * objects to the destination object for all destination properties that
+ * resolve to `undefined`. Source objects are applied from left to right.
+ * Once a property is set, additional values of the same property are ignored.
*
* **Note:** This method mutates `object`.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The destination object.
diff --git a/defaultsDeep.js b/defaultsDeep.js
index d6e409d04..5d932c4df 100644
--- a/defaultsDeep.js
+++ b/defaultsDeep.js
@@ -11,6 +11,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 3.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
diff --git a/defer.js b/defer.js
index b0f6caffa..b0691f6c2 100644
--- a/defer.js
+++ b/defer.js
@@ -7,6 +7,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to defer.
* @param {...*} [args] The arguments to invoke `func` with.
@@ -16,7 +17,7 @@ import rest from './rest';
* _.defer(function(text) {
* console.log(text);
* }, 'deferred');
- * // => logs 'deferred' after one or more milliseconds
+ * // => Logs 'deferred' after one or more milliseconds.
*/
var defer = rest(function(func, args) {
return baseDelay(func, 1, args);
diff --git a/delay.js b/delay.js
index ad1378f88..fa5729f72 100644
--- a/delay.js
+++ b/delay.js
@@ -8,6 +8,7 @@ import toNumber from './toNumber';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
@@ -18,7 +19,7 @@ import toNumber from './toNumber';
* _.delay(function(text) {
* console.log(text);
* }, 1000, 'later');
- * // => logs 'later' after one second
+ * // => Logs 'later' after one second.
*/
var delay = rest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
diff --git a/difference.js b/difference.js
index 27d9ef8f6..fe9bc80ac 100644
--- a/difference.js
+++ b/difference.js
@@ -4,13 +4,14 @@ import isArrayLikeObject from './isArrayLikeObject';
import rest from './rest';
/**
- * Creates an array of unique `array` values not included in the other
- * given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * Creates an array of unique `array` values not included in the other given
+ * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons. The order of result values is determined by the
* order they occur in the first array.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
diff --git a/differenceBy.js b/differenceBy.js
index 844a14faf..2e09ccdd2 100644
--- a/differenceBy.js
+++ b/differenceBy.js
@@ -13,10 +13,12 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
*
diff --git a/differenceWith.js b/differenceWith.js
index 5ef96657e..2f8336a9a 100644
--- a/differenceWith.js
+++ b/differenceWith.js
@@ -12,6 +12,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
diff --git a/divide.js b/divide.js
new file mode 100644
index 000000000..22b3ef1f4
--- /dev/null
+++ b/divide.js
@@ -0,0 +1,22 @@
+import createMathOperation from './_createMathOperation';
+
+/**
+ * Divide two numbers.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Math
+ * @param {number} dividend The first number in a division.
+ * @param {number} divisor The second number in a division.
+ * @returns {number} Returns the quotient.
+ * @example
+ *
+ * _.divide(6, 4);
+ * // => 1.5
+ */
+var divide = createMathOperation(function(dividend, divisor) {
+ return dividend / divisor;
+});
+
+export default divide;
diff --git a/drop.js b/drop.js
index ebe48bfe2..62e6a10c7 100644
--- a/drop.js
+++ b/drop.js
@@ -6,10 +6,11 @@ import toInteger from './toInteger';
*
* @static
* @memberOf _
+ * @since 0.5.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/dropRight.js b/dropRight.js
index 2081eb140..7e865fc0c 100644
--- a/dropRight.js
+++ b/dropRight.js
@@ -6,10 +6,11 @@ import toInteger from './toInteger';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/dropRightWhile.js b/dropRightWhile.js
index b870ba003..0ac98bb40 100644
--- a/dropRightWhile.js
+++ b/dropRightWhile.js
@@ -8,9 +8,11 @@ import baseWhile from './_baseWhile';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/dropWhile.js b/dropWhile.js
index 850932af4..3d1726578 100644
--- a/dropWhile.js
+++ b/dropWhile.js
@@ -8,9 +8,11 @@ import baseWhile from './_baseWhile';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/endsWith.js b/endsWith.js
index 7230b1540..726c102f5 100644
--- a/endsWith.js
+++ b/endsWith.js
@@ -7,11 +7,13 @@ import toString from './toString';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to search.
* @param {string} [target] The string to search for.
* @param {number} [position=string.length] The position to search from.
- * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`.
+ * @returns {boolean} Returns `true` if `string` ends with `target`,
+ * else `false`.
* @example
*
* _.endsWith('abc', 'c');
diff --git a/entries.js b/entries.js
new file mode 100644
index 000000000..8d8f2a3e1
--- /dev/null
+++ b/entries.js
@@ -0,0 +1 @@
+export { default } from './toPairs'
diff --git a/entriesIn.js b/entriesIn.js
new file mode 100644
index 000000000..310756c95
--- /dev/null
+++ b/entriesIn.js
@@ -0,0 +1 @@
+export { default } from './toPairsIn'
diff --git a/eq.js b/eq.js
index f3cb7ea4a..c0c9d1099 100644
--- a/eq.js
+++ b/eq.js
@@ -1,9 +1,11 @@
/**
- * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * Performs a
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
diff --git a/escape.js b/escape.js
index 463ab2d1d..acf57ced9 100644
--- a/escape.js
+++ b/escape.js
@@ -14,20 +14,22 @@ var reUnescapedHtml = /[&<>"'`]/g,
*
* Though the ">" character is escaped for symmetry, characters like
* ">" and "/" don't need escaping in HTML and have no special meaning
- * unless they're part of a tag or unquoted attribute value.
- * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
+ * unless they're part of a tag or unquoted attribute value. See
+ * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
* (under "semi-related fun fact") for more details.
*
* Backticks are escaped because in IE < 9, they can break out of
* attribute values or HTML comments. See [#59](https://html5sec.org/#59),
* [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
- * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)
- * for more details.
+ * [#133](https://html5sec.org/#133) of the
+ * [HTML5 Security Cheatsheet](https://html5sec.org/) for more details.
*
- * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)
- * to reduce XSS vectors.
+ * When working with HTML you should always
+ * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
+ * XSS vectors.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category String
* @param {string} [string=''] The string to escape.
diff --git a/escapeRegExp.js b/escapeRegExp.js
index 47fec43f6..fb3941db2 100644
--- a/escapeRegExp.js
+++ b/escapeRegExp.js
@@ -10,6 +10,7 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to escape.
* @returns {string} Returns the escaped string.
diff --git a/every.js b/every.js
index 75e575167..065cee657 100644
--- a/every.js
+++ b/every.js
@@ -11,19 +11,22 @@ import isIterateeCall from './_isIterateeCall';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
- * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {boolean} Returns `true` if all elements pass the predicate check,
+ * else `false`.
* @example
*
* _.every([true, 1, null, 'yes'], Boolean);
* // => false
*
* var users = [
- * { 'user': 'barney', 'active': false },
- * { 'user': 'fred', 'active': false }
+ * { 'user': 'barney', 'age': 36, 'active': false },
+ * { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* // The `_.matches` iteratee shorthand.
diff --git a/fill.js b/fill.js
index 479dfce69..c0b265032 100644
--- a/fill.js
+++ b/fill.js
@@ -9,6 +9,7 @@ import isIterateeCall from './_isIterateeCall';
*
* @static
* @memberOf _
+ * @since 3.2.0
* @category Array
* @param {Array} array The array to fill.
* @param {*} value The value to fill `array` with.
diff --git a/filter.js b/filter.js
index 61f87e9ec..037c99fda 100644
--- a/filter.js
+++ b/filter.js
@@ -5,14 +5,16 @@ import isArray from './isArray';
/**
* Iterates over elements of `collection`, returning an array of all elements
- * `predicate` returns truthy for. The predicate is invoked with three arguments:
- * (value, index|key, collection).
+ * `predicate` returns truthy for. The predicate is invoked with three
+ * arguments: (value, index|key, collection).
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @example
*
diff --git a/find.js b/find.js
index 210970c9a..2b8832754 100644
--- a/find.js
+++ b/find.js
@@ -6,14 +6,16 @@ import isArray from './isArray';
/**
* Iterates over elements of `collection`, returning the first element
- * `predicate` returns truthy for. The predicate is invoked with three arguments:
- * (value, index|key, collection).
+ * `predicate` returns truthy for. The predicate is invoked with three
+ * arguments: (value, index|key, collection).
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
diff --git a/findIndex.js b/findIndex.js
index ee6363708..4cb5f7ff6 100644
--- a/findIndex.js
+++ b/findIndex.js
@@ -7,9 +7,11 @@ import baseIteratee from './_baseIteratee';
*
* @static
* @memberOf _
+ * @since 1.1.0
* @category Array
* @param {Array} array The array to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
diff --git a/findKey.js b/findKey.js
index ddd6bfa89..4a1fe1e1e 100644
--- a/findKey.js
+++ b/findKey.js
@@ -8,10 +8,13 @@ import baseIteratee from './_baseIteratee';
*
* @static
* @memberOf _
+ * @since 1.1.0
* @category Object
* @param {Object} object The object to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
- * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
+ * @returns {string|undefined} Returns the key of the matched element,
+ * else `undefined`.
* @example
*
* var users = {
diff --git a/findLast.js b/findLast.js
index 11017f6ed..d73a3184b 100644
--- a/findLast.js
+++ b/findLast.js
@@ -10,9 +10,11 @@ import isArray from './isArray';
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Collection
* @param {Array|Object} collection The collection to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
diff --git a/findLastIndex.js b/findLastIndex.js
index 4d1a5138b..929fbb146 100644
--- a/findLastIndex.js
+++ b/findLastIndex.js
@@ -7,9 +7,11 @@ import baseIteratee from './_baseIteratee';
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Array
* @param {Array} array The array to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
diff --git a/findLastKey.js b/findLastKey.js
index d5f78412f..a6c2003ef 100644
--- a/findLastKey.js
+++ b/findLastKey.js
@@ -8,10 +8,13 @@ import baseIteratee from './_baseIteratee';
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Object
* @param {Object} object The object to search.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
- * @returns {string|undefined} Returns the key of the matched element, else `undefined`.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
+ * @returns {string|undefined} Returns the key of the matched element,
+ * else `undefined`.
* @example
*
* var users = {
diff --git a/flatMap.js b/flatMap.js
index 8091faa78..11e0ce010 100644
--- a/flatMap.js
+++ b/flatMap.js
@@ -2,15 +2,17 @@ import baseFlatten from './_baseFlatten';
import map from './map';
/**
- * Creates an array of flattened values by running each element in `collection`
- * through `iteratee` and concating its result to the other mapped values.
- * The iteratee is invoked with three arguments: (value, index|key, collection).
+ * Creates a flattened array of values by running each element in `collection`
+ * through `iteratee` and flattening the mapped results. The iteratee is
+ * invoked with three arguments: (value, index|key, collection).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
*
diff --git a/flatMapDeep.js b/flatMapDeep.js
new file mode 100644
index 000000000..dfff660e2
--- /dev/null
+++ b/flatMapDeep.js
@@ -0,0 +1,32 @@
+import baseFlatten from './_baseFlatten';
+import map from './map';
+
+/** Used as references for various `Number` constants. */
+var INFINITY = 1 / 0;
+
+/**
+ * This method is like `_.flatMap` except that it recursively flattens the
+ * mapped results.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * function duplicate(n) {
+ * return [[[n, n]]];
+ * }
+ *
+ * _.flatMapDeep([1, 2], duplicate);
+ * // => [1, 1, 2, 2]
+ */
+function flatMapDeep(collection, iteratee) {
+ return baseFlatten(map(collection, iteratee), INFINITY);
+}
+
+export default flatMapDeep;
diff --git a/flatMapDepth.js b/flatMapDepth.js
new file mode 100644
index 000000000..a8bcdf83a
--- /dev/null
+++ b/flatMapDepth.js
@@ -0,0 +1,32 @@
+import baseFlatten from './_baseFlatten';
+import map from './map';
+import toInteger from './toInteger';
+
+/**
+ * This method is like `_.flatMap` except that it recursively flattens the
+ * mapped results up to `depth` times.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Collection
+ * @param {Array|Object} collection The collection to iterate over.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
+ * @param {number} [depth=1] The maximum recursion depth.
+ * @returns {Array} Returns the new flattened array.
+ * @example
+ *
+ * function duplicate(n) {
+ * return [[[n, n]]];
+ * }
+ *
+ * _.flatMapDepth([1, 2], duplicate, 2);
+ * // => [[1, 1], [2, 2]]
+ */
+function flatMapDepth(collection, iteratee, depth) {
+ depth = depth === undefined ? 1 : toInteger(depth);
+ return baseFlatten(map(collection, iteratee), depth);
+}
+
+export default flatMapDepth;
diff --git a/flatten.js b/flatten.js
index 09f603bfb..97ef4d70a 100644
--- a/flatten.js
+++ b/flatten.js
@@ -5,6 +5,7 @@ import baseFlatten from './_baseFlatten';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
diff --git a/flattenDeep.js b/flattenDeep.js
index 1a9970e00..b58fadf10 100644
--- a/flattenDeep.js
+++ b/flattenDeep.js
@@ -8,6 +8,7 @@ var INFINITY = 1 / 0;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
diff --git a/flattenDepth.js b/flattenDepth.js
index b658e33ba..73eb8fdb0 100644
--- a/flattenDepth.js
+++ b/flattenDepth.js
@@ -6,6 +6,7 @@ import toInteger from './toInteger';
*
* @static
* @memberOf _
+ * @since 4.4.0
* @category Array
* @param {Array} array The array to flatten.
* @param {number} [depth=1] The maximum recursion depth.
diff --git a/flip.js b/flip.js
index 5e11ec7d3..8f3c0e802 100644
--- a/flip.js
+++ b/flip.js
@@ -8,6 +8,7 @@ var FLIP_FLAG = 512;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Function
* @param {Function} func The function to flip arguments for.
* @returns {Function} Returns the new function.
diff --git a/floor.js b/floor.js
index f1582cbd8..8c06c3afd 100644
--- a/floor.js
+++ b/floor.js
@@ -5,6 +5,7 @@ import createRound from './_createRound';
*
* @static
* @memberOf _
+ * @since 3.10.0
* @category Math
* @param {number} number The number to round down.
* @param {number} [precision=0] The precision to round down to.
diff --git a/flow.js b/flow.js
index 3a384b447..799b6f532 100644
--- a/flow.js
+++ b/flow.js
@@ -7,6 +7,7 @@ import createFlow from './_createFlow';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Util
* @param {...(Function|Function[])} [funcs] Functions to invoke.
* @returns {Function} Returns the new function.
diff --git a/flowRight.js b/flowRight.js
index 23908eaba..fe8b6b5d4 100644
--- a/flowRight.js
+++ b/flowRight.js
@@ -5,6 +5,7 @@ import createFlow from './_createFlow';
* invokes the given functions from right to left.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {...(Function|Function[])} [funcs] Functions to invoke.
diff --git a/forEach.js b/forEach.js
index 6ecb13ba0..8ac8b6cf7 100644
--- a/forEach.js
+++ b/forEach.js
@@ -1,6 +1,6 @@
import arrayEach from './_arrayEach';
-import baseCastFunction from './_baseCastFunction';
import baseEach from './_baseEach';
+import baseIteratee from './_baseIteratee';
import isArray from './isArray';
/**
@@ -8,12 +8,13 @@ import isArray from './isArray';
* The iteratee is invoked with three arguments: (value, index|key, collection).
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
- * **Note:** As with other "Collections" methods, objects with a "length" property
- * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn`
- * for object iteration.
+ * **Note:** As with other "Collections" methods, objects with a "length"
+ * property are iterated like arrays. To avoid this behavior use `_.forIn`
+ * or `_.forOwn` for object iteration.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @alias each
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
@@ -24,17 +25,17 @@ import isArray from './isArray';
* _([1, 2]).forEach(function(value) {
* console.log(value);
* });
- * // => logs `1` then `2`
+ * // => Logs `1` then `2`.
*
* _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
* console.log(key);
* });
- * // => logs 'a' then 'b' (iteration order is not guaranteed)
+ * // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forEach(collection, iteratee) {
return (typeof iteratee == 'function' && isArray(collection))
? arrayEach(collection, iteratee)
- : baseEach(collection, baseCastFunction(iteratee));
+ : baseEach(collection, baseIteratee(iteratee));
}
export default forEach;
diff --git a/forEachRight.js b/forEachRight.js
index 66714170b..b615d48f4 100644
--- a/forEachRight.js
+++ b/forEachRight.js
@@ -1,6 +1,6 @@
import arrayEachRight from './_arrayEachRight';
-import baseCastFunction from './_baseCastFunction';
import baseEachRight from './_baseEachRight';
+import baseIteratee from './_baseIteratee';
import isArray from './isArray';
/**
@@ -9,6 +9,7 @@ import isArray from './isArray';
*
* @static
* @memberOf _
+ * @since 2.0.0
* @alias eachRight
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
@@ -19,12 +20,12 @@ import isArray from './isArray';
* _.forEachRight([1, 2], function(value) {
* console.log(value);
* });
- * // => logs `2` then `1`
+ * // => Logs `2` then `1`.
*/
function forEachRight(collection, iteratee) {
return (typeof iteratee == 'function' && isArray(collection))
? arrayEachRight(collection, iteratee)
- : baseEachRight(collection, baseCastFunction(iteratee));
+ : baseEachRight(collection, baseIteratee(iteratee));
}
export default forEachRight;
diff --git a/forIn.js b/forIn.js
index dba18f787..cc773b166 100644
--- a/forIn.js
+++ b/forIn.js
@@ -1,15 +1,16 @@
-import baseCastFunction from './_baseCastFunction';
import baseFor from './_baseFor';
+import baseIteratee from './_baseIteratee';
import keysIn from './keysIn';
/**
- * Iterates over own and inherited enumerable properties of an object invoking
- * `iteratee` for each property. The iteratee is invoked with three arguments:
- * (value, key, object). Iteratee functions may exit iteration early by explicitly
- * returning `false`.
+ * Iterates over own and inherited enumerable string keyed properties of an
+ * object invoking `iteratee` for each property. The iteratee is invoked with
+ * three arguments: (value, key, object). Iteratee functions may exit iteration
+ * early by explicitly returning `false`.
*
* @static
* @memberOf _
+ * @since 0.3.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
@@ -26,12 +27,12 @@ import keysIn from './keysIn';
* _.forIn(new Foo, function(value, key) {
* console.log(key);
* });
- * // => logs 'a', 'b', then 'c' (iteration order is not guaranteed)
+ * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
*/
function forIn(object, iteratee) {
return object == null
? object
- : baseFor(object, baseCastFunction(iteratee), keysIn);
+ : baseFor(object, baseIteratee(iteratee), keysIn);
}
export default forIn;
diff --git a/forInRight.js b/forInRight.js
index e512dd1f6..66155c199 100644
--- a/forInRight.js
+++ b/forInRight.js
@@ -1,5 +1,5 @@
-import baseCastFunction from './_baseCastFunction';
import baseForRight from './_baseForRight';
+import baseIteratee from './_baseIteratee';
import keysIn from './keysIn';
/**
@@ -8,6 +8,7 @@ import keysIn from './keysIn';
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
@@ -24,12 +25,12 @@ import keysIn from './keysIn';
* _.forInRight(new Foo, function(value, key) {
* console.log(key);
* });
- * // => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'
+ * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
*/
function forInRight(object, iteratee) {
return object == null
? object
- : baseForRight(object, baseCastFunction(iteratee), keysIn);
+ : baseForRight(object, baseIteratee(iteratee), keysIn);
}
export default forInRight;
diff --git a/forOwn.js b/forOwn.js
index e849d367b..acf1f4f53 100644
--- a/forOwn.js
+++ b/forOwn.js
@@ -1,14 +1,15 @@
-import baseCastFunction from './_baseCastFunction';
import baseForOwn from './_baseForOwn';
+import baseIteratee from './_baseIteratee';
/**
- * Iterates over own enumerable properties of an object invoking `iteratee`
- * for each property. The iteratee is invoked with three arguments:
+ * Iterates over own enumerable string keyed properties of an object invoking
+ * `iteratee` for each property. The iteratee is invoked with three arguments:
* (value, key, object). Iteratee functions may exit iteration early by
* explicitly returning `false`.
*
* @static
* @memberOf _
+ * @since 0.3.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
@@ -25,10 +26,10 @@ import baseForOwn from './_baseForOwn';
* _.forOwn(new Foo, function(value, key) {
* console.log(key);
* });
- * // => logs 'a' then 'b' (iteration order is not guaranteed)
+ * // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forOwn(object, iteratee) {
- return object && baseForOwn(object, baseCastFunction(iteratee));
+ return object && baseForOwn(object, baseIteratee(iteratee));
}
export default forOwn;
diff --git a/forOwnRight.js b/forOwnRight.js
index 825125d2c..e8750ae83 100644
--- a/forOwnRight.js
+++ b/forOwnRight.js
@@ -1,5 +1,5 @@
-import baseCastFunction from './_baseCastFunction';
import baseForOwnRight from './_baseForOwnRight';
+import baseIteratee from './_baseIteratee';
/**
* This method is like `_.forOwn` except that it iterates over properties of
@@ -7,6 +7,7 @@ import baseForOwnRight from './_baseForOwnRight';
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
@@ -23,10 +24,10 @@ import baseForOwnRight from './_baseForOwnRight';
* _.forOwnRight(new Foo, function(value, key) {
* console.log(key);
* });
- * // => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'
+ * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
*/
function forOwnRight(object, iteratee) {
- return object && baseForOwnRight(object, baseCastFunction(iteratee));
+ return object && baseForOwnRight(object, baseIteratee(iteratee));
}
export default forOwnRight;
diff --git a/fromPairs.js b/fromPairs.js
index e8725e590..6da3b8be9 100644
--- a/fromPairs.js
+++ b/fromPairs.js
@@ -4,6 +4,7 @@
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} pairs The key-value pairs.
* @returns {Object} Returns the new object.
diff --git a/functions.js b/functions.js
index 7b3f22910..e13563309 100644
--- a/functions.js
+++ b/functions.js
@@ -6,6 +6,7 @@ import keys from './keys';
* of `object`.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to inspect.
diff --git a/functionsIn.js b/functionsIn.js
index 7a836b928..12d21ee99 100644
--- a/functionsIn.js
+++ b/functionsIn.js
@@ -7,6 +7,7 @@ import keysIn from './keysIn';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The object to inspect.
* @returns {Array} Returns the new array of property names.
diff --git a/get.js b/get.js
index 2ce768938..2cb923cc0 100644
--- a/get.js
+++ b/get.js
@@ -6,10 +6,11 @@ import baseGet from './_baseGet';
*
* @static
* @memberOf _
+ * @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
- * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
+ * @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
diff --git a/groupBy.js b/groupBy.js
index 3fa4106c7..6a0c5f78b 100644
--- a/groupBy.js
+++ b/groupBy.js
@@ -14,9 +14,11 @@ var hasOwnProperty = objectProto.hasOwnProperty;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
diff --git a/gt.js b/gt.js
index 7d3c725cf..81934ee87 100644
--- a/gt.js
+++ b/gt.js
@@ -3,10 +3,12 @@
*
* @static
* @memberOf _
+ * @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.
+ * @returns {boolean} Returns `true` if `value` is greater than `other`,
+ * else `false`.
* @example
*
* _.gt(3, 1);
diff --git a/gte.js b/gte.js
index e87108ecd..93be2aaa7 100644
--- a/gte.js
+++ b/gte.js
@@ -3,10 +3,12 @@
*
* @static
* @memberOf _
+ * @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`.
+ * @returns {boolean} Returns `true` if `value` is greater than or equal to
+ * `other`, else `false`.
* @example
*
* _.gte(3, 1);
diff --git a/has.js b/has.js
index 16527d60c..dcdda8a18 100644
--- a/has.js
+++ b/has.js
@@ -5,6 +5,7 @@ import hasPath from './_hasPath';
* Checks if `path` is a direct property of `object`.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
diff --git a/hasIn.js b/hasIn.js
index bfdfae2e9..f8e4b511e 100644
--- a/hasIn.js
+++ b/hasIn.js
@@ -6,6 +6,7 @@ import hasPath from './_hasPath';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
diff --git a/head.js b/head.js
index 5ae4f6364..b6e16f95f 100644
--- a/head.js
+++ b/head.js
@@ -3,6 +3,7 @@
*
* @static
* @memberOf _
+ * @since 0.1.0
* @alias first
* @category Array
* @param {Array} array The array to query.
diff --git a/identity.js b/identity.js
index 61a4e448d..3a5e66574 100644
--- a/identity.js
+++ b/identity.js
@@ -2,6 +2,7 @@
* This method returns the first argument given to it.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {*} value Any value.
diff --git a/inRange.js b/inRange.js
index 9c3b67788..e55e7ec8e 100644
--- a/inRange.js
+++ b/inRange.js
@@ -9,6 +9,7 @@ import toNumber from './toNumber';
*
* @static
* @memberOf _
+ * @since 3.3.0
* @category Number
* @param {number} number The number to check.
* @param {number} [start=0] The start of the range.
diff --git a/includes.js b/includes.js
index 191111e2c..61420ab9e 100644
--- a/includes.js
+++ b/includes.js
@@ -8,18 +8,20 @@ import values from './values';
var nativeMax = Math.max;
/**
- * Checks if `value` is in `collection`. If `collection` is a string it's checked
- * for a substring of `value`, otherwise [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+ * Checks if `value` is in `collection`. If `collection` is a string it's
+ * checked for a substring of `value`, otherwise
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* is used for equality comparisons. If `fromIndex` is negative, it's used as
* the offset from the end of `collection`.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object|string} collection The collection to search.
* @param {*} value The value to search for.
* @param {number} [fromIndex=0] The index to search from.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
* @returns {boolean} Returns `true` if `value` is found, else `false`.
* @example
*
diff --git a/indexOf.js b/indexOf.js
index a10088f5d..5200b51c6 100644
--- a/indexOf.js
+++ b/indexOf.js
@@ -12,6 +12,7 @@ var nativeMax = Math.max;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to search.
* @param {*} value The value to search for.
diff --git a/initial.js b/initial.js
index d0297c33b..e189e6b83 100644
--- a/initial.js
+++ b/initial.js
@@ -5,6 +5,7 @@ import dropRight from './dropRight';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @returns {Array} Returns the slice of `array`.
diff --git a/intersection.js b/intersection.js
index 64591b110..2e5f6b07a 100644
--- a/intersection.js
+++ b/intersection.js
@@ -11,6 +11,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of intersecting values.
diff --git a/intersectionBy.js b/intersectionBy.js
index 49dfeb518..9a298fae4 100644
--- a/intersectionBy.js
+++ b/intersectionBy.js
@@ -13,9 +13,11 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns the new array of intersecting values.
* @example
*
diff --git a/intersectionWith.js b/intersectionWith.js
index 8d14ecb80..d0543e8b5 100644
--- a/intersectionWith.js
+++ b/intersectionWith.js
@@ -12,6 +12,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [comparator] The comparator invoked per element.
diff --git a/invert.js b/invert.js
index 607f61b01..283b1250e 100644
--- a/invert.js
+++ b/invert.js
@@ -4,11 +4,12 @@ import identity from './identity';
/**
* Creates an object composed of the inverted keys and values of `object`.
- * If `object` contains duplicate values, subsequent values overwrite property
- * assignments of previous values.
+ * If `object` contains duplicate values, subsequent values overwrite
+ * property assignments of previous values.
*
* @static
* @memberOf _
+ * @since 0.7.0
* @category Object
* @param {Object} object The object to invert.
* @returns {Object} Returns the new inverted object.
diff --git a/invertBy.js b/invertBy.js
index 584722f5e..b096f8dc0 100644
--- a/invertBy.js
+++ b/invertBy.js
@@ -16,9 +16,11 @@ var hasOwnProperty = objectProto.hasOwnProperty;
*
* @static
* @memberOf _
+ * @since 4.1.0
* @category Object
* @param {Object} object The object to invert.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Object} Returns the new inverted object.
* @example
*
diff --git a/invoke.js b/invoke.js
index 375d99808..d68fa8349 100644
--- a/invoke.js
+++ b/invoke.js
@@ -6,6 +6,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the method to invoke.
diff --git a/invokeMap.js b/invokeMap.js
index 1a46218a2..f2d0e19a1 100644
--- a/invokeMap.js
+++ b/invokeMap.js
@@ -13,6 +13,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Array|Function|string} path The path of the method to invoke or
diff --git a/isArguments.js b/isArguments.js
index 62c5e3642..579c0e088 100644
--- a/isArguments.js
+++ b/isArguments.js
@@ -23,9 +23,11 @@ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
diff --git a/isArray.js b/isArray.js
index 2657ccc2c..316f36733 100644
--- a/isArray.js
+++ b/isArray.js
@@ -3,10 +3,12 @@
*
* @static
* @memberOf _
+ * @since 0.1.0
* @type {Function}
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isArray([1, 2, 3]);
diff --git a/isArrayBuffer.js b/isArrayBuffer.js
index 9201e9445..b603d0eac 100644
--- a/isArrayBuffer.js
+++ b/isArrayBuffer.js
@@ -16,9 +16,11 @@ var objectToString = objectProto.toString;
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isArrayBuffer(new ArrayBuffer(2));
diff --git a/isArrayLike.js b/isArrayLike.js
index 6c70e2375..ea76be4a0 100644
--- a/isArrayLike.js
+++ b/isArrayLike.js
@@ -9,6 +9,7 @@ import isLength from './isLength';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
diff --git a/isArrayLikeObject.js b/isArrayLikeObject.js
index 991ef40e2..fea4ab852 100644
--- a/isArrayLikeObject.js
+++ b/isArrayLikeObject.js
@@ -7,9 +7,11 @@ import isObjectLike from './isObjectLike';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
+ * else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
diff --git a/isBoolean.js b/isBoolean.js
index 27a0f2222..0b3991a6e 100644
--- a/isBoolean.js
+++ b/isBoolean.js
@@ -17,9 +17,11 @@ var objectToString = objectProto.toString;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isBoolean(false);
diff --git a/isBuffer.js b/isBuffer.js
index bfccb20e3..3fefb0fad 100644
--- a/isBuffer.js
+++ b/isBuffer.js
@@ -30,6 +30,7 @@ var Buffer = moduleExports ? root.Buffer : undefined;
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
diff --git a/isDate.js b/isDate.js
index 0218fb2b9..8c100147b 100644
--- a/isDate.js
+++ b/isDate.js
@@ -17,9 +17,11 @@ var objectToString = objectProto.toString;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isDate(new Date);
diff --git a/isElement.js b/isElement.js
index 14ab21951..a654808b2 100644
--- a/isElement.js
+++ b/isElement.js
@@ -6,9 +6,11 @@ import isPlainObject from './isPlainObject';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a DOM element,
+ * else `false`.
* @example
*
* _.isElement(document.body);
diff --git a/isEmpty.js b/isEmpty.js
index 9c35eff8c..0e126d7c9 100644
--- a/isEmpty.js
+++ b/isEmpty.js
@@ -1,8 +1,16 @@
+import getTag from './_getTag';
import isArguments from './isArguments';
import isArray from './isArray';
import isArrayLike from './isArrayLike';
+import isBuffer from './isBuffer';
import isFunction from './isFunction';
+import isObjectLike from './isObjectLike';
import isString from './isString';
+import keys from './keys';
+
+/** `Object#toString` result references. */
+var mapTag = '[object Map]',
+ setTag = '[object Set]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
@@ -10,13 +18,25 @@ var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
+/** Built-in value references. */
+var propertyIsEnumerable = objectProto.propertyIsEnumerable;
+
+/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */
+var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
+
/**
- * Checks if `value` is an empty collection or object. A value is considered
- * empty if it's an `arguments` object, array, string, or jQuery-like collection
- * with a length of `0` or has no own enumerable properties.
+ * Checks if `value` is an empty object, collection, map, or set.
+ *
+ * Objects are considered empty if they have no own enumerable string keyed
+ * properties.
+ *
+ * Array-like values such as `arguments` objects, arrays, buffers, strings, or
+ * jQuery-like collections are considered empty if they have a `length` of `0`.
+ * Similarly, maps and sets are considered empty if they have a `size` of `0`.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
@@ -39,16 +59,22 @@ var hasOwnProperty = objectProto.hasOwnProperty;
*/
function isEmpty(value) {
if (isArrayLike(value) &&
- (isArray(value) || isString(value) ||
- isFunction(value.splice) || isArguments(value))) {
+ (isArray(value) || isString(value) || isFunction(value.splice) ||
+ isArguments(value) || isBuffer(value))) {
return !value.length;
}
+ if (isObjectLike(value)) {
+ var tag = getTag(value);
+ if (tag == mapTag || tag == setTag) {
+ return !value.size;
+ }
+ }
for (var key in value) {
if (hasOwnProperty.call(value, key)) {
return false;
}
}
- return true;
+ return !(nonEnumShadows && keys(value).length);
}
export default isEmpty;
diff --git a/isEqual.js b/isEqual.js
index fdd02369c..ea6f044c6 100644
--- a/isEqual.js
+++ b/isEqual.js
@@ -12,10 +12,12 @@ import baseIsEqual from './_baseIsEqual';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ * @returns {boolean} Returns `true` if the values are equivalent,
+ * else `false`.
* @example
*
* var object = { 'user': 'fred' };
diff --git a/isEqualWith.js b/isEqualWith.js
index d4d3da7fe..22a3df806 100644
--- a/isEqualWith.js
+++ b/isEqualWith.js
@@ -8,11 +8,13 @@ import baseIsEqual from './_baseIsEqual';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons.
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ * @returns {boolean} Returns `true` if the values are equivalent,
+ * else `false`.
* @example
*
* function isGreeting(value) {
diff --git a/isError.js b/isError.js
index a1e2d82b9..156548e91 100644
--- a/isError.js
+++ b/isError.js
@@ -18,9 +18,11 @@ var objectToString = objectProto.toString;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is an error object,
+ * else `false`.
* @example
*
* _.isError(new Error);
diff --git a/isFinite.js b/isFinite.js
index e0ea97e2d..22d8a351b 100644
--- a/isFinite.js
+++ b/isFinite.js
@@ -6,13 +6,16 @@ var nativeIsFinite = root.isFinite;
/**
* Checks if `value` is a finite primitive number.
*
- * **Note:** This method is based on [`Number.isFinite`](https://mdn.io/Number/isFinite).
+ * **Note:** This method is based on
+ * [`Number.isFinite`](https://mdn.io/Number/isFinite).
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a finite number,
+ * else `false`.
* @example
*
* _.isFinite(3);
diff --git a/isFunction.js b/isFunction.js
index c66ff49f0..7144ea119 100644
--- a/isFunction.js
+++ b/isFunction.js
@@ -18,9 +18,11 @@ var objectToString = objectProto.toString;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isFunction(_);
diff --git a/isInteger.js b/isInteger.js
index 4c8799b73..92a5635e9 100644
--- a/isInteger.js
+++ b/isInteger.js
@@ -3,10 +3,12 @@ import toInteger from './toInteger';
/**
* Checks if `value` is an integer.
*
- * **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger).
+ * **Note:** This method is based on
+ * [`Number.isInteger`](https://mdn.io/Number/isInteger).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an integer, else `false`.
diff --git a/isLength.js b/isLength.js
index 6dd6cc5ec..39d09201a 100644
--- a/isLength.js
+++ b/isLength.js
@@ -4,13 +4,16 @@ var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
- * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+ * **Note:** This function is loosely based on
+ * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a valid length,
+ * else `false`.
* @example
*
* _.isLength(3);
diff --git a/isMap.js b/isMap.js
index 7c4a6bae4..fbca4571d 100644
--- a/isMap.js
+++ b/isMap.js
@@ -9,9 +9,11 @@ var mapTag = '[object Map]';
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isMap(new Map);
diff --git a/isMatch.js b/isMatch.js
index 14186f601..721c9b9ae 100644
--- a/isMatch.js
+++ b/isMatch.js
@@ -10,6 +10,7 @@ import getMatchData from './_getMatchData';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Lang
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
diff --git a/isMatchWith.js b/isMatchWith.js
index b141032bd..08868b70f 100644
--- a/isMatchWith.js
+++ b/isMatchWith.js
@@ -9,6 +9,7 @@ import getMatchData from './_getMatchData';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
diff --git a/isNaN.js b/isNaN.js
index 099a9970c..8489779c3 100644
--- a/isNaN.js
+++ b/isNaN.js
@@ -3,11 +3,13 @@ import isNumber from './isNumber';
/**
* Checks if `value` is `NaN`.
*
- * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4)
- * which returns `true` for `undefined` and other non-numeric values.
+ * **Note:** This method is not the same as
+ * [`isNaN`](https://es5.github.io/#x15.1.2.4) which returns `true` for
+ * `undefined` and other non-numeric values.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
@@ -27,7 +29,8 @@ import isNumber from './isNumber';
*/
function isNaN(value) {
// An `NaN` primitive is the only value that is not equal to itself.
- // Perform the `toStringTag` check first to avoid errors with some ActiveX objects in IE.
+ // Perform the `toStringTag` check first to avoid errors with some
+ // ActiveX objects in IE.
return isNumber(value) && value != +value;
}
diff --git a/isNative.js b/isNative.js
index d0b25303a..5a3478572 100644
--- a/isNative.js
+++ b/isNative.js
@@ -5,7 +5,7 @@ import isObjectLike from './isObjectLike';
/** Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). */
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
-/** Used to detect host constructors (Safari > 5). */
+/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
@@ -28,9 +28,11 @@ var reIsNative = RegExp('^' +
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a native function, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a native function,
+ * else `false`.
* @example
*
* _.isNative(Array.prototype.push);
diff --git a/isNil.js b/isNil.js
index 44603d47f..9c4a93c60 100644
--- a/isNil.js
+++ b/isNil.js
@@ -3,6 +3,7 @@
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is nullish, else `false`.
diff --git a/isNull.js b/isNull.js
index f66645fdb..5d885981a 100644
--- a/isNull.js
+++ b/isNull.js
@@ -3,6 +3,7 @@
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
diff --git a/isNumber.js b/isNumber.js
index 0fcfce16b..1ad99f843 100644
--- a/isNumber.js
+++ b/isNumber.js
@@ -15,14 +15,16 @@ var objectToString = objectProto.toString;
/**
* Checks if `value` is classified as a `Number` primitive or object.
*
- * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
- * as numbers, use the `_.isFinite` method.
+ * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
+ * classified as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isNumber(3);
diff --git a/isObject.js b/isObject.js
index 524064d95..1488b7a99 100644
--- a/isObject.js
+++ b/isObject.js
@@ -4,6 +4,7 @@
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
diff --git a/isObjectLike.js b/isObjectLike.js
index 4d1211a9a..2f56e66ef 100644
--- a/isObjectLike.js
+++ b/isObjectLike.js
@@ -4,6 +4,7 @@
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
diff --git a/isPlainObject.js b/isPlainObject.js
index 1b375b87e..9a0701549 100644
--- a/isPlainObject.js
+++ b/isPlainObject.js
@@ -1,3 +1,4 @@
+import getPrototype from './_getPrototype';
import isHostObject from './_isHostObject';
import isObjectLike from './isObjectLike';
@@ -10,6 +11,9 @@ var objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = Function.prototype.toString;
+/** Used to check objects for own properties. */
+var hasOwnProperty = objectProto.hasOwnProperty;
+
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
@@ -19,18 +23,17 @@ var objectCtorString = funcToString.call(Object);
*/
var objectToString = objectProto.toString;
-/** Built-in value references. */
-var getPrototypeOf = Object.getPrototypeOf;
-
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
+ * @since 0.8.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a plain object,
+ * else `false`.
* @example
*
* function Foo() {
@@ -54,11 +57,11 @@ function isPlainObject(value) {
objectToString.call(value) != objectTag || isHostObject(value)) {
return false;
}
- var proto = getPrototypeOf(value);
+ var proto = getPrototype(value);
if (proto === null) {
return true;
}
- var Ctor = proto.constructor;
+ var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return (typeof Ctor == 'function' &&
Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
}
diff --git a/isRegExp.js b/isRegExp.js
index ce968c52c..b1bac4a07 100644
--- a/isRegExp.js
+++ b/isRegExp.js
@@ -17,9 +17,11 @@ var objectToString = objectProto.toString;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isRegExp(/abc/);
diff --git a/isSafeInteger.js b/isSafeInteger.js
index c81338df9..50662f1bf 100644
--- a/isSafeInteger.js
+++ b/isSafeInteger.js
@@ -7,13 +7,16 @@ var MAX_SAFE_INTEGER = 9007199254740991;
* Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
* double precision number which isn't the result of a rounded unsafe integer.
*
- * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
+ * **Note:** This method is based on
+ * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a safe integer,
+ * else `false`.
* @example
*
* _.isSafeInteger(3);
diff --git a/isSet.js b/isSet.js
index 0e7032f10..8631f30ca 100644
--- a/isSet.js
+++ b/isSet.js
@@ -9,9 +9,11 @@ var setTag = '[object Set]';
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isSet(new Set);
diff --git a/isString.js b/isString.js
index 7dd6d3554..c01208a98 100644
--- a/isString.js
+++ b/isString.js
@@ -17,10 +17,12 @@ var objectToString = objectProto.toString;
* Checks if `value` is classified as a `String` primitive or object.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isString('abc');
diff --git a/isSymbol.js b/isSymbol.js
index 37ed8d98b..e35477d16 100644
--- a/isSymbol.js
+++ b/isSymbol.js
@@ -17,9 +17,11 @@ var objectToString = objectProto.toString;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
diff --git a/isTypedArray.js b/isTypedArray.js
index e96f32e20..88191bc34 100644
--- a/isTypedArray.js
+++ b/isTypedArray.js
@@ -17,6 +17,7 @@ var argsTag = '[object Arguments]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
+ dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
@@ -36,11 +37,12 @@ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
-typedArrayTags[dateTag] = typedArrayTags[errorTag] =
-typedArrayTags[funcTag] = typedArrayTags[mapTag] =
-typedArrayTags[numberTag] = typedArrayTags[objectTag] =
-typedArrayTags[regexpTag] = typedArrayTags[setTag] =
-typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
+typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
+typedArrayTags[errorTag] = typedArrayTags[funcTag] =
+typedArrayTags[mapTag] = typedArrayTags[numberTag] =
+typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
+typedArrayTags[setTag] = typedArrayTags[stringTag] =
+typedArrayTags[weakMapTag] = false;
/** Used for built-in method references. */
var objectProto = Object.prototype;
@@ -56,9 +58,11 @@ var objectToString = objectProto.toString;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
diff --git a/isUndefined.js b/isUndefined.js
index fe89ac689..d4f97d5ea 100644
--- a/isUndefined.js
+++ b/isUndefined.js
@@ -2,6 +2,7 @@
* Checks if `value` is `undefined`.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
diff --git a/isWeakMap.js b/isWeakMap.js
index f7d92a3c2..b1c52d892 100644
--- a/isWeakMap.js
+++ b/isWeakMap.js
@@ -9,9 +9,11 @@ var weakMapTag = '[object WeakMap]';
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isWeakMap(new WeakMap);
diff --git a/isWeakSet.js b/isWeakSet.js
index 9567f6b64..9199caf70 100644
--- a/isWeakSet.js
+++ b/isWeakSet.js
@@ -17,9 +17,11 @@ var objectToString = objectProto.toString;
*
* @static
* @memberOf _
+ * @since 4.3.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * else `false`.
* @example
*
* _.isWeakSet(new WeakSet);
diff --git a/iteratee.js b/iteratee.js
index 2e791fc70..dd3295106 100644
--- a/iteratee.js
+++ b/iteratee.js
@@ -3,12 +3,13 @@ import baseIteratee from './_baseIteratee';
/**
* Creates a function that invokes `func` with the arguments of the created
- * function. If `func` is a property name the created callback returns the
- * property value for a given element. If `func` is an object the created
- * callback returns `true` for elements that contain the equivalent object
- * properties, otherwise it returns `false`.
+ * function. If `func` is a property name the created function returns the
+ * property value for a given element. If `func` is an array or object the
+ * created function returns `true` for elements that contain the equivalent
+ * source properties, otherwise it returns `false`.
*
* @static
+ * @since 4.0.0
* @memberOf _
* @category Util
* @param {*} [func=_.identity] The value to convert to a callback.
@@ -16,20 +17,31 @@ import baseIteratee from './_baseIteratee';
* @example
*
* var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40 }
+ * { 'user': 'barney', 'age': 36, 'active': true },
+ * { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
+ * // The `_.matches` iteratee shorthand.
+ * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
+ * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
+ *
+ * // The `_.matchesProperty` iteratee shorthand.
+ * _.filter(users, _.iteratee(['user', 'fred']));
+ * // => [{ 'user': 'fred', 'age': 40 }]
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.map(users, _.iteratee('user'));
+ * // => ['barney', 'fred']
+ *
* // Create custom iteratee shorthands.
- * _.iteratee = _.wrap(_.iteratee, function(callback, func) {
- * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func);
- * return !p ? callback(func) : function(object) {
- * return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]);
+ * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
+ * return !_.isRegExp(func) ? iteratee(func) : function(string) {
+ * return func.test(string);
* };
* });
*
- * _.filter(users, 'age > 36');
- * // => [{ 'user': 'fred', 'age': 40 }]
+ * _.filter(['abc', 'def'], /ef/);
+ * // => ['def']
*/
function iteratee(func) {
return baseIteratee(typeof func == 'function' ? func : baseClone(func, true));
diff --git a/join.js b/join.js
index ad2b69c15..250a2d9dd 100644
--- a/join.js
+++ b/join.js
@@ -9,6 +9,7 @@ var nativeJoin = arrayProto.join;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to convert.
* @param {string} [separator=','] The element separator.
diff --git a/kebabCase.js b/kebabCase.js
index b0bf2fc2f..6880ce2e6 100644
--- a/kebabCase.js
+++ b/kebabCase.js
@@ -1,10 +1,12 @@
import createCompounder from './_createCompounder';
/**
- * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
+ * Converts `string` to
+ * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the kebab cased string.
@@ -16,7 +18,7 @@ import createCompounder from './_createCompounder';
* _.kebabCase('fooBar');
* // => 'foo-bar'
*
- * _.kebabCase('__foo_bar__');
+ * _.kebabCase('__FOO_BAR__');
* // => 'foo-bar'
*/
var kebabCase = createCompounder(function(result, word, index) {
diff --git a/keyBy.js b/keyBy.js
index ca8ba1d1f..3b22866dd 100644
--- a/keyBy.js
+++ b/keyBy.js
@@ -8,9 +8,11 @@ import createAggregator from './_createAggregator';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
*
diff --git a/keys.js b/keys.js
index a50a26ed6..6abc5fe39 100644
--- a/keys.js
+++ b/keys.js
@@ -13,6 +13,7 @@ import isPrototype from './_isPrototype';
* for more details.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
diff --git a/keysIn.js b/keysIn.js
index cb5f83cc7..d61f12306 100644
--- a/keysIn.js
+++ b/keysIn.js
@@ -16,6 +16,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
diff --git a/last.js b/last.js
index 6b83f62e9..16ef297bc 100644
--- a/last.js
+++ b/last.js
@@ -3,6 +3,7 @@
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the last element of `array`.
diff --git a/lastIndexOf.js b/lastIndexOf.js
index 217006661..80ea69b73 100644
--- a/lastIndexOf.js
+++ b/lastIndexOf.js
@@ -11,6 +11,7 @@ var nativeMax = Math.max,
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to search.
* @param {*} value The value to search for.
@@ -33,7 +34,11 @@ function lastIndexOf(array, value, fromIndex) {
var index = length;
if (fromIndex !== undefined) {
index = toInteger(fromIndex);
- index = (index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1)) + 1;
+ index = (
+ index < 0
+ ? nativeMax(length + index, 0)
+ : nativeMin(index, length - 1)
+ ) + 1;
}
if (value !== value) {
return indexOfNaN(array, index, true);
diff --git a/lodash.default.js b/lodash.default.js
index 7a25a762a..ab9ecec26 100644
--- a/lodash.default.js
+++ b/lodash.default.js
@@ -1,11 +1,11 @@
/**
* @license
- * lodash 4.6.1 (Custom Build)
+ * lodash 4.7.0 (Custom Build)
* Build: `lodash modularize exports="es" -o ./`
- * Copyright 2012-2016 The Dojo Foundation
+ * Copyright jQuery Foundation and other contributors
+ * Released under MIT license
* Based on Underscore.js 1.8.3
- * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
import array from './array';
import collection from './collection';
@@ -44,7 +44,7 @@ import toInteger from './toInteger';
import lodash from './wrapperLodash';
/** Used as the semantic version number. */
-var VERSION = '4.6.1';
+var VERSION = '4.7.0';
/** Used to compose bitmasks for wrapper metadata. */
var BIND_KEY_FLAG = 2;
@@ -88,7 +88,7 @@ var mixin = (function(func) {
};
}(_mixin));
-// Add functions that return wrapped values when chaining.
+// Add methods that return wrapped values in chain sequences.
lodash.after = func.after;
lodash.ary = func.ary;
lodash.assign = object.assign;
@@ -127,6 +127,8 @@ lodash.dropWhile = array.dropWhile;
lodash.fill = array.fill;
lodash.filter = collection.filter;
lodash.flatMap = collection.flatMap;
+lodash.flatMapDeep = collection.flatMapDeep;
+lodash.flatMapDepth = collection.flatMapDepth;
lodash.flatten = array.flatten;
lodash.flattenDeep = array.flattenDeep;
lodash.flattenDepth = array.flattenDepth;
@@ -238,13 +240,15 @@ lodash.zipObjectDeep = array.zipObjectDeep;
lodash.zipWith = array.zipWith;
// Add aliases.
+lodash.entries = object.toPairs;
+lodash.entriesIn = object.toPairsIn;
lodash.extend = object.assignIn;
lodash.extendWith = object.assignInWith;
-// Add functions to `lodash.prototype`.
+// Add methods to `lodash.prototype`.
mixin(lodash, lodash);
-// Add functions that return unwrapped values when chaining.
+// Add methods that return unwrapped values in chain sequences.
lodash.add = math.add;
lodash.attempt = util.attempt;
lodash.camelCase = string.camelCase;
@@ -256,6 +260,7 @@ lodash.cloneDeep = lang.cloneDeep;
lodash.cloneDeepWith = lang.cloneDeepWith;
lodash.cloneWith = lang.cloneWith;
lodash.deburr = string.deburr;
+lodash.divide = math.divide;
lodash.endsWith = string.endsWith;
lodash.eq = lang.eq;
lodash.escape = string.escape;
@@ -333,8 +338,10 @@ lodash.lte = lang.lte;
lodash.max = math.max;
lodash.maxBy = math.maxBy;
lodash.mean = math.mean;
+lodash.meanBy = math.meanBy;
lodash.min = math.min;
lodash.minBy = math.minBy;
+lodash.multiply = math.multiply;
lodash.noop = util.noop;
lodash.now = date.now;
lodash.pad = string.pad;
@@ -571,7 +578,7 @@ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
};
});
-// Add `Array` and `String` methods to `lodash.prototype`.
+// Add `Array` methods to `lodash.prototype`.
arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
var func = arrayProto[methodName],
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
@@ -580,15 +587,16 @@ arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(method
lodash.prototype[methodName] = function() {
var args = arguments;
if (retUnwrapped && !this.__chain__) {
- return func.apply(this.value(), args);
+ var value = this.value();
+ return func.apply(isArray(value) ? value : [], args);
}
return this[chainName](function(value) {
- return func.apply(value, args);
+ return func.apply(isArray(value) ? value : [], args);
});
};
});
-// Map minified function names to their real names.
+// Map minified method names to their real names.
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
@@ -604,16 +612,15 @@ realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{
'func': undefined
}];
-// Add functions to the lazy wrapper.
+// Add methods to `LazyWrapper`.
LazyWrapper.prototype.clone = lazyClone;
LazyWrapper.prototype.reverse = lazyReverse;
LazyWrapper.prototype.value = lazyValue;
-// Add chaining functions to the `lodash` wrapper.
+// Add chain sequence methods to the `lodash` wrapper.
lodash.prototype.at = seq.at;
lodash.prototype.chain = seq.wrapperChain;
lodash.prototype.commit = seq.commit;
-lodash.prototype.flatMap = seq.flatMap;
lodash.prototype.next = seq.next;
lodash.prototype.plant = seq.plant;
lodash.prototype.reverse = seq.reverse;
diff --git a/lodash.js b/lodash.js
index 50f861d1b..12d6aa0d4 100644
--- a/lodash.js
+++ b/lodash.js
@@ -1,11 +1,11 @@
/**
* @license
- * lodash 4.6.1 (Custom Build)
+ * lodash 4.7.0 (Custom Build)
* Build: `lodash modularize exports="es" -o ./`
- * Copyright 2012-2016 The Dojo Foundation
+ * Copyright jQuery Foundation and other contributors
+ * Released under MIT license
* Based on Underscore.js 1.8.3
- * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
export { default as add } from './add';
export { default as after } from './after';
@@ -50,6 +50,7 @@ export { default as delay } from './delay';
export { default as difference } from './difference';
export { default as differenceBy } from './differenceBy';
export { default as differenceWith } from './differenceWith';
+export { default as divide } from './divide';
export { default as drop } from './drop';
export { default as dropRight } from './dropRight';
export { default as dropRightWhile } from './dropRightWhile';
@@ -57,6 +58,8 @@ export { default as dropWhile } from './dropWhile';
export { default as each } from './each';
export { default as eachRight } from './eachRight';
export { default as endsWith } from './endsWith';
+export { default as entries } from './entries';
+export { default as entriesIn } from './entriesIn';
export { default as eq } from './eq';
export { default as escape } from './escape';
export { default as escapeRegExp } from './escapeRegExp';
@@ -72,6 +75,8 @@ export { default as findLast } from './findLast';
export { default as findLastIndex } from './findLastIndex';
export { default as findLastKey } from './findLastKey';
export { default as flatMap } from './flatMap';
+export { default as flatMapDeep } from './flatMapDeep';
+export { default as flatMapDepth } from './flatMapDepth';
export { default as flatten } from './flatten';
export { default as flattenDeep } from './flattenDeep';
export { default as flattenDepth } from './flattenDepth';
@@ -165,6 +170,7 @@ export { default as matchesProperty } from './matchesProperty';
export { default as max } from './max';
export { default as maxBy } from './maxBy';
export { default as mean } from './mean';
+export { default as meanBy } from './meanBy';
export { default as memoize } from './memoize';
export { default as merge } from './merge';
export { default as mergeWith } from './mergeWith';
@@ -173,6 +179,7 @@ export { default as methodOf } from './methodOf';
export { default as min } from './min';
export { default as minBy } from './minBy';
export { default as mixin } from './mixin';
+export { default as multiply } from './multiply';
export { default as negate } from './negate';
export { default as next } from './next';
export { default as noop } from './noop';
@@ -298,7 +305,6 @@ export { default as wrap } from './wrap';
export { default as wrapperAt } from './wrapperAt';
export { default as wrapperChain } from './wrapperChain';
export { default as wrapperCommit } from './commit';
-export { default as wrapperFlatMap } from './wrapperFlatMap';
export { default as wrapperLodash } from './wrapperLodash';
export { default as wrapperNext } from './next';
export { default as wrapperPlant } from './plant';
diff --git a/lowerCase.js b/lowerCase.js
index 075654455..6174b474c 100644
--- a/lowerCase.js
+++ b/lowerCase.js
@@ -5,12 +5,13 @@ import createCompounder from './_createCompounder';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the lower cased string.
* @example
*
- * _.lowerCase('--Foo-Bar');
+ * _.lowerCase('--Foo-Bar--');
* // => 'foo bar'
*
* _.lowerCase('fooBar');
diff --git a/lowerFirst.js b/lowerFirst.js
index af298e7e9..2a1882592 100644
--- a/lowerFirst.js
+++ b/lowerFirst.js
@@ -5,6 +5,7 @@ import createCaseFirst from './_createCaseFirst';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the converted string.
diff --git a/lt.js b/lt.js
index 2cbfc2adc..e8d5cb6fa 100644
--- a/lt.js
+++ b/lt.js
@@ -3,10 +3,12 @@
*
* @static
* @memberOf _
+ * @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.
+ * @returns {boolean} Returns `true` if `value` is less than `other`,
+ * else `false`.
* @example
*
* _.lt(1, 3);
diff --git a/lte.js b/lte.js
index 2b8cb24b6..b8c114c60 100644
--- a/lte.js
+++ b/lte.js
@@ -3,10 +3,12 @@
*
* @static
* @memberOf _
+ * @since 3.9.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
- * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`.
+ * @returns {boolean} Returns `true` if `value` is less than or equal to
+ * `other`, else `false`.
* @example
*
* _.lte(1, 3);
diff --git a/map.js b/map.js
index eef729742..d46806efe 100644
--- a/map.js
+++ b/map.js
@@ -19,9 +19,11 @@ import isArray from './isArray';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
* @example
*
diff --git a/mapKeys.js b/mapKeys.js
index 9ae244ac8..114dc9570 100644
--- a/mapKeys.js
+++ b/mapKeys.js
@@ -4,14 +4,16 @@ import baseIteratee from './_baseIteratee';
/**
* The opposite of `_.mapValues`; this method creates an object with the
* same values as `object` and keys generated by running each own enumerable
- * property of `object` through `iteratee`. The iteratee is invoked with
- * three arguments: (value, key, object).
+ * string keyed property of `object` through `iteratee`. The iteratee is
+ * invoked with three arguments: (value, key, object).
*
* @static
* @memberOf _
+ * @since 3.8.0
* @category Object
* @param {Object} object The object to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @example
*
diff --git a/mapValues.js b/mapValues.js
index c7ad0bf47..9d144182a 100644
--- a/mapValues.js
+++ b/mapValues.js
@@ -3,14 +3,17 @@ import baseIteratee from './_baseIteratee';
/**
* Creates an object with the same keys as `object` and values generated by
- * running each own enumerable property of `object` through `iteratee`. The
- * iteratee is invoked with three arguments: (value, key, object).
+ * running each own enumerable string keyed property of `object` through
+ * `iteratee`. The iteratee is invoked with three arguments:
+ * (value, key, object).
*
* @static
* @memberOf _
+ * @since 2.4.0
* @category Object
* @param {Object} object The object to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @example
*
diff --git a/matches.js b/matches.js
index 1e4e9bcbb..c9227d65e 100644
--- a/matches.js
+++ b/matches.js
@@ -11,6 +11,7 @@ import baseMatches from './_baseMatches';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Util
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new function.
diff --git a/matchesProperty.js b/matchesProperty.js
index 4a8c3d6e4..e2c9cd4df 100644
--- a/matchesProperty.js
+++ b/matchesProperty.js
@@ -10,6 +10,7 @@ import baseMatchesProperty from './_baseMatchesProperty';
*
* @static
* @memberOf _
+ * @since 3.2.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @param {*} srcValue The value to match.
diff --git a/math.default.js b/math.default.js
index 56fc9bca7..377e85513 100644
--- a/math.default.js
+++ b/math.default.js
@@ -1,18 +1,21 @@
import add from './add';
import ceil from './ceil';
+import divide from './divide';
import floor from './floor';
import max from './max';
import maxBy from './maxBy';
import mean from './mean';
+import meanBy from './meanBy';
import min from './min';
import minBy from './minBy';
+import multiply from './multiply';
import round from './round';
import subtract from './subtract';
import sum from './sum';
import sumBy from './sumBy';
export default {
- add, ceil, floor, max, maxBy,
- mean, min, minBy, round, subtract,
- sum, sumBy
+ add, ceil, divide, floor, max,
+ maxBy, mean, meanBy, min, minBy,
+ multiply, round, subtract, sum, sumBy
};
diff --git a/math.js b/math.js
index 9b7faa088..8cdff4328 100644
--- a/math.js
+++ b/math.js
@@ -1,11 +1,14 @@
export { default as add } from './add';
export { default as ceil } from './ceil';
+export { default as divide } from './divide';
export { default as floor } from './floor';
export { default as max } from './max';
export { default as maxBy } from './maxBy';
export { default as mean } from './mean';
+export { default as meanBy } from './meanBy';
export { default as min } from './min';
export { default as minBy } from './minBy';
+export { default as multiply } from './multiply';
export { default as round } from './round';
export { default as subtract } from './subtract';
export { default as sum } from './sum';
diff --git a/max.js b/max.js
index 588add547..2954c5c08 100644
--- a/max.js
+++ b/max.js
@@ -7,6 +7,7 @@ import identity from './identity';
* `undefined` is returned.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Math
* @param {Array} array The array to iterate over.
diff --git a/maxBy.js b/maxBy.js
index 107cb8434..9be271898 100644
--- a/maxBy.js
+++ b/maxBy.js
@@ -9,9 +9,11 @@ import gt from './gt';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {*} Returns the maximum value.
* @example
*
diff --git a/mean.js b/mean.js
index 4d917c575..1331713b9 100644
--- a/mean.js
+++ b/mean.js
@@ -1,10 +1,12 @@
-import sum from './sum';
+import baseMean from './_baseMean';
+import identity from './identity';
/**
* Computes the mean of the values in `array`.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
* @returns {number} Returns the mean.
@@ -14,7 +16,7 @@ import sum from './sum';
* // => 5
*/
function mean(array) {
- return sum(array) / (array ? array.length : 0);
+ return baseMean(array, identity);
}
export default mean;
diff --git a/meanBy.js b/meanBy.js
new file mode 100644
index 000000000..0a1fa8ccc
--- /dev/null
+++ b/meanBy.js
@@ -0,0 +1,32 @@
+import baseIteratee from './_baseIteratee';
+import baseMean from './_baseMean';
+
+/**
+ * This method is like `_.mean` except that it accepts `iteratee` which is
+ * invoked for each element in `array` to generate the value to be averaged.
+ * The iteratee is invoked with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Math
+ * @param {Array} array The array to iterate over.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
+ * @returns {number} Returns the mean.
+ * @example
+ *
+ * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
+ *
+ * _.meanBy(objects, function(o) { return o.n; });
+ * // => 5
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.meanBy(objects, 'n');
+ * // => 5
+ */
+function meanBy(array, iteratee) {
+ return baseMean(array, baseIteratee(iteratee));
+}
+
+export default meanBy;
diff --git a/memoize.js b/memoize.js
index d59456999..f0bf0f872 100644
--- a/memoize.js
+++ b/memoize.js
@@ -12,11 +12,13 @@ var FUNC_ERROR_TEXT = 'Expected a function';
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
- * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
+ * constructor with one whose instances implement the
+ * [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
* method interface of `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
@@ -61,7 +63,7 @@ function memoize(func, resolver) {
memoized.cache = cache.set(key, result);
return result;
};
- memoized.cache = new memoize.Cache;
+ memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
diff --git a/merge.js b/merge.js
index 0368b8f87..41db8e478 100644
--- a/merge.js
+++ b/merge.js
@@ -3,17 +3,18 @@ import createAssigner from './_createAssigner';
/**
* This method is like `_.assign` except that it recursively merges own and
- * inherited enumerable properties of source objects into the destination
- * object. Source properties that resolve to `undefined` are skipped if a
- * destination value exists. Array and plain object properties are merged
- * recursively.Other objects and value types are overridden by assignment.
- * Source objects are applied from left to right. Subsequent sources
- * overwrite property assignments of previous sources.
+ * inherited enumerable string keyed properties of source objects into the
+ * destination object. Source properties that resolve to `undefined` are
+ * skipped if a destination value exists. Array and plain object properties
+ * are merged recursively.Other objects and value types are overridden by
+ * assignment. Source objects are applied from left to right. Subsequent
+ * sources overwrite property assignments of previous sources.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
+ * @since 0.5.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
diff --git a/mergeWith.js b/mergeWith.js
index 8d069fe47..7ddada07c 100644
--- a/mergeWith.js
+++ b/mergeWith.js
@@ -12,6 +12,7 @@ import createAssigner from './_createAssigner';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
diff --git a/method.js b/method.js
index dfce962a4..33586dd80 100644
--- a/method.js
+++ b/method.js
@@ -7,6 +7,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 3.7.0
* @category Util
* @param {Array|string} path The path of the method to invoke.
* @param {...*} [args] The arguments to invoke the method with.
@@ -21,8 +22,8 @@ import rest from './rest';
* _.map(objects, _.method('a.b.c'));
* // => [2, 1]
*
- * _.invokeMap(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
- * // => [1, 2]
+ * _.map(objects, _.method(['a', 'b', 'c']));
+ * // => [2, 1]
*/
var method = rest(function(path, args) {
return function(object) {
diff --git a/methodOf.js b/methodOf.js
index d807b604b..d474eaf92 100644
--- a/methodOf.js
+++ b/methodOf.js
@@ -8,6 +8,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 3.7.0
* @category Util
* @param {Object} object The object to query.
* @param {...*} [args] The arguments to invoke the method with.
diff --git a/min.js b/min.js
index c1d9c38bf..76d95cd34 100644
--- a/min.js
+++ b/min.js
@@ -7,6 +7,7 @@ import lt from './lt';
* `undefined` is returned.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Math
* @param {Array} array The array to iterate over.
diff --git a/minBy.js b/minBy.js
index 6cb4e8776..375660824 100644
--- a/minBy.js
+++ b/minBy.js
@@ -9,9 +9,11 @@ import lt from './lt';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {*} Returns the minimum value.
* @example
*
diff --git a/mixin.js b/mixin.js
index 46c53688a..da42ea089 100644
--- a/mixin.js
+++ b/mixin.js
@@ -7,21 +7,21 @@ import isObject from './isObject';
import keys from './keys';
/**
- * Adds all own enumerable function properties of a source object to the
- * destination object. If `object` is a function then methods are added to
- * its prototype as well.
+ * Adds all own enumerable string keyed function properties of a source
+ * object to the destination object. If `object` is a function then methods
+ * are added to its prototype as well.
*
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to
* avoid conflicts caused by modifying the original.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {Function|Object} [object=lodash] The destination object.
* @param {Object} source The object of functions to add.
- * @param {Object} [options] The options object.
- * @param {boolean} [options.chain=true] Specify whether the functions added
- * are chainable.
+ * @param {Object} [options={}] The options object.
+ * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
* @returns {Function|Object} Returns `object`.
* @example
*
diff --git a/multiply.js b/multiply.js
new file mode 100644
index 000000000..084a37664
--- /dev/null
+++ b/multiply.js
@@ -0,0 +1,22 @@
+import createMathOperation from './_createMathOperation';
+
+/**
+ * Multiply two numbers.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.7.0
+ * @category Math
+ * @param {number} multiplier The first number in a multiplication.
+ * @param {number} multiplicand The second number in a multiplication.
+ * @returns {number} Returns the product.
+ * @example
+ *
+ * _.multiply(6, 4);
+ * // => 24
+ */
+var multiply = createMathOperation(function(multiplier, multiplicand) {
+ return multiplier * multiplicand;
+});
+
+export default multiply;
diff --git a/negate.js b/negate.js
index 0d62eb9c6..468d54fec 100644
--- a/negate.js
+++ b/negate.js
@@ -8,6 +8,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Function
* @param {Function} predicate The predicate to negate.
* @returns {Function} Returns the new function.
diff --git a/next.js b/next.js
index 5967dbf9d..4efa564d9 100644
--- a/next.js
+++ b/next.js
@@ -6,6 +6,7 @@ import toArray from './toArray';
*
* @name next
* @memberOf _
+ * @since 4.0.0
* @category Seq
* @returns {Object} Returns the next iterator value.
* @example
diff --git a/noop.js b/noop.js
index b7bed8503..1f652b79a 100644
--- a/noop.js
+++ b/noop.js
@@ -4,6 +4,7 @@
*
* @static
* @memberOf _
+ * @since 2.3.0
* @category Util
* @example
*
diff --git a/now.js b/now.js
index 2a751946f..1228bcb61 100644
--- a/now.js
+++ b/now.js
@@ -4,6 +4,7 @@
*
* @static
* @memberOf _
+ * @since 2.4.0
* @type {Function}
* @category Date
* @returns {number} Returns the timestamp.
@@ -12,7 +13,7 @@
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
- * // => logs the number of milliseconds it took for the deferred function to be invoked
+ * // => Logs the number of milliseconds it took for the deferred function to be invoked.
*/
var now = Date.now;
diff --git a/nthArg.js b/nthArg.js
index 996fe2b52..d1c4e7381 100644
--- a/nthArg.js
+++ b/nthArg.js
@@ -5,6 +5,7 @@ import toInteger from './toInteger';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {number} [n=0] The index of the argument to return.
* @returns {Function} Returns the new function.
diff --git a/object.default.js b/object.default.js
index d87236cd2..f9ad0bed3 100644
--- a/object.default.js
+++ b/object.default.js
@@ -5,6 +5,8 @@ import assignWith from './assignWith';
import create from './create';
import defaults from './defaults';
import defaultsDeep from './defaultsDeep';
+import entries from './entries';
+import entriesIn from './entriesIn';
import extend from './extend';
import extendWith from './extendWith';
import findKey from './findKey';
@@ -45,12 +47,13 @@ import valuesIn from './valuesIn';
export default {
assign, assignIn, assignInWith, assignWith, create,
- defaults, defaultsDeep, extend, extendWith, findKey,
- findLastKey, forIn, forInRight, forOwn, forOwnRight,
- functions, functionsIn, get, has, hasIn,
- invert, invertBy, invoke, keys, keysIn,
- mapKeys, mapValues, merge, mergeWith, omit,
- omitBy, pick, pickBy, result, set,
- setWith, toPairs, toPairsIn, transform, unset,
- update, updateWith, values, valuesIn
+ defaults, defaultsDeep, entries, entriesIn, extend,
+ extendWith, findKey, findLastKey, forIn, forInRight,
+ forOwn, forOwnRight, functions, functionsIn, get,
+ has, hasIn, invert, invertBy, invoke,
+ keys, keysIn, mapKeys, mapValues, merge,
+ mergeWith, omit, omitBy, pick, pickBy,
+ result, set, setWith, toPairs, toPairsIn,
+ transform, unset, update, updateWith, values,
+ valuesIn
};
diff --git a/object.js b/object.js
index d49b04b6d..df0056b35 100644
--- a/object.js
+++ b/object.js
@@ -5,6 +5,8 @@ export { default as assignWith } from './assignWith';
export { default as create } from './create';
export { default as defaults } from './defaults';
export { default as defaultsDeep } from './defaultsDeep';
+export { default as entries } from './entries';
+export { default as entriesIn } from './entriesIn';
export { default as extend } from './extend';
export { default as extendWith } from './extendWith';
export { default as findKey } from './findKey';
diff --git a/omit.js b/omit.js
index 3b5b2fedc..ebcef2d53 100644
--- a/omit.js
+++ b/omit.js
@@ -1,20 +1,23 @@
import arrayMap from './_arrayMap';
+import baseCastKey from './_baseCastKey';
import baseDifference from './_baseDifference';
import baseFlatten from './_baseFlatten';
import basePick from './_basePick';
-import keysIn from './keysIn';
+import getAllKeysIn from './_getAllKeysIn';
import rest from './rest';
/**
* The opposite of `_.pick`; this method creates an object composed of the
- * own and inherited enumerable properties of `object` that are not omitted.
+ * own and inherited enumerable string keyed properties of `object` that are
+ * not omitted.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
- * @param {...(string|string[])} [props] The property names to omit, specified
- * individually or in arrays.
+ * @param {...(string|string[])} [props] The property identifiers to omit,
+ * specified individually or in arrays.
* @returns {Object} Returns the new object.
* @example
*
@@ -27,8 +30,8 @@ var omit = rest(function(object, props) {
if (object == null) {
return {};
}
- props = arrayMap(baseFlatten(props, 1), String);
- return basePick(object, baseDifference(keysIn(object), props));
+ props = arrayMap(baseFlatten(props, 1), baseCastKey);
+ return basePick(object, baseDifference(getAllKeysIn(object), props));
});
export default omit;
diff --git a/omitBy.js b/omitBy.js
index 8ee1a4696..9dcfbff6c 100644
--- a/omitBy.js
+++ b/omitBy.js
@@ -3,15 +3,17 @@ import basePickBy from './_basePickBy';
/**
* The opposite of `_.pickBy`; this method creates an object composed of
- * the own and inherited enumerable properties of `object` that `predicate`
- * doesn't return truthy for. The predicate is invoked with two arguments:
- * (value, key).
+ * the own and inherited enumerable string keyed properties of `object` that
+ * `predicate` doesn't return truthy for. The predicate is invoked with two
+ * arguments: (value, key).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The source object.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per property.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
diff --git a/once.js b/once.js
index 5ef7b63c8..698afef4a 100644
--- a/once.js
+++ b/once.js
@@ -7,6 +7,7 @@ import before from './before';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new restricted function.
diff --git a/orderBy.js b/orderBy.js
index accb47c26..0a4081ee1 100644
--- a/orderBy.js
+++ b/orderBy.js
@@ -9,24 +9,26 @@ import isArray from './isArray';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by.
+ * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
+ * The iteratees to sort by.
* @param {string[]} [orders] The sort orders of `iteratees`.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
* @returns {Array} Returns the new sorted array.
* @example
*
* var users = [
* { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 34 },
- * { 'user': 'fred', 'age': 42 },
+ * { 'user': 'fred', 'age': 40 },
* { 'user': 'barney', 'age': 36 }
* ];
*
* // Sort by `user` in ascending order and by `age` in descending order.
* _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
- * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*/
function orderBy(collection, iteratees, orders, guard) {
if (collection == null) {
diff --git a/over.js b/over.js
index 6a0444f88..dd592d32c 100644
--- a/over.js
+++ b/over.js
@@ -7,6 +7,7 @@ import createOver from './_createOver';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {...(Function|Function[])} iteratees The iteratees to invoke.
* @returns {Function} Returns the new function.
diff --git a/overArgs.js b/overArgs.js
index 53a8ae3ca..083961bb7 100644
--- a/overArgs.js
+++ b/overArgs.js
@@ -12,6 +12,7 @@ var nativeMin = Math.min;
* corresponding `transforms`.
*
* @static
+ * @since 4.0.0
* @memberOf _
* @category Function
* @param {Function} func The function to wrap.
diff --git a/overEvery.js b/overEvery.js
index df70e6da3..cadde1e9c 100644
--- a/overEvery.js
+++ b/overEvery.js
@@ -7,6 +7,7 @@ import createOver from './_createOver';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {...(Function|Function[])} predicates The predicates to check.
* @returns {Function} Returns the new function.
diff --git a/overSome.js b/overSome.js
index d1a5d9d56..813b5e235 100644
--- a/overSome.js
+++ b/overSome.js
@@ -7,6 +7,7 @@ import createOver from './_createOver';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {...(Function|Function[])} predicates The predicates to check.
* @returns {Function} Returns the new function.
diff --git a/package.json b/package.json
index 0d37da8f9..973e3be62 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,12 @@
{
"name": "lodash-es",
- "version": "4.6.1",
+ "version": "4.7.0",
"description": "Lodash exported as ES modules.",
"homepage": "https://lodash.com/custom-builds",
"license": "MIT",
"jsnext:main": "lodash.js",
"main": "lodash.js",
+ "private": true,
"keywords": "es6, modules, stdlib, util",
"author": "John-David Dalton (http://allyoucanleet.com/)",
"contributors": [
diff --git a/pad.js b/pad.js
index 61fa8b815..7d304a09f 100644
--- a/pad.js
+++ b/pad.js
@@ -13,6 +13,7 @@ var nativeCeil = Math.ceil,
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
@@ -33,15 +34,16 @@ function pad(string, length, chars) {
string = toString(string);
length = toInteger(length);
- var strLength = stringSize(string);
+ var strLength = length ? stringSize(string) : 0;
if (!length || strLength >= length) {
return string;
}
- var mid = (length - strLength) / 2,
- leftLength = nativeFloor(mid),
- rightLength = nativeCeil(mid);
-
- return createPadding('', leftLength, chars) + string + createPadding('', rightLength, chars);
+ var mid = (length - strLength) / 2;
+ return (
+ createPadding(nativeFloor(mid), chars) +
+ string +
+ createPadding(nativeCeil(mid), chars)
+ );
}
export default pad;
diff --git a/padEnd.js b/padEnd.js
index cc266cd31..1ad75f420 100644
--- a/padEnd.js
+++ b/padEnd.js
@@ -1,4 +1,6 @@
import createPadding from './_createPadding';
+import stringSize from './_stringSize';
+import toInteger from './toInteger';
import toString from './toString';
/**
@@ -7,6 +9,7 @@ import toString from './toString';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
@@ -25,7 +28,12 @@ import toString from './toString';
*/
function padEnd(string, length, chars) {
string = toString(string);
- return string + createPadding(string, length, chars);
+ length = toInteger(length);
+
+ var strLength = length ? stringSize(string) : 0;
+ return (length && strLength < length)
+ ? (string + createPadding(length - strLength, chars))
+ : string;
}
export default padEnd;
diff --git a/padStart.js b/padStart.js
index c788b84f8..a1c20df30 100644
--- a/padStart.js
+++ b/padStart.js
@@ -1,4 +1,6 @@
import createPadding from './_createPadding';
+import stringSize from './_stringSize';
+import toInteger from './toInteger';
import toString from './toString';
/**
@@ -7,6 +9,7 @@ import toString from './toString';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
@@ -25,7 +28,12 @@ import toString from './toString';
*/
function padStart(string, length, chars) {
string = toString(string);
- return createPadding(string, length, chars) + string;
+ length = toInteger(length);
+
+ var strLength = length ? stringSize(string) : 0;
+ return (length && strLength < length)
+ ? (createPadding(length - strLength, chars) + string)
+ : string;
}
export default padStart;
diff --git a/parseInt.js b/parseInt.js
index 5019e2c99..f8945c758 100644
--- a/parseInt.js
+++ b/parseInt.js
@@ -12,18 +12,19 @@ var nativeParseInt = root.parseInt;
/**
* Converts `string` to an integer of the specified radix. If `radix` is
- * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
- * in which case a `radix` of `16` is used.
+ * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
+ * hexadecimal, in which case a `radix` of `16` is used.
*
- * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#x15.1.2.2)
- * of `parseInt`.
+ * **Note:** This method aligns with the
+ * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
*
* @static
* @memberOf _
+ * @since 1.1.0
* @category String
* @param {string} string The string to convert.
* @param {number} [radix=10] The radix to interpret `value` by.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {number} Returns the converted integer.
* @example
*
@@ -35,7 +36,7 @@ var nativeParseInt = root.parseInt;
*/
function parseInt(string, radix, guard) {
// Chrome fails to trim leading whitespace characters.
- // See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
+ // See https://bugs.chromium.org/p/v8/issues/detail?id=3109 for more details.
if (guard || radix == null) {
radix = 0;
} else if (radix) {
diff --git a/partial.js b/partial.js
index 520c468f9..e548bf57f 100644
--- a/partial.js
+++ b/partial.js
@@ -19,6 +19,7 @@ var PARTIAL_FLAG = 32;
*
* @static
* @memberOf _
+ * @since 0.2.0
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
diff --git a/partialRight.js b/partialRight.js
index 8607955a1..c98456b60 100644
--- a/partialRight.js
+++ b/partialRight.js
@@ -18,6 +18,7 @@ var PARTIAL_RIGHT_FLAG = 64;
*
* @static
* @memberOf _
+ * @since 1.0.0
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
diff --git a/partition.js b/partition.js
index bb65c837a..1d88989fa 100644
--- a/partition.js
+++ b/partition.js
@@ -8,9 +8,11 @@ import createAggregator from './_createAggregator';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the array of grouped elements.
* @example
*
diff --git a/pick.js b/pick.js
index 7399ccbf1..0e1daa36c 100644
--- a/pick.js
+++ b/pick.js
@@ -6,11 +6,12 @@ import rest from './rest';
* Creates an object composed of the picked `object` properties.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
- * @param {...(string|string[])} [props] The property names to pick, specified
- * individually or in arrays.
+ * @param {...(string|string[])} [props] The property identifiers to pick,
+ * specified individually or in arrays.
* @returns {Object} Returns the new object.
* @example
*
diff --git a/pickBy.js b/pickBy.js
index 3412a1928..00633b64c 100644
--- a/pickBy.js
+++ b/pickBy.js
@@ -7,9 +7,11 @@ import basePickBy from './_basePickBy';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The source object.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per property.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
diff --git a/plant.js b/plant.js
index 339412d60..ab025b487 100644
--- a/plant.js
+++ b/plant.js
@@ -2,10 +2,11 @@ import baseLodash from './_baseLodash';
import wrapperClone from './_wrapperClone';
/**
- * Creates a clone of the chained sequence planting `value` as the wrapped value.
+ * Creates a clone of the chain sequence planting `value` as the wrapped value.
*
* @name plant
* @memberOf _
+ * @since 3.2.0
* @category Seq
* @param {*} value The value to plant.
* @returns {Object} Returns the new `lodash` wrapper instance.
diff --git a/property.js b/property.js
index daeea29f9..805270b74 100644
--- a/property.js
+++ b/property.js
@@ -7,6 +7,7 @@ import isKey from './_isKey';
*
* @static
* @memberOf _
+ * @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new function.
diff --git a/propertyOf.js b/propertyOf.js
index cf4614545..0be962a7e 100644
--- a/propertyOf.js
+++ b/propertyOf.js
@@ -6,6 +6,7 @@ import baseGet from './_baseGet';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Util
* @param {Object} object The object to query.
* @returns {Function} Returns the new function.
diff --git a/pull.js b/pull.js
index 07b996488..d84f3d37c 100644
--- a/pull.js
+++ b/pull.js
@@ -11,6 +11,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {...*} [values] The values to remove.
diff --git a/pullAll.js b/pullAll.js
index abb00ed8f..b970d9f49 100644
--- a/pullAll.js
+++ b/pullAll.js
@@ -7,6 +7,7 @@ import basePullAll from './_basePullAll';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
diff --git a/pullAllBy.js b/pullAllBy.js
index e649aef41..87cda8161 100644
--- a/pullAllBy.js
+++ b/pullAllBy.js
@@ -10,10 +10,12 @@ import basePullAll from './_basePullAll';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns `array`.
* @example
*
diff --git a/pullAllWith.js b/pullAllWith.js
index dd2d6d3e8..32fad1940 100644
--- a/pullAllWith.js
+++ b/pullAllWith.js
@@ -9,6 +9,7 @@ import basePullAll from './_basePullAll';
*
* @static
* @memberOf _
+ * @since 4.6.0
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
diff --git a/pullAt.js b/pullAt.js
index 6b7fca7b8..2f96df516 100644
--- a/pullAt.js
+++ b/pullAt.js
@@ -13,6 +13,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {...(number|number[])} [indexes] The indexes of elements to remove,
diff --git a/random.js b/random.js
index 181e48ab0..ab376a071 100644
--- a/random.js
+++ b/random.js
@@ -12,14 +12,15 @@ var nativeMin = Math.min,
/**
* Produces a random number between the inclusive `lower` and `upper` bounds.
* If only one argument is provided a number between `0` and the given number
- * is returned. If `floating` is `true`, or either `lower` or `upper` are floats,
- * a floating-point number is returned instead of an integer.
+ * is returned. If `floating` is `true`, or either `lower` or `upper` are
+ * floats, a floating-point number is returned instead of an integer.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @memberOf _
+ * @since 0.7.0
* @category Number
* @param {number} [lower=0] The lower bound.
* @param {number} [upper=1] The upper bound.
diff --git a/range.js b/range.js
index e9c959648..2a985c3b2 100644
--- a/range.js
+++ b/range.js
@@ -10,6 +10,7 @@ import createRange from './_createRange';
* floating-point values which can produce unexpected results.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {number} [start=0] The start of the range.
diff --git a/rangeRight.js b/rangeRight.js
index f3f602eda..52b746ce7 100644
--- a/rangeRight.js
+++ b/rangeRight.js
@@ -6,6 +6,7 @@ import createRange from './_createRange';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
diff --git a/rearg.js b/rearg.js
index 2724fe7d4..6a0aef35f 100644
--- a/rearg.js
+++ b/rearg.js
@@ -13,6 +13,7 @@ var REARG_FLAG = 256;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Function
* @param {Function} func The function to rearrange arguments for.
* @param {...(number|number[])} indexes The arranged argument indexes,
diff --git a/reduce.js b/reduce.js
index 30d6c7fa0..096300e79 100644
--- a/reduce.js
+++ b/reduce.js
@@ -21,6 +21,7 @@ import isArray from './isArray';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
diff --git a/reduceRight.js b/reduceRight.js
index 21e3e284b..39567fc41 100644
--- a/reduceRight.js
+++ b/reduceRight.js
@@ -10,6 +10,7 @@ import isArray from './isArray';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
diff --git a/reject.js b/reject.js
index e71a39b3d..cc72e4178 100644
--- a/reject.js
+++ b/reject.js
@@ -9,9 +9,11 @@ import isArray from './isArray';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @example
*
diff --git a/remove.js b/remove.js
index 9682cce30..11a3dc44b 100644
--- a/remove.js
+++ b/remove.js
@@ -11,9 +11,11 @@ import basePullAt from './_basePullAt';
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Array
* @param {Array} array The array to modify.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the new array of removed elements.
* @example
*
diff --git a/repeat.js b/repeat.js
index 033e79e9c..967d0c060 100644
--- a/repeat.js
+++ b/repeat.js
@@ -1,17 +1,13 @@
+import baseRepeat from './_baseRepeat';
import toInteger from './toInteger';
import toString from './toString';
-/** Used as references for various `Number` constants. */
-var MAX_SAFE_INTEGER = 9007199254740991;
-
-/* Built-in method references for those with the same name as other `lodash` methods. */
-var nativeFloor = Math.floor;
-
/**
* Repeats the given string `n` times.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to repeat.
* @param {number} [n=0] The number of times to repeat the string.
@@ -28,24 +24,7 @@ var nativeFloor = Math.floor;
* // => ''
*/
function repeat(string, n) {
- string = toString(string);
- n = toInteger(n);
-
- var result = '';
- if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
- return result;
- }
- // Leverage the exponentiation by squaring algorithm for a faster repeat.
- // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
- do {
- if (n % 2) {
- result += string;
- }
- n = nativeFloor(n / 2);
- string += string;
- } while (n);
-
- return result;
+ return baseRepeat(toString(string), toInteger(n));
}
export default repeat;
diff --git a/replace.js b/replace.js
index 5db1f2026..5613c9ceb 100644
--- a/replace.js
+++ b/replace.js
@@ -3,10 +3,12 @@ import toString from './toString';
/**
* Replaces matches for `pattern` in `string` with `replacement`.
*
- * **Note:** This method is based on [`String#replace`](https://mdn.io/String/replace).
+ * **Note:** This method is based on
+ * [`String#replace`](https://mdn.io/String/replace).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to modify.
* @param {RegExp|string} pattern The pattern to replace.
diff --git a/rest.js b/rest.js
index 65a559abc..1f4356834 100644
--- a/rest.js
+++ b/rest.js
@@ -9,12 +9,15 @@ var nativeMax = Math.max;
/**
* Creates a function that invokes `func` with the `this` binding of the
- * created function and arguments from `start` and beyond provided as an array.
+ * created function and arguments from `start` and beyond provided as
+ * an array.
*
- * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).
+ * **Note:** This method is based on the
+ * [rest parameter](https://mdn.io/rest_parameters).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Function
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
diff --git a/result.js b/result.js
index b53e79f09..f6d0bbb5d 100644
--- a/result.js
+++ b/result.js
@@ -1,20 +1,19 @@
import baseCastPath from './_baseCastPath';
-import get from './get';
import isFunction from './isFunction';
import isKey from './_isKey';
-import parent from './_parent';
/**
- * This method is like `_.get` except that if the resolved value is a function
- * it's invoked with the `this` binding of its parent object and its result
- * is returned.
+ * This method is like `_.get` except that if the resolved value is a
+ * function it's invoked with the `this` binding of its parent object and
+ * its result is returned.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to resolve.
- * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
+ * @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
@@ -33,17 +32,25 @@ import parent from './_parent';
* // => 'default'
*/
function result(object, path, defaultValue) {
- if (!isKey(path, object)) {
- path = baseCastPath(path);
- var result = get(object, path);
- object = parent(object, path);
- } else {
- result = object == null ? undefined : object[path];
+ path = isKey(path, object) ? [path] : baseCastPath(path);
+
+ var index = -1,
+ length = path.length;
+
+ // Ensure the loop is entered when path is empty.
+ if (!length) {
+ object = undefined;
+ length = 1;
}
- if (result === undefined) {
- result = defaultValue;
+ while (++index < length) {
+ var value = object == null ? undefined : object[path[index]];
+ if (value === undefined) {
+ index = length;
+ value = defaultValue;
+ }
+ object = isFunction(value) ? value.call(object) : value;
}
- return isFunction(result) ? result.call(object) : result;
+ return object;
}
export default result;
diff --git a/reverse.js b/reverse.js
index 73b8678f3..59779480d 100644
--- a/reverse.js
+++ b/reverse.js
@@ -13,7 +13,9 @@ var nativeReverse = arrayProto.reverse;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
+ * @param {Array} array The array to modify.
* @returns {Array} Returns `array`.
* @example
*
diff --git a/round.js b/round.js
index e10c05605..82d871a13 100644
--- a/round.js
+++ b/round.js
@@ -5,6 +5,7 @@ import createRound from './_createRound';
*
* @static
* @memberOf _
+ * @since 3.10.0
* @category Math
* @param {number} number The number to round.
* @param {number} [precision=0] The precision to round to.
diff --git a/sample.js b/sample.js
index 1f4159335..5f77a82f1 100644
--- a/sample.js
+++ b/sample.js
@@ -7,6 +7,7 @@ import values from './values';
*
* @static
* @memberOf _
+ * @since 2.0.0
* @category Collection
* @param {Array|Object} collection The collection to sample.
* @returns {*} Returns the random element.
diff --git a/sampleSize.js b/sampleSize.js
index 3db5e78c6..fcb4f0219 100644
--- a/sampleSize.js
+++ b/sampleSize.js
@@ -9,6 +9,7 @@ import toInteger from './toInteger';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to sample.
* @param {number} [n=0] The number of elements to sample.
diff --git a/seq.default.js b/seq.default.js
index 811dc0724..b1f0ddeba 100644
--- a/seq.default.js
+++ b/seq.default.js
@@ -1,7 +1,6 @@
import at from './wrapperAt';
import chain from './chain';
import commit from './commit';
-import flatMap from './wrapperFlatMap';
import lodash from './wrapperLodash';
import next from './next';
import plant from './plant';
@@ -15,7 +14,7 @@ import valueOf from './valueOf';
import wrapperChain from './wrapperChain';
export default {
- at, chain, commit, flatMap, lodash,
- next, plant, reverse, tap, thru,
- toIterator, toJSON, value, valueOf, wrapperChain
+ at, chain, commit, lodash, next,
+ plant, reverse, tap, thru, toIterator,
+ toJSON, value, valueOf, wrapperChain
};
diff --git a/seq.js b/seq.js
index 9dfa5d89f..2719ac61d 100644
--- a/seq.js
+++ b/seq.js
@@ -1,7 +1,6 @@
export { default as at } from './wrapperAt';
export { default as chain } from './chain';
export { default as commit } from './commit';
-export { default as flatMap } from './wrapperFlatMap';
export { default as lodash } from './wrapperLodash';
export { default as next } from './next';
export { default as plant } from './plant';
diff --git a/set.js b/set.js
index 2451ce939..967d2030b 100644
--- a/set.js
+++ b/set.js
@@ -10,6 +10,7 @@ import baseSet from './_baseSet';
*
* @static
* @memberOf _
+ * @since 3.7.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
diff --git a/setWith.js b/setWith.js
index 1baaa6e06..1df7be068 100644
--- a/setWith.js
+++ b/setWith.js
@@ -10,6 +10,7 @@ import baseSet from './_baseSet';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
diff --git a/shuffle.js b/shuffle.js
index acad96c5a..934253f08 100644
--- a/shuffle.js
+++ b/shuffle.js
@@ -9,6 +9,7 @@ var MAX_ARRAY_LENGTH = 4294967295;
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to shuffle.
* @returns {Array} Returns the new shuffled array.
diff --git a/size.js b/size.js
index bcce92113..f298a48a5 100644
--- a/size.js
+++ b/size.js
@@ -1,14 +1,21 @@
+import getTag from './_getTag';
import isArrayLike from './isArrayLike';
+import isObjectLike from './isObjectLike';
import isString from './isString';
import keys from './keys';
import stringSize from './_stringSize';
+/** `Object#toString` result references. */
+var mapTag = '[object Map]',
+ setTag = '[object Set]';
+
/**
* Gets the size of `collection` by returning its length for array-like
- * values or the number of own enumerable properties for objects.
+ * values or the number of own enumerable string keyed properties for objects.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to inspect.
* @returns {number} Returns the collection size.
@@ -31,6 +38,12 @@ function size(collection) {
var result = collection.length;
return (result && isString(collection)) ? stringSize(collection) : result;
}
+ if (isObjectLike(collection)) {
+ var tag = getTag(collection);
+ if (tag == mapTag || tag == setTag) {
+ return collection.size;
+ }
+ }
return keys(collection).length;
}
diff --git a/slice.js b/slice.js
index f7fc8eb10..f62fbbb0d 100644
--- a/slice.js
+++ b/slice.js
@@ -5,11 +5,13 @@ import toInteger from './toInteger';
/**
* Creates a slice of `array` from `start` up to, but not including, `end`.
*
- * **Note:** This method is used instead of [`Array#slice`](https://mdn.io/Array/slice)
- * to ensure dense arrays are returned.
+ * **Note:** This method is used instead of
+ * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
+ * returned.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
diff --git a/snakeCase.js b/snakeCase.js
index f067357a4..b74f1f7b2 100644
--- a/snakeCase.js
+++ b/snakeCase.js
@@ -1,10 +1,12 @@
import createCompounder from './_createCompounder';
/**
- * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).
+ * Converts `string` to
+ * [snake case](https://en.wikipedia.org/wiki/Snake_case).
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the snake cased string.
@@ -16,7 +18,7 @@ import createCompounder from './_createCompounder';
* _.snakeCase('fooBar');
* // => 'foo_bar'
*
- * _.snakeCase('--foo-bar');
+ * _.snakeCase('--FOO-BAR--');
* // => 'foo_bar'
*/
var snakeCase = createCompounder(function(result, word, index) {
diff --git a/some.js b/some.js
index da97a5a8f..b45361826 100644
--- a/some.js
+++ b/some.js
@@ -11,11 +11,14 @@ import isIterateeCall from './_isIterateeCall';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
- * @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
+ * else `false`.
* @example
*
* _.some([null, 0, 'yes', false], Boolean);
diff --git a/sortBy.js b/sortBy.js
index 2008cbf51..437061904 100644
--- a/sortBy.js
+++ b/sortBy.js
@@ -11,30 +11,32 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {...(Function|Function[]|Object|Object[]|string|string[])} [iteratees=[_.identity]]
- * The iteratees to sort by, specified individually or in arrays.
+ * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
+ * [iteratees=[_.identity]] The iteratees to sort by, specified individually
+ * or in arrays.
* @returns {Array} Returns the new sorted array.
* @example
*
* var users = [
* { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 42 },
+ * { 'user': 'fred', 'age': 40 },
* { 'user': 'barney', 'age': 34 }
* ];
*
* _.sortBy(users, function(o) { return o.user; });
- * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*
* _.sortBy(users, ['user', 'age']);
- * // => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
+ * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
*
* _.sortBy(users, 'user', function(o) {
* return Math.floor(o.age / 10);
* });
- * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*/
var sortBy = rest(function(collection, iteratees) {
if (collection == null) {
diff --git a/sortedIndex.js b/sortedIndex.js
index 5e90a8ff2..fd4ee43e8 100644
--- a/sortedIndex.js
+++ b/sortedIndex.js
@@ -1,15 +1,17 @@
import baseSortedIndex from './_baseSortedIndex';
/**
- * Uses a binary search to determine the lowest index at which `value` should
- * be inserted into `array` in order to maintain its sort order.
+ * Uses a binary search to determine the lowest index at which `value`
+ * should be inserted into `array` in order to maintain its sort order.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @returns {number} Returns the index at which `value` should be inserted into `array`.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
* @example
*
* _.sortedIndex([30, 50], 40);
diff --git a/sortedIndexBy.js b/sortedIndexBy.js
index 91e05e980..ab4d80965 100644
--- a/sortedIndexBy.js
+++ b/sortedIndexBy.js
@@ -8,11 +8,14 @@ import baseSortedIndexBy from './_baseSortedIndexBy';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {number} Returns the index at which `value` should be inserted into `array`.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
* @example
*
* var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };
diff --git a/sortedIndexOf.js b/sortedIndexOf.js
index 29971e358..f48bbf17f 100644
--- a/sortedIndexOf.js
+++ b/sortedIndexOf.js
@@ -7,6 +7,7 @@ import eq from './eq';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to search.
* @param {*} value The value to search for.
diff --git a/sortedLastIndex.js b/sortedLastIndex.js
index 97cb659b9..982b44b51 100644
--- a/sortedLastIndex.js
+++ b/sortedLastIndex.js
@@ -7,10 +7,12 @@ import baseSortedIndex from './_baseSortedIndex';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @returns {number} Returns the index at which `value` should be inserted into `array`.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
* @example
*
* _.sortedLastIndex([4, 5], 4);
diff --git a/sortedLastIndexBy.js b/sortedLastIndexBy.js
index 331cfcae8..6cc076a22 100644
--- a/sortedLastIndexBy.js
+++ b/sortedLastIndexBy.js
@@ -8,11 +8,14 @@ import baseSortedIndexBy from './_baseSortedIndexBy';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
- * @returns {number} Returns the index at which `value` should be inserted into `array`.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
* @example
*
* // The `_.property` iteratee shorthand.
diff --git a/sortedLastIndexOf.js b/sortedLastIndexOf.js
index f05e54318..fbbc52968 100644
--- a/sortedLastIndexOf.js
+++ b/sortedLastIndexOf.js
@@ -7,6 +7,7 @@ import eq from './eq';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to search.
* @param {*} value The value to search for.
diff --git a/sortedUniq.js b/sortedUniq.js
index 1b8e45e7a..6bd06a41b 100644
--- a/sortedUniq.js
+++ b/sortedUniq.js
@@ -6,6 +6,7 @@ import baseSortedUniq from './_baseSortedUniq';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
diff --git a/sortedUniqBy.js b/sortedUniqBy.js
index 1a85bba14..161f8f8a6 100644
--- a/sortedUniqBy.js
+++ b/sortedUniqBy.js
@@ -7,6 +7,7 @@ import baseSortedUniqBy from './_baseSortedUniqBy';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
diff --git a/split.js b/split.js
index 94b7cf603..30640a6ec 100644
--- a/split.js
+++ b/split.js
@@ -3,10 +3,12 @@ import toString from './toString';
/**
* Splits `string` by `separator`.
*
- * **Note:** This method is based on [`String#split`](https://mdn.io/String/split).
+ * **Note:** This method is based on
+ * [`String#split`](https://mdn.io/String/split).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to split.
* @param {RegExp|string} separator The separator pattern to split by.
diff --git a/spread.js b/spread.js
index 5dd8fe606..69fdfbcd2 100644
--- a/spread.js
+++ b/spread.js
@@ -10,13 +10,16 @@ var FUNC_ERROR_TEXT = 'Expected a function';
var nativeMax = Math.max;
/**
- * Creates a function that invokes `func` with the `this` binding of the created
- * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3).
+ * Creates a function that invokes `func` with the `this` binding of the
+ * create function and an array of arguments much like
+ * [`Function#apply`](https://es5.github.io/#x15.3.4.3).
*
- * **Note:** This method is based on the [spread operator](https://mdn.io/spread_operator).
+ * **Note:** This method is based on the
+ * [spread operator](https://mdn.io/spread_operator).
*
* @static
* @memberOf _
+ * @since 3.2.0
* @category Function
* @param {Function} func The function to spread arguments over.
* @param {number} [start=0] The start position of the spread.
diff --git a/startCase.js b/startCase.js
index 320ce23db..806119b05 100644
--- a/startCase.js
+++ b/startCase.js
@@ -1,27 +1,29 @@
-import capitalize from './capitalize';
import createCompounder from './_createCompounder';
+import upperFirst from './upperFirst';
/**
- * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
+ * Converts `string` to
+ * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
*
* @static
* @memberOf _
+ * @since 3.1.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the start cased string.
* @example
*
- * _.startCase('--foo-bar');
+ * _.startCase('--foo-bar--');
* // => 'Foo Bar'
*
* _.startCase('fooBar');
* // => 'Foo Bar'
*
- * _.startCase('__foo_bar__');
- * // => 'Foo Bar'
+ * _.startCase('__FOO_BAR__');
+ * // => 'FOO BAR'
*/
var startCase = createCompounder(function(result, word, index) {
- return result + (index ? ' ' : '') + capitalize(word);
+ return result + (index ? ' ' : '') + upperFirst(word);
});
export default startCase;
diff --git a/startsWith.js b/startsWith.js
index 49768d1d1..9e9689a65 100644
--- a/startsWith.js
+++ b/startsWith.js
@@ -7,11 +7,13 @@ import toString from './toString';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to search.
* @param {string} [target] The string to search for.
* @param {number} [position=0] The position to search from.
- * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`.
+ * @returns {boolean} Returns `true` if `string` starts with `target`,
+ * else `false`.
* @example
*
* _.startsWith('abc', 'a');
diff --git a/subtract.js b/subtract.js
index deff9970c..b9236aea9 100644
--- a/subtract.js
+++ b/subtract.js
@@ -1,8 +1,11 @@
+import createMathOperation from './_createMathOperation';
+
/**
* Subtract two numbers.
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Math
* @param {number} minuend The first number in a subtraction.
* @param {number} subtrahend The second number in a subtraction.
@@ -12,18 +15,8 @@
* _.subtract(6, 4);
* // => 2
*/
-function subtract(minuend, subtrahend) {
- var result;
- if (minuend === undefined && subtrahend === undefined) {
- return 0;
- }
- if (minuend !== undefined) {
- result = minuend;
- }
- if (subtrahend !== undefined) {
- result = result === undefined ? subtrahend : (result - subtrahend);
- }
- return result;
-}
+var subtract = createMathOperation(function(minuend, subtrahend) {
+ return minuend - subtrahend;
+});
export default subtract;
diff --git a/sum.js b/sum.js
index 47cdab263..079c4e7aa 100644
--- a/sum.js
+++ b/sum.js
@@ -6,6 +6,7 @@ import identity from './identity';
*
* @static
* @memberOf _
+ * @since 3.4.0
* @category Math
* @param {Array} array The array to iterate over.
* @returns {number} Returns the sum.
diff --git a/sumBy.js b/sumBy.js
index 276c0b591..0aba97f41 100644
--- a/sumBy.js
+++ b/sumBy.js
@@ -8,9 +8,11 @@ import baseSum from './_baseSum';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {number} Returns the sum.
* @example
*
diff --git a/tail.js b/tail.js
index cf3dcc6ef..905db6c0f 100644
--- a/tail.js
+++ b/tail.js
@@ -5,6 +5,7 @@ import drop from './drop';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to query.
* @returns {Array} Returns the slice of `array`.
diff --git a/take.js b/take.js
index ca6d228b1..0f851561c 100644
--- a/take.js
+++ b/take.js
@@ -6,10 +6,11 @@ import toInteger from './toInteger';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to take.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/takeRight.js b/takeRight.js
index 61a91afc2..25554ca1d 100644
--- a/takeRight.js
+++ b/takeRight.js
@@ -6,10 +6,11 @@ import toInteger from './toInteger';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to take.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/takeRightWhile.js b/takeRightWhile.js
index c619cb930..748e9721c 100644
--- a/takeRightWhile.js
+++ b/takeRightWhile.js
@@ -3,14 +3,16 @@ import baseWhile from './_baseWhile';
/**
* Creates a slice of `array` with elements taken from the end. Elements are
- * taken until `predicate` returns falsey. The predicate is invoked with three
- * arguments: (value, index, array).
+ * taken until `predicate` returns falsey. The predicate is invoked with
+ * three arguments: (value, index, array).
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/takeWhile.js b/takeWhile.js
index f14502159..44f970e8c 100644
--- a/takeWhile.js
+++ b/takeWhile.js
@@ -8,9 +8,11 @@ import baseWhile from './_baseWhile';
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Function|Object|string} [predicate=_.identity] The function invoked per iteration.
+ * @param {Array|Function|Object|string} [predicate=_.identity]
+ * The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
diff --git a/tap.js b/tap.js
index 645b28905..464367c30 100644
--- a/tap.js
+++ b/tap.js
@@ -1,10 +1,11 @@
/**
* This method invokes `interceptor` and returns `value`. The interceptor
* is invoked with one argument; (value). The purpose of this method is to
- * "tap into" a method chain in order to modify intermediate results.
+ * "tap into" a method chain sequence in order to modify intermediate results.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Seq
* @param {*} value The value to provide to `interceptor`.
* @param {Function} interceptor The function to invoke.
diff --git a/template.js b/template.js
index e9880070b..7bcce914f 100644
--- a/template.js
+++ b/template.js
@@ -42,17 +42,24 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
* [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category String
* @param {string} [string=''] The template string.
- * @param {Object} [options] The options object.
- * @param {RegExp} [options.escape] The HTML "escape" delimiter.
- * @param {RegExp} [options.evaluate] The "evaluate" delimiter.
- * @param {Object} [options.imports] An object to import into the template as free variables.
- * @param {RegExp} [options.interpolate] The "interpolate" delimiter.
- * @param {string} [options.sourceURL] The sourceURL of the template's compiled source.
- * @param {string} [options.variable] The data object variable name.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param {Object} [options={}] The options object.
+ * @param {RegExp} [options.escape=_.templateSettings.escape]
+ * The HTML "escape" delimiter.
+ * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
+ * The "evaluate" delimiter.
+ * @param {Object} [options.imports=_.templateSettings.imports]
+ * An object to import into the template as free variables.
+ * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
+ * The "interpolate" delimiter.
+ * @param {string} [options.sourceURL='templateSources[n]']
+ * The sourceURL of the compiled template.
+ * @param {string} [options.variable='obj']
+ * The data object variable name.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the compiled template function.
* @example
*
@@ -101,7 +108,7 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
* // Use the `sourceURL` option to specify a custom sourceURL for the template.
* var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
* compiled(data);
- * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
+ * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
*
* // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
@@ -121,7 +128,8 @@ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
* ');
*/
function template(string, options, guard) {
- // Based on John Resig's `tmpl` implementation (http://ejohn.org/blog/javascript-micro-templating/)
+ // Based on John Resig's `tmpl` implementation
+ // (http://ejohn.org/blog/javascript-micro-templating/)
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
var settings = templateSettings.imports._.templateSettings || templateSettings;
diff --git a/throttle.js b/throttle.js
index a5285a1c0..cc0c7f324 100644
--- a/throttle.js
+++ b/throttle.js
@@ -14,23 +14,24 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* throttled function. Subsequent calls to the throttled function return the
* result of the last `func` invocation.
*
- * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
- * on the trailing edge of the timeout only if the throttled function is
- * invoked more than once during the `wait` timeout.
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
+ * invoked on the trailing edge of the timeout only if the throttled function
+ * is invoked more than once during the `wait` timeout.
*
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
* for details over the differences between `_.throttle` and `_.debounce`.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {Function} func The function to throttle.
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
- * @param {Object} [options] The options object.
- * @param {boolean} [options.leading=true] Specify invoking on the leading
- * edge of the timeout.
- * @param {boolean} [options.trailing=true] Specify invoking on the trailing
- * edge of the timeout.
+ * @param {Object} [options={}] The options object.
+ * @param {boolean} [options.leading=true]
+ * Specify invoking on the leading edge of the timeout.
+ * @param {boolean} [options.trailing=true]
+ * Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new throttled function.
* @example
*
diff --git a/thru.js b/thru.js
index 737689a4b..22847e184 100644
--- a/thru.js
+++ b/thru.js
@@ -1,10 +1,11 @@
/**
* This method is like `_.tap` except that it returns the result of `interceptor`.
* The purpose of this method is to "pass thru" values replacing intermediate
- * results in a method chain.
+ * results in a method chain sequence.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Seq
* @param {*} value The value to provide to `interceptor`.
* @param {Function} interceptor The function to invoke.
diff --git a/times.js b/times.js
index 33bb868d9..ea404f5e2 100644
--- a/times.js
+++ b/times.js
@@ -1,4 +1,4 @@
-import baseCastFunction from './_baseCastFunction';
+import baseIteratee from './_baseIteratee';
import baseTimes from './_baseTimes';
import toInteger from './toInteger';
@@ -16,6 +16,7 @@ var nativeMin = Math.min;
* each invocation. The iteratee is invoked with one argument; (index).
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {number} n The number of times to invoke `iteratee`.
@@ -37,7 +38,7 @@ function times(n, iteratee) {
var index = MAX_ARRAY_LENGTH,
length = nativeMin(n, MAX_ARRAY_LENGTH);
- iteratee = baseCastFunction(iteratee);
+ iteratee = baseIteratee(iteratee);
n -= MAX_ARRAY_LENGTH;
var result = baseTimes(length, iteratee);
diff --git a/toArray.js b/toArray.js
index 559383e98..1dd27ee67 100644
--- a/toArray.js
+++ b/toArray.js
@@ -20,6 +20,7 @@ var iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'sym
* Converts `value` to an array.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to convert.
diff --git a/toInteger.js b/toInteger.js
index 879ef02fa..f563e03f2 100644
--- a/toInteger.js
+++ b/toInteger.js
@@ -7,10 +7,12 @@ var INFINITY = 1 / 0,
/**
* Converts `value` to an integer.
*
- * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
+ * **Note:** This function is loosely based on
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
diff --git a/toIterator.js b/toIterator.js
index c05ecf91d..54dacf95c 100644
--- a/toIterator.js
+++ b/toIterator.js
@@ -3,6 +3,7 @@
*
* @name Symbol.iterator
* @memberOf _
+ * @since 4.0.0
* @category Seq
* @returns {Object} Returns the wrapper object.
* @example
diff --git a/toLength.js b/toLength.js
index 7af01ad68..395cb5ae7 100644
--- a/toLength.js
+++ b/toLength.js
@@ -8,10 +8,12 @@ var MAX_ARRAY_LENGTH = 4294967295;
* Converts `value` to an integer suitable for use as the length of an
* array-like object.
*
- * **Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+ * **Note:** This method is based on
+ * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
diff --git a/toLower.js b/toLower.js
index c3e7270be..7713785b7 100644
--- a/toLower.js
+++ b/toLower.js
@@ -6,13 +6,14 @@ import toString from './toString';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the lower cased string.
* @example
*
- * _.toLower('--Foo-Bar');
- * // => '--foo-bar'
+ * _.toLower('--Foo-Bar--');
+ * // => '--foo-bar--'
*
* _.toLower('fooBar');
* // => 'foobar'
diff --git a/toNumber.js b/toNumber.js
index ba7d85b49..b0f0816d1 100644
--- a/toNumber.js
+++ b/toNumber.js
@@ -1,5 +1,6 @@
import isFunction from './isFunction';
import isObject from './isObject';
+import isSymbol from './isSymbol';
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
@@ -24,6 +25,7 @@ var freeParseInt = parseInt;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
@@ -42,12 +44,18 @@ var freeParseInt = parseInt;
* // => 3
*/
function toNumber(value) {
+ if (typeof value == 'number') {
+ return value;
+ }
+ if (isSymbol(value)) {
+ return NAN;
+ }
if (isObject(value)) {
var other = isFunction(value.valueOf) ? value.valueOf() : value;
value = isObject(other) ? (other + '') : other;
}
if (typeof value != 'string') {
- return value === 0 ? value : +value;
+ return value === 0 ? value : +value;
}
value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value);
diff --git a/toPairs.js b/toPairs.js
index 0ee750ecc..2fe0d05ed 100644
--- a/toPairs.js
+++ b/toPairs.js
@@ -2,11 +2,13 @@ import baseToPairs from './_baseToPairs';
import keys from './keys';
/**
- * Creates an array of own enumerable key-value pairs for `object` which
- * can be consumed by `_.fromPairs`.
+ * Creates an array of own enumerable string keyed-value pairs for `object`
+ * which can be consumed by `_.fromPairs`.
*
* @static
* @memberOf _
+ * @since 4.0.0
+ * @alias entries
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the new array of key-value pairs.
diff --git a/toPairsIn.js b/toPairsIn.js
index f8f1ac189..dad440d07 100644
--- a/toPairsIn.js
+++ b/toPairsIn.js
@@ -2,11 +2,13 @@ import baseToPairs from './_baseToPairs';
import keysIn from './keysIn';
/**
- * Creates an array of own and inherited enumerable key-value pairs for
- * `object` which can be consumed by `_.fromPairs`.
+ * Creates an array of own and inherited enumerable string keyed-value pairs
+ * for `object` which can be consumed by `_.fromPairs`.
*
* @static
* @memberOf _
+ * @since 4.0.0
+ * @alias entriesIn
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the new array of key-value pairs.
diff --git a/toPath.js b/toPath.js
index 03a6db89f..4d5faee08 100644
--- a/toPath.js
+++ b/toPath.js
@@ -1,5 +1,8 @@
import arrayMap from './_arrayMap';
+import baseCastKey from './_baseCastKey';
+import copyArray from './_copyArray';
import isArray from './isArray';
+import isSymbol from './isSymbol';
import stringToPath from './_stringToPath';
/**
@@ -7,6 +10,7 @@ import stringToPath from './_stringToPath';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Util
* @param {*} value The value to convert.
* @returns {Array} Returns the new property path array.
@@ -28,7 +32,10 @@ import stringToPath from './_stringToPath';
* // => false
*/
function toPath(value) {
- return isArray(value) ? arrayMap(value, String) : stringToPath(value);
+ if (isArray(value)) {
+ return arrayMap(value, baseCastKey);
+ }
+ return isSymbol(value) ? [value] : copyArray(stringToPath(value));
}
export default toPath;
diff --git a/toPlainObject.js b/toPlainObject.js
index c5b2852ee..a9ec333a9 100644
--- a/toPlainObject.js
+++ b/toPlainObject.js
@@ -2,11 +2,12 @@ import copyObject from './_copyObject';
import keysIn from './keysIn';
/**
- * Converts `value` to a plain object flattening inherited enumerable
- * properties of `value` to own properties of the plain object.
+ * Converts `value` to a plain object flattening inherited enumerable string
+ * keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
diff --git a/toSafeInteger.js b/toSafeInteger.js
index 1260235e7..f333275cc 100644
--- a/toSafeInteger.js
+++ b/toSafeInteger.js
@@ -10,6 +10,7 @@ var MAX_SAFE_INTEGER = 9007199254740991;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
diff --git a/toString.js b/toString.js
index 0e289b708..989b014a7 100644
--- a/toString.js
+++ b/toString.js
@@ -14,6 +14,7 @@ var symbolProto = Symbol ? Symbol.prototype : undefined,
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
diff --git a/toUpper.js b/toUpper.js
index d06e55a21..5435d0d2e 100644
--- a/toUpper.js
+++ b/toUpper.js
@@ -6,13 +6,14 @@ import toString from './toString';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the upper cased string.
* @example
*
- * _.toUpper('--foo-bar');
- * // => '--FOO-BAR'
+ * _.toUpper('--foo-bar--');
+ * // => '--FOO-BAR--'
*
* _.toUpper('fooBar');
* // => 'FOOBAR'
diff --git a/transform.js b/transform.js
index 9f769ecf3..c2e00473f 100644
--- a/transform.js
+++ b/transform.js
@@ -2,24 +2,23 @@ import arrayEach from './_arrayEach';
import baseCreate from './_baseCreate';
import baseForOwn from './_baseForOwn';
import baseIteratee from './_baseIteratee';
+import getPrototype from './_getPrototype';
import isArray from './isArray';
import isFunction from './isFunction';
import isObject from './isObject';
import isTypedArray from './isTypedArray';
-/** Built-in value references. */
-var getPrototypeOf = Object.getPrototypeOf;
-
/**
* An alternative to `_.reduce`; this method transforms `object` to a new
* `accumulator` object which is the result of running each of its own enumerable
- * properties through `iteratee`, with each invocation potentially mutating
- * the `accumulator` object. The iteratee is invoked with four arguments:
+ * string keyed properties through `iteratee`, with each invocation potentially
+ * mutating the `accumulator` object. The iteratee is invoked with four arguments:
* (accumulator, value, key, object). Iteratee functions may exit iteration
* early by explicitly returning `false`.
*
* @static
* @memberOf _
+ * @since 1.3.0
* @category Object
* @param {Array|Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
@@ -48,7 +47,7 @@ function transform(object, iteratee, accumulator) {
if (isArr) {
accumulator = isArray(object) ? new Ctor : [];
} else {
- accumulator = isFunction(Ctor) ? baseCreate(getPrototypeOf(object)) : {};
+ accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
}
} else {
accumulator = {};
diff --git a/trim.js b/trim.js
index f70895b06..eff4ec95f 100644
--- a/trim.js
+++ b/trim.js
@@ -11,10 +11,11 @@ var reTrim = /^\s+|\s+$/g;
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
diff --git a/trimEnd.js b/trimEnd.js
index ab2d1f3f2..6eef62b7b 100644
--- a/trimEnd.js
+++ b/trimEnd.js
@@ -10,10 +10,11 @@ var reTrimEnd = /\s+$/;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
diff --git a/trimStart.js b/trimStart.js
index 7f40935f9..26b9395a1 100644
--- a/trimStart.js
+++ b/trimStart.js
@@ -10,10 +10,11 @@ var reTrimStart = /^\s+/;
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
diff --git a/truncate.js b/truncate.js
index 9e4c689fd..f93ae1e2d 100644
--- a/truncate.js
+++ b/truncate.js
@@ -31,9 +31,10 @@ var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to truncate.
- * @param {Object} [options=({})] The options object.
+ * @param {Object} [options={}] The options object.
* @param {number} [options.length=30] The maximum string length.
* @param {string} [options.omission='...'] The string to indicate text is omitted.
* @param {RegExp|string} [options.separator] The separator pattern to truncate to.
diff --git a/unary.js b/unary.js
index e92aba57e..8d6c946d9 100644
--- a/unary.js
+++ b/unary.js
@@ -6,6 +6,7 @@ import ary from './ary';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Function
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new function.
diff --git a/unescape.js b/unescape.js
index c0eb8172b..07e207047 100644
--- a/unescape.js
+++ b/unescape.js
@@ -7,14 +7,15 @@ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
/**
* The inverse of `_.escape`; this method converts the HTML entities
- * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to their
- * corresponding characters.
+ * `&`, `<`, `>`, `"`, `'`, and ``` in `string` to
+ * their corresponding characters.
*
- * **Note:** No other HTML entities are unescaped. To unescape additional HTML
- * entities use a third-party library like [_he_](https://mths.be/he).
+ * **Note:** No other HTML entities are unescaped. To unescape additional
+ * HTML entities use a third-party library like [_he_](https://mths.be/he).
*
* @static
* @memberOf _
+ * @since 0.6.0
* @category String
* @param {string} [string=''] The string to unescape.
* @returns {string} Returns the unescaped string.
diff --git a/union.js b/union.js
index bc3d5e70d..9699a0f55 100644
--- a/union.js
+++ b/union.js
@@ -9,6 +9,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of combined values.
diff --git a/unionBy.js b/unionBy.js
index bd547cddd..f8b44b76c 100644
--- a/unionBy.js
+++ b/unionBy.js
@@ -7,14 +7,17 @@ import rest from './rest';
/**
* This method is like `_.union` except that it accepts `iteratee` which is
- * invoked for each element of each `arrays` to generate the criterion by which
- * uniqueness is computed. The iteratee is invoked with one argument: (value).
+ * invoked for each element of each `arrays` to generate the criterion by
+ * which uniqueness is computed. The iteratee is invoked with one argument:
+ * (value).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns the new array of combined values.
* @example
*
diff --git a/unionWith.js b/unionWith.js
index 4bf011dfc..efe002bdc 100644
--- a/unionWith.js
+++ b/unionWith.js
@@ -11,6 +11,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [comparator] The comparator invoked per element.
diff --git a/uniq.js b/uniq.js
index e378621c7..235a767cb 100644
--- a/uniq.js
+++ b/uniq.js
@@ -3,11 +3,12 @@ import baseUniq from './_baseUniq';
/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons, in which only the first occurrence of each element
- * is kept.
+ * for equality comparisons, in which only the first occurrence of each
+ * element is kept.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
diff --git a/uniqBy.js b/uniqBy.js
index 7e1b2e86b..789a91d1a 100644
--- a/uniqBy.js
+++ b/uniqBy.js
@@ -8,9 +8,11 @@ import baseUniq from './_baseUniq';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
* @example
*
diff --git a/uniqWith.js b/uniqWith.js
index f958a6cb1..87a48de09 100644
--- a/uniqWith.js
+++ b/uniqWith.js
@@ -7,6 +7,7 @@ import baseUniq from './_baseUniq';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {Function} [comparator] The comparator invoked per element.
diff --git a/uniqueId.js b/uniqueId.js
index 7ae814e5e..a1d9002fd 100644
--- a/uniqueId.js
+++ b/uniqueId.js
@@ -7,6 +7,7 @@ var idCounter = 0;
* Generates a unique ID. If `prefix` is given the ID is appended to it.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Util
* @param {string} [prefix=''] The value to prefix the ID with.
diff --git a/unset.js b/unset.js
index 97095a2f2..b2fd7f7a6 100644
--- a/unset.js
+++ b/unset.js
@@ -7,6 +7,7 @@ import baseUnset from './_baseUnset';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to unset.
diff --git a/unzip.js b/unzip.js
index 517fe2389..ca05ed827 100644
--- a/unzip.js
+++ b/unzip.js
@@ -14,6 +14,7 @@ var nativeMax = Math.max;
*
* @static
* @memberOf _
+ * @since 1.2.0
* @category Array
* @param {Array} array The array of grouped elements to process.
* @returns {Array} Returns the new array of regrouped elements.
diff --git a/unzipWith.js b/unzipWith.js
index 5e9355197..86de50289 100644
--- a/unzipWith.js
+++ b/unzipWith.js
@@ -9,9 +9,11 @@ import unzip from './unzip';
*
* @static
* @memberOf _
+ * @since 3.8.0
* @category Array
* @param {Array} array The array of grouped elements to process.
- * @param {Function} [iteratee=_.identity] The function to combine regrouped values.
+ * @param {Function} [iteratee=_.identity] The function to combine
+ * regrouped values.
* @returns {Array} Returns the new array of regrouped elements.
* @example
*
diff --git a/update.js b/update.js
index 8a6a22727..7a7b0a1f3 100644
--- a/update.js
+++ b/update.js
@@ -10,6 +10,7 @@ import baseUpdate from './_baseUpdate';
*
* @static
* @memberOf _
+ * @since 4.6.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
diff --git a/updateWith.js b/updateWith.js
index 0a9930fce..68a571db1 100644
--- a/updateWith.js
+++ b/updateWith.js
@@ -11,6 +11,7 @@ import baseUpdate from './_baseUpdate';
*
* @static
* @memberOf _
+ * @since 4.6.0
* @category Object
* @param {Object} object The object to modify.
* @param {Array|string} path The path of the property to set.
diff --git a/upperCase.js b/upperCase.js
index 801222aa2..1552f3887 100644
--- a/upperCase.js
+++ b/upperCase.js
@@ -5,6 +5,7 @@ import createCompounder from './_createCompounder';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the upper cased string.
diff --git a/upperFirst.js b/upperFirst.js
index 45d19f438..cc4372b98 100644
--- a/upperFirst.js
+++ b/upperFirst.js
@@ -5,6 +5,7 @@ import createCaseFirst from './_createCaseFirst';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the converted string.
diff --git a/values.js b/values.js
index 5b32b64e6..458273c3c 100644
--- a/values.js
+++ b/values.js
@@ -2,11 +2,12 @@ import baseValues from './_baseValues';
import keys from './keys';
/**
- * Creates an array of the own enumerable property values of `object`.
+ * Creates an array of the own enumerable string keyed property values of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
+ * @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
diff --git a/valuesIn.js b/valuesIn.js
index 3fa3a96f2..c88d0f852 100644
--- a/valuesIn.js
+++ b/valuesIn.js
@@ -2,12 +2,14 @@ import baseValues from './_baseValues';
import keysIn from './keysIn';
/**
- * Creates an array of the own and inherited enumerable property values of `object`.
+ * Creates an array of the own and inherited enumerable string keyed property
+ * values of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property values.
diff --git a/without.js b/without.js
index d59a29989..e8ad761ab 100644
--- a/without.js
+++ b/without.js
@@ -9,6 +9,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {Array} array The array to filter.
* @param {...*} [values] The values to exclude.
diff --git a/words.js b/words.js
index 110a8e7a4..65f297732 100644
--- a/words.js
+++ b/words.js
@@ -52,17 +52,18 @@ var reComplexWord = RegExp([
].join('|'), 'g');
/** Used to detect strings that need a more robust regexp to match words. */
-var reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
+var reHasComplexWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
/**
* Splits `string` into an array of its words.
*
* @static
* @memberOf _
+ * @since 3.0.0
* @category String
* @param {string} [string=''] The string to inspect.
* @param {RegExp|string} [pattern] The pattern to match words.
- * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
+ * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the words of `string`.
* @example
*
diff --git a/wrap.js b/wrap.js
index 397f64fb2..092811470 100644
--- a/wrap.js
+++ b/wrap.js
@@ -9,6 +9,7 @@ import partial from './partial';
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Function
* @param {*} value The value to wrap.
* @param {Function} [wrapper=identity] The wrapper function.
diff --git a/wrapperAt.js b/wrapperAt.js
index 0ff082544..4eee46c87 100644
--- a/wrapperAt.js
+++ b/wrapperAt.js
@@ -11,6 +11,7 @@ import thru from './thru';
*
* @name at
* @memberOf _
+ * @since 1.0.0
* @category Seq
* @param {...(string|string[])} [paths] The property paths of elements to pick,
* specified individually or in arrays.
diff --git a/wrapperChain.js b/wrapperChain.js
index 641262415..bfb7c5cc5 100644
--- a/wrapperChain.js
+++ b/wrapperChain.js
@@ -1,10 +1,11 @@
import chain from './chain';
/**
- * Enables explicit method chaining on the wrapper object.
+ * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
*
* @name chain
* @memberOf _
+ * @since 0.1.0
* @category Seq
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
diff --git a/wrapperFlatMap.js b/wrapperFlatMap.js
deleted file mode 100644
index aea6bd46b..000000000
--- a/wrapperFlatMap.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * This method is the wrapper version of `_.flatMap`.
- *
- * @name flatMap
- * @memberOf _
- * @category Seq
- * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns the new `lodash` wrapper instance.
- * @example
- *
- * function duplicate(n) {
- * return [n, n];
- * }
- *
- * _([1, 2]).flatMap(duplicate).value();
- * // => [1, 1, 2, 2]
- */
-function wrapperFlatMap(iteratee) {
- return this.map(iteratee).flatten();
-}
-
-export default wrapperFlatMap;
diff --git a/wrapperLodash.js b/wrapperLodash.js
index 8bab5c782..062adfa88 100644
--- a/wrapperLodash.js
+++ b/wrapperLodash.js
@@ -13,25 +13,25 @@ var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Creates a `lodash` object which wraps `value` to enable implicit method
- * chaining. Methods that operate on and return arrays, collections, and
- * functions can be chained together. Methods that retrieve a single value or
- * may return a primitive value will automatically end the chain sequence and
- * return the unwrapped value. Otherwise, the value must be unwrapped with
- * `_#value`.
+ * chain sequences. Methods that operate on and return arrays, collections,
+ * and functions can be chained together. Methods that retrieve a single value
+ * or may return a primitive value will automatically end the chain sequence
+ * and return the unwrapped value. Otherwise, the value must be unwrapped
+ * with `_#value`.
*
- * Explicit chaining, which must be unwrapped with `_#value` in all cases,
- * may be enabled using `_.chain`.
+ * Explicit chain sequences, which must be unwrapped with `_#value`, may be
+ * enabled using `_.chain`.
*
* The execution of chained methods is lazy, that is, it's deferred until
* `_#value` is implicitly or explicitly called.
*
- * Lazy evaluation allows several methods to support shortcut fusion. Shortcut
- * fusion is an optimization to merge iteratee calls; this avoids the creation
- * of intermediate arrays and can greatly reduce the number of iteratee executions.
- * Sections of a chain sequence qualify for shortcut fusion if the section is
- * applied to an array of at least two hundred elements and any iteratees
- * accept only one argument. The heuristic for whether a section qualifies
- * for shortcut fusion is subject to change.
+ * Lazy evaluation allows several methods to support shortcut fusion.
+ * Shortcut fusion is an optimization to merge iteratee calls; this avoids
+ * the creation of intermediate arrays and can greatly reduce the number of
+ * iteratee executions. Sections of a chain sequence qualify for shortcut
+ * fusion if the section is applied to an array of at least two hundred
+ * elements and any iteratees accept only one argument. The heuristic for
+ * whether a section qualifies for shortcut fusion is subject to change.
*
* Chaining is supported in custom builds as long as the `_#value` method is
* directly or indirectly included in the build.
@@ -56,48 +56,49 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
* `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
* `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
- * `flatten`, `flattenDeep`, `flattenDepth`, `flip`, `flow`, `flowRight`,
- * `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`, `intersection`,
- * `intersectionBy`, `intersectionWith`, `invert`, `invertBy`, `invokeMap`,
- * `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`,
- * `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, `method`,
- * `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`, `orderBy`,
- * `over`, `overArgs`, `overEvery`, `overSome`, `partial`, `partialRight`,
- * `partition`, `pick`, `pickBy`, `plant`, `property`, `propertyOf`, `pull`,
- * `pullAll`, `pullAllBy`, `pullAllWith`, `pullAt`, `push`, `range`,
- * `rangeRight`, `rearg`, `reject`, `remove`, `rest`, `reverse`, `sampleSize`,
- * `set`, `setWith`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `spread`,
- * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`,
- * `thru`, `toArray`, `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`,
- * `transform`, `unary`, `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`,
- * `uniqWith`, `unset`, `unshift`, `unzip`, `unzipWith`, `update`, `values`,
- * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, `zipObject`,
- * `zipObjectDeep`, and `zipWith`
+ * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
+ * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
+ * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
+ * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
+ * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
+ * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
+ * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
+ * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
+ * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
+ * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
+ * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
+ * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
+ * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
+ * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
+ * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
+ * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
+ * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
+ * `zipObject`, `zipObjectDeep`, and `zipWith`
*
* The wrapper methods that are **not** chainable by default are:
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
- * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `each`, `eachRight`,
- * `endsWith`, `eq`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
- * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `first`, `floor`,
- * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
- * `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`, `includes`,
- * `indexOf`, `inRange`, `invoke`, `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`,
- * `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`, `join`, `kebabCase`,
- * `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`,
- * `maxBy`, `mean`, `min`, `minBy`, `noConflict`, `noop`, `now`, `pad`,
- * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
- * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
- * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
- * `sortedLastIndexBy`, `startCase`, `startsWith`, `subtract`, `sum`, `sumBy`,
- * `template`, `times`, `toInteger`, `toJSON`, `toLength`, `toLower`,
- * `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, `trimEnd`,
- * `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, `upperFirst`,
- * `value`, and `words`
+ * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `divide`, `each`,
+ * `eachRight`, `endsWith`, `eq`, `escape`, `escapeRegExp`, `every`, `find`,
+ * `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `first`,
+ * `floor`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,
+ * `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`,
+ * `includes`, `indexOf`, `inRange`, `invoke`, `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`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,
+ * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,
+ * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`,
+ * `noConflict`, `noop`, `now`, `pad`, `padEnd`, `padStart`, `parseInt`,
+ * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
+ * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
+ * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
+ * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toInteger`,
+ * `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, `toString`,
+ * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`,
+ * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words`
*
* @name _
* @constructor
diff --git a/wrapperReverse.js b/wrapperReverse.js
index c53c5919b..bd93a2872 100644
--- a/wrapperReverse.js
+++ b/wrapperReverse.js
@@ -10,6 +10,7 @@ import thru from './thru';
*
* @name reverse
* @memberOf _
+ * @since 0.1.0
* @category Seq
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
diff --git a/wrapperValue.js b/wrapperValue.js
index c6ece5b56..99c38877c 100644
--- a/wrapperValue.js
+++ b/wrapperValue.js
@@ -1,10 +1,11 @@
import baseWrapperValue from './_baseWrapperValue';
/**
- * Executes the chained sequence to extract the unwrapped value.
+ * Executes the chain sequence to resolve the unwrapped value.
*
* @name value
* @memberOf _
+ * @since 0.1.0
* @alias toJSON, valueOf
* @category Seq
* @returns {*} Returns the resolved unwrapped value.
diff --git a/xor.js b/xor.js
index f89eea0eb..ecb2d861b 100644
--- a/xor.js
+++ b/xor.js
@@ -4,12 +4,14 @@ import isArrayLikeObject from './isArrayLikeObject';
import rest from './rest';
/**
- * 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 given arrays. The order of result values is determined by the order
* they occur in the arrays.
*
* @static
* @memberOf _
+ * @since 2.4.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of values.
diff --git a/xorBy.js b/xorBy.js
index c30ab224d..15e2c400a 100644
--- a/xorBy.js
+++ b/xorBy.js
@@ -7,14 +7,17 @@ import rest from './rest';
/**
* This method is like `_.xor` except that it accepts `iteratee` which is
- * invoked for each element of each `arrays` to generate the criterion by which
- * by which they're compared. The iteratee is invoked with one argument: (value).
+ * invoked for each element of each `arrays` to generate the criterion by
+ * which by which they're compared. The iteratee is invoked with one argument:
+ * (value).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
* @returns {Array} Returns the new array of values.
* @example
*
diff --git a/xorWith.js b/xorWith.js
index 7c4ee3376..1c5bc4f78 100644
--- a/xorWith.js
+++ b/xorWith.js
@@ -11,6 +11,7 @@ import rest from './rest';
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [comparator] The comparator invoked per element.
diff --git a/zip.js b/zip.js
index 90ee40fca..feec40589 100644
--- a/zip.js
+++ b/zip.js
@@ -2,12 +2,13 @@ import rest from './rest';
import unzip from './unzip';
/**
- * Creates an array of grouped elements, the first of which contains the first
- * elements of the given arrays, the second of which contains the second elements
- * of the given arrays, and so on.
+ * Creates an array of grouped elements, the first of which contains the
+ * first elements of the given arrays, the second of which contains the
+ * second elements of the given arrays, and so on.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to process.
* @returns {Array} Returns the new array of grouped elements.
diff --git a/zipObject.js b/zipObject.js
index 221acf49d..2faa0d01e 100644
--- a/zipObject.js
+++ b/zipObject.js
@@ -3,12 +3,13 @@ import baseZipObject from './_baseZipObject';
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
- * one of property names and one of corresponding values.
+ * one of property identifiers and one of corresponding values.
*
* @static
* @memberOf _
+ * @since 0.4.0
* @category Array
- * @param {Array} [props=[]] The property names.
+ * @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
diff --git a/zipObjectDeep.js b/zipObjectDeep.js
index 8118bcb17..d023b6064 100644
--- a/zipObjectDeep.js
+++ b/zipObjectDeep.js
@@ -6,8 +6,9 @@ import baseZipObject from './_baseZipObject';
*
* @static
* @memberOf _
+ * @since 4.1.0
* @category Array
- * @param {Array} [props=[]] The property names.
+ * @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
diff --git a/zipWith.js b/zipWith.js
index 36eda1a9e..25bf2e216 100644
--- a/zipWith.js
+++ b/zipWith.js
@@ -8,6 +8,7 @@ import unzipWith from './unzipWith';
*
* @static
* @memberOf _
+ * @since 3.8.0
* @category Array
* @param {...Array} [arrays] The arrays to process.
* @param {Function} [iteratee=_.identity] The function to combine grouped values.