diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index e12c9cdc5d..eab6b8f744 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -13,8 +13,8 @@ Feature requests should be submitted in the
[issue tracker](https://github.com/lodash/lodash/issues), with a description of
the expected behavior & use case, where they’ll remain closed until sufficient interest,
[e.g. :+1: reactions](https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/),
-has been shown by the community. Before submitting a request, please search for
-similar ones in the
+has been [shown by the community](https://github.com/lodash/lodash/issues?q=label%3A%22votes+needed%22+sort%3Areactions-%2B1-desc).
+Before submitting a request, please search for similar ones in the
[closed issues](https://github.com/lodash/lodash/issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement).
## Pull Requests
diff --git a/.gitignore b/.gitignore
index 6eb2db8763..56cc3a36dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,5 @@
.DS_Store
-*.custom.*
*.log
-*.map
-lodash.compat.min.js
coverage
node_modules
-.opt-in
-.opt-out
+doc/*.html
\ No newline at end of file
diff --git a/.markdown-doctest-setup.js b/.markdown-doctest-setup.js
index 4c9a22235e..d5fb204d27 100644
--- a/.markdown-doctest-setup.js
+++ b/.markdown-doctest-setup.js
@@ -25,7 +25,7 @@ module.exports = {
'batchLog': _.noop,
'calculateLayout': _.noop,
'createApplication': _.noop,
- 'data': { 'user': 'mock'},
+ 'data': { 'user': 'mock' },
'mainText': '',
'renewToken': _.noop,
'sendMail': _.noop,
diff --git a/README.md b/README.md
index 096c31d9ac..afba7a5d4b 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
-# lodash v4.13.1
+# lodash v4.14.0
[Site](https://lodash.com/) |
[Docs](https://lodash.com/docs) |
[FP Guide](https://github.com/lodash/lodash/wiki/FP-Guide) |
-[Contributing](https://github.com/lodash/lodash/blob/4.13.1/.github/CONTRIBUTING.md) |
+[Contributing](https://github.com/lodash/lodash/blob/master/.github/CONTRIBUTING.md) |
[Wiki](https://github.com/lodash/lodash/wiki "Changelog, Roadmap, etc.") |
[Code of Conduct](https://jquery.org/conduct/) |
[Twitter](https://twitter.com/bestiejs) |
@@ -20,11 +20,11 @@ $ lodash core -o ./dist/lodash.core.js
## Download
-Lodash is released under the [MIT license](https://raw.githubusercontent.com/lodash/lodash/4.13.1/LICENSE) & supports [modern environments](#support).
+Lodash is released under the [MIT license](https://raw.githubusercontent.com/lodash/lodash/4.14.0/LICENSE) & supports [modern environments](#support).
Review the [build differences](https://github.com/lodash/lodash/wiki/build-differences) & pick one that’s right for you.
- * [Core build](https://raw.githubusercontent.com/lodash/lodash/4.13.1/dist/lodash.core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.13.1/dist/lodash.core.min.js))
- * [Full build](https://raw.githubusercontent.com/lodash/lodash/4.13.1/dist/lodash.js) ([~22 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.13.1/dist/lodash.min.js))
+ * [Core build](https://raw.githubusercontent.com/lodash/lodash/4.14.0/dist/lodash.core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.14.0/dist/lodash.core.min.js))
+ * [Full build](https://raw.githubusercontent.com/lodash/lodash/4.14.0/dist/lodash.js) ([~22 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.14.0/dist/lodash.min.js))
* [CDN copies](https://www.jsdelivr.com/projects/lodash)
## Why Lodash?
@@ -41,6 +41,6 @@ numbers, objects, strings, etc. Lodash’s modular methods are great for:
Lodash is available in a [variety of builds](https://lodash.com/custom-builds) & module formats.
* [lodash](https://www.npmjs.com/package/lodash) & [per method packages](https://www.npmjs.com/browse/keyword/lodash-modularized)
+ * [lodash-es](https://www.npmjs.com/package/lodash-es), [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash), & [lodash-webpack-plugin](https://www.npmjs.com/package/lodash-webpack-plugin)
+ * [lodash/fp](https://github.com/lodash/lodash/tree/npm/fp)
* [lodash-amd](https://www.npmjs.com/package/lodash-amd)
- * [lodash-es](https://www.npmjs.com/package/lodash-es) & [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash)
- * [lodash/fp](https://github.com/lodash/lodash/tree/4.13.1-npm/fp)
diff --git a/dist/lodash.core.js b/dist/lodash.core.js
index 9b6092dd9c..44613ae9d5 100644
--- a/dist/lodash.core.js
+++ b/dist/lodash.core.js
@@ -13,12 +13,12 @@
var undefined;
/** Used as the semantic version number. */
- var VERSION = '4.13.1';
+ var VERSION = '4.14.0';
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
- /** Used to compose bitmasks for wrapper metadata. */
+ /** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1,
PARTIAL_FLAG = 32;
@@ -57,23 +57,20 @@
'`': '`'
};
- /** Detect free variable `exports`. */
- var freeExports = typeof exports == 'object' && exports;
-
- /** Detect free variable `module`. */
- var freeModule = freeExports && typeof module == 'object' && module;
-
/** Detect free variable `global` from Node.js. */
- var freeGlobal = checkGlobal(typeof global == 'object' && global);
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
- var freeSelf = checkGlobal(typeof self == 'object' && self);
-
- /** Detect `this` as the global object. */
- var thisGlobal = checkGlobal(typeof this == 'object' && this);
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || thisGlobal || Function('return this')();
+ var root = freeGlobal || freeSelf || Function('return this')();
+
+ /** Detect free variable `exports`. */
+ var freeExports = freeGlobal && typeof exports == 'object' && exports;
+
+ /** Detect free variable `module`. */
+ var freeModule = freeExports && typeof module == 'object' && module;
/*--------------------------------------------------------------------------*/
@@ -113,6 +110,32 @@
return -1;
}
+ /**
+ * The base implementation of `_.property` without support for deep paths.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function baseProperty(key) {
+ return function(object) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
+ /**
+ * The base implementation of `_.propertyOf` without support for deep paths.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function basePropertyOf(object) {
+ return function(key) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
/**
* The base implementation of `_.reduce` and `_.reduceRight`, without support
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
@@ -151,17 +174,6 @@
});
}
- /**
- * Checks if `value` is a global object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {null|Object} Returns `value` if it's a global object, else `null`.
- */
- function checkGlobal(value) {
- return (value && value.Object === Object) ? value : null;
- }
-
/**
* Used by `_.escape` to convert characters to HTML entities.
*
@@ -169,9 +181,7 @@
* @param {string} chr The matched character to escape.
* @returns {string} Returns the escaped character.
*/
- function escapeHtmlChar(chr) {
- return htmlEscapes[chr];
- }
+ var escapeHtmlChar = basePropertyOf(htmlEscapes);
/**
* Checks if `value` is a host object in IE < 9.
@@ -184,6 +194,20 @@
return false;
}
+ /**
+ * Creates a function that invokes `func` with its first argument transformed.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {Function} transform The argument transform.
+ * @returns {Function} Returns the new function.
+ */
+ function overArg(func, transform) {
+ return function(arg) {
+ return func(transform(arg));
+ };
+ }
+
/*--------------------------------------------------------------------------*/
/** Used for built-in method references. */
@@ -283,16 +307,16 @@
*
* The wrapper methods that are **not** chainable by default are:
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
- * `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`,
+ * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
+ * `defaultTo`, `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`,
@@ -407,13 +431,13 @@
}
/**
- * The base implementation of `_.delay` and `_.defer` which accepts an array
- * of `func` arguments.
+ * The base implementation of `_.delay` and `_.defer` which accepts `args`
+ * to provide to `func`.
*
* @private
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
- * @param {Object} args The arguments to provide to `func`.
+ * @param {Array} args The arguments to provide to `func`.
* @returns {number} Returns the timer id.
*/
function baseDelay(func, wait, args) {
@@ -573,7 +597,7 @@
}
/**
- * The base implementation of `_.gt` which doesn't coerce arguments to numbers.
+ * The base implementation of `_.gt` which doesn't coerce arguments.
*
* @private
* @param {*} value The value to compare.
@@ -585,6 +609,17 @@
return value > other;
}
+ /**
+ * The base implementation of `_.isDate` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+ */
+ function baseIsDate(value) {
+ return isObjectLike(value) && objectToString.call(value) == dateTag;
+ }
+
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
@@ -644,13 +679,17 @@
isSameTag = objTag == othTag;
stack || (stack = []);
- var stacked = find(stack, function(entry) {
- return entry[0] === object;
+ var objStack = find(stack, function(entry) {
+ return entry[0] == object;
+ });
+ var othStack = find(stack, function(entry) {
+ return entry[0] == other;
});
- if (stacked && stacked[1]) {
- return stacked[1] == other;
+ if (objStack && othStack) {
+ return objStack[1] == other;
}
stack.push([object, other]);
+ stack.push([other, object]);
if (isSameTag && !objIsObj) {
var result = (objIsArr)
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
@@ -679,6 +718,17 @@
return result;
}
+ /**
+ * The base implementation of `_.isRegExp` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
+ */
+ function baseIsRegExp(value) {
+ return isObject(value) && objectToString.call(value) == regexpTag;
+ }
+
/**
* The base implementation of `_.iteratee`.
*
@@ -704,9 +754,7 @@
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
- function baseKeys(object) {
- return nativeKeys(Object(object));
- }
+ var baseKeys = overArg(nativeKeys, Object);
/**
* The base implementation of `_.keysIn` which doesn't skip the constructor
@@ -727,7 +775,7 @@
}
/**
- * The base implementation of `_.lt` which doesn't coerce arguments to numbers.
+ * The base implementation of `_.lt` which doesn't coerce arguments.
*
* @private
* @param {*} value The value to compare.
@@ -804,15 +852,31 @@
}
/**
- * The base implementation of `_.property` without support for deep paths.
+ * The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new accessor 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.
+ * @returns {Function} Returns the new function.
*/
- function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
+ function baseRest(func, start) {
+ start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
+ return function() {
+ var args = arguments,
+ index = -1,
+ length = nativeMax(args.length - start, 0),
+ array = Array(length);
+
+ while (++index < length) {
+ array[index] = args[start + index];
+ }
+ index = -1;
+ var otherArgs = Array(start + 1);
+ while (++index < start) {
+ otherArgs[index] = args[index];
+ }
+ otherArgs[start] = array;
+ return func.apply(this, otherArgs);
};
}
@@ -953,9 +1017,9 @@
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
- : source[key];
+ : undefined;
- assignValue(object, key, newValue);
+ assignValue(object, key, newValue === undefined ? source[key] : newValue);
}
return object;
}
@@ -968,7 +1032,7 @@
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
- return rest(function(object, sources) {
+ return baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined;
@@ -1049,7 +1113,7 @@
* @param {Function} Ctor The constructor to wrap.
* @returns {Function} Returns the new wrapped function.
*/
- function createCtorWrapper(Ctor) {
+ function createCtor(Ctor) {
return function() {
// Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
@@ -1074,18 +1138,13 @@
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object(collection);
- predicate = baseIteratee(predicate, 3);
if (!isArrayLike(collection)) {
- var props = keys(collection);
+ var iteratee = baseIteratee(predicate, 3);
+ collection = keys(collection);
+ predicate = function(key) { return iteratee(iterable[key], key, iterable); };
}
- var index = findIndexFunc(props || collection, function(value, key) {
- if (props) {
- key = value;
- value = iterable[key];
- }
- return predicate(value, key, iterable);
- }, fromIndex);
- return index > -1 ? collection[props ? props[index] : index] : undefined;
+ var index = findIndexFunc(collection, predicate, fromIndex);
+ return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
};
}
@@ -1095,19 +1154,18 @@
*
* @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 flags. See `createWrap` for more details.
* @param {*} thisArg The `this` binding of `func`.
* @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) {
+ function createPartial(func, bitmask, thisArg, partials) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
var isBind = bitmask & BIND_FLAG,
- Ctor = createCtorWrapper(func);
+ Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1,
@@ -1212,18 +1270,14 @@
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.
- return +object == +other;
+ case numberTag:
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
+ // Invalid dates are coerced to `NaN`.
+ return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
- case numberTag:
- // Treat `NaN` vs. `NaN` as equal.
- return (object != +object) ? other != +other : object == +other;
-
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
@@ -1399,7 +1453,7 @@
* @since 1.1.0
* @category Array
* @param {Array} array The array to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
@@ -1735,7 +1789,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [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,
@@ -1772,12 +1826,14 @@
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
+ * **Note:** Unlike `_.remove`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
@@ -1817,7 +1873,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
@@ -1899,8 +1955,7 @@
* @since 0.1.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 {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
* @example
*
@@ -2007,8 +2062,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [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`.
@@ -2050,8 +2104,8 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [iteratees=[_.identity]] The iteratees to sort by.
+ * @param {...(Function|Function[])} [iteratees=[_.identity]]
+ * The iteratees to sort by.
* @returns {Array} Returns the new sorted array.
* @example
*
@@ -2101,7 +2155,7 @@
* @example
*
* jQuery(element).on('click', _.before(5, addContactToList));
- * // => allows adding up to 4 contacts to the list
+ * // => Allows adding up to 4 contacts to the list.
*/
function before(n, func) {
var result;
@@ -2140,9 +2194,9 @@
* @returns {Function} Returns the new bound function.
* @example
*
- * var greet = function(greeting, punctuation) {
+ * function greet(greeting, punctuation) {
* return greeting + ' ' + this.user + punctuation;
- * };
+ * }
*
* var object = { 'user': 'fred' };
*
@@ -2155,8 +2209,8 @@
* bound('hi');
* // => 'hi fred!'
*/
- var bind = rest(function(func, thisArg, partials) {
- return createPartialWrapper(func, BIND_FLAG | PARTIAL_FLAG, thisArg, partials);
+ var bind = baseRest(function(func, thisArg, partials) {
+ return createPartial(func, BIND_FLAG | PARTIAL_FLAG, thisArg, partials);
});
/**
@@ -2177,7 +2231,7 @@
* }, 'deferred');
* // => Logs 'deferred' after one or more milliseconds.
*/
- var defer = rest(function(func, args) {
+ var defer = baseRest(function(func, args) {
return baseDelay(func, 1, args);
});
@@ -2200,7 +2254,7 @@
* }, 1000, 'later');
* // => Logs 'later' after one second.
*/
- var delay = rest(function(func, wait, args) {
+ var delay = baseRest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
});
@@ -2229,7 +2283,8 @@
throw new TypeError(FUNC_ERROR_TEXT);
}
return function() {
- return !predicate.apply(this, arguments);
+ var args = arguments;
+ return !predicate.apply(this, args);
};
}
@@ -2249,61 +2304,12 @@
* var initialize = _.once(createApplication);
* initialize();
* initialize();
- * // `initialize` invokes `createApplication` once
+ * // => `createApplication` is invoked once
*/
function once(func) {
return before(2, func);
}
- /**
- * Creates a function that invokes `func` with the `this` binding of the
- * 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).
- *
- * @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.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var say = _.rest(function(what, names) {
- * return what + ' ' + _.initial(names).join(', ') +
- * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
- * });
- *
- * say('hello', 'fred', 'barney', 'pebbles');
- * // => 'hello fred, barney, & pebbles'
- */
- function rest(func, start) {
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);
- return function() {
- var args = arguments,
- index = -1,
- length = nativeMax(args.length - start, 0),
- array = Array(length);
-
- while (++index < length) {
- array[index] = args[start + index];
- }
- var otherArgs = Array(start + 1);
- index = -1;
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = array;
- return func.apply(this, otherArgs);
- };
- }
-
/*------------------------------------------------------------------------*/
/**
@@ -2353,8 +2359,8 @@
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
- * var object = { 'user': 'fred' };
- * var other = { 'user': 'fred' };
+ * var object = { 'a': 1 };
+ * var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
@@ -2383,7 +2389,7 @@
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
@@ -2405,11 +2411,9 @@
* @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 an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
@@ -2492,8 +2496,7 @@
* @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 a boolean, else `false`.
* @example
*
* _.isBoolean(false);
@@ -2515,8 +2518,7 @@
* @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 a date object, else `false`.
* @example
*
* _.isDate(new Date);
@@ -2525,9 +2527,7 @@
* _.isDate('Mon April 23 2012');
* // => false
*/
- function isDate(value) {
- return isObjectLike(value) && objectToString.call(value) == dateTag;
- }
+ var isDate = baseIsDate;
/**
* Checks if `value` is an empty object, collection, map, or set.
@@ -2591,8 +2591,8 @@
* else `false`.
* @example
*
- * var object = { 'user': 'fred' };
- * var other = { 'user': 'fred' };
+ * var object = { 'a': 1 };
+ * var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
@@ -2643,8 +2643,7 @@
* @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 a function, else `false`.
* @example
*
* _.isFunction(_);
@@ -2818,8 +2817,7 @@
* @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 a number, else `false`.
* @example
*
* _.isNumber(3);
@@ -2847,8 +2845,7 @@
* @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 a regexp, else `false`.
* @example
*
* _.isRegExp(/abc/);
@@ -2857,9 +2854,7 @@
* _.isRegExp('/abc/');
* // => false
*/
- function isRegExp(value) {
- return isObject(value) && objectToString.call(value) == regexpTag;
- }
+ var isRegExp = baseIsRegExp;
/**
* Checks if `value` is classified as a `String` primitive or object.
@@ -2869,8 +2864,7 @@
* @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 a string, else `false`.
* @example
*
* _.isString('abc');
@@ -3037,18 +3031,18 @@
* @example
*
* function Foo() {
- * this.c = 3;
+ * this.a = 1;
* }
*
* function Bar() {
- * this.e = 5;
+ * this.c = 3;
* }
*
- * Foo.prototype.d = 4;
- * Bar.prototype.f = 6;
+ * Foo.prototype.b = 2;
+ * Bar.prototype.d = 4;
*
- * _.assign({ 'a': 1 }, new Foo, new Bar);
- * // => { 'a': 1, 'c': 3, 'e': 5 }
+ * _.assign({ 'a': 0 }, new Foo, new Bar);
+ * // => { 'a': 1, 'c': 3 }
*/
var assign = createAssigner(function(object, source) {
copyObject(source, keys(source), object);
@@ -3072,18 +3066,18 @@
* @example
*
* function Foo() {
- * this.b = 2;
+ * this.a = 1;
* }
*
* function Bar() {
- * this.d = 4;
+ * this.c = 3;
* }
*
- * Foo.prototype.c = 3;
- * Bar.prototype.e = 5;
+ * Foo.prototype.b = 2;
+ * Bar.prototype.d = 4;
*
- * _.assignIn({ 'a': 1 }, new Foo, new Bar);
- * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }
+ * _.assignIn({ 'a': 0 }, new Foo, new Bar);
+ * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/
var assignIn = createAssigner(function(object, source) {
copyObject(source, keysIn(source), object);
@@ -3179,10 +3173,10 @@
* @see _.defaultsDeep
* @example
*
- * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
- * // => { 'user': 'barney', 'age': 36 }
+ * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+ * // => { 'a': 1, 'b': 2 }
*/
- var defaults = rest(function(args) {
+ var defaults = baseRest(function(args) {
args.push(undefined, assignInDefaults);
return assignInWith.apply(undefined, args);
});
@@ -3290,7 +3284,7 @@
* _.pick(object, ['a', 'c']);
* // => { 'a': 1, 'c': 3 }
*/
- var pick = rest(function(object, props) {
+ var pick = baseRest(function(object, props) {
return object == null ? {} : basePick(object, baseMap(baseFlatten(props, 1), toKey));
});
@@ -3407,7 +3401,7 @@
/*------------------------------------------------------------------------*/
/**
- * This method returns the first argument given to it.
+ * This method returns the first argument it receives.
*
* @static
* @since 0.1.0
@@ -3417,7 +3411,7 @@
* @returns {*} Returns `value`.
* @example
*
- * var object = { 'user': 'fred' };
+ * var object = { 'a': 1 };
*
* console.log(_.identity(object) === object);
* // => true
@@ -3486,13 +3480,13 @@
* @returns {Function} Returns the new spec function.
* @example
*
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': true },
- * { 'user': 'fred', 'age': 40, 'active': false }
+ * var objects = [
+ * { 'a': 1, 'b': 2, 'c': 3 },
+ * { 'a': 4, 'b': 5, 'c': 6 }
* ];
*
- * _.filter(users, _.matches({ 'age': 40, 'active': false }));
- * // => [{ 'user': 'fred', 'age': 40, 'active': false }]
+ * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
+ * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
*/
function matches(source) {
return baseMatches(assign({}, source));
@@ -3591,7 +3585,7 @@
}
/**
- * A method that returns `undefined`.
+ * This method returns `undefined`.
*
* @static
* @memberOf _
@@ -3801,22 +3795,21 @@
/*--------------------------------------------------------------------------*/
- // Expose Lodash on the free variable `window` or `self` when available so it's
- // globally accessible, even when bundled with Browserify, Webpack, etc. This
- // also prevents errors in cases where Lodash is loaded by a script tag in the
- // presence of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch
- // for more details. Use `_.noConflict` to remove Lodash from the global object.
- (freeSelf || {})._ = lodash;
-
- // Some AMD build optimizers like r.js check for condition patterns like the following:
+ // Some AMD build optimizers, like r.js, check for condition patterns like:
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+ // Expose Lodash on the global object to prevent errors when Lodash is
+ // loaded by a script tag in the presence of an AMD loader.
+ // See http://requirejs.org/docs/errors.html#mismatch for more details.
+ // Use `_.noConflict` to remove Lodash from the global object.
+ root._ = lodash;
+
// Define as an anonymous module so, through path mapping, it can be
// referenced as the "underscore" module.
define(function() {
return lodash;
});
}
- // Check for `exports` after `define` in case a build optimizer adds an `exports` object.
+ // Check for `exports` after `define` in case a build optimizer adds it.
else if (freeModule) {
// Export for Node.js.
(freeModule.exports = lodash)._ = lodash;
diff --git a/dist/lodash.core.min.js b/dist/lodash.core.min.js
index 96f15c2125..4823456a6f 100644
--- a/dist/lodash.core.min.js
+++ b/dist/lodash.core.min.js
@@ -3,26 +3,26 @@
* lodash (Custom Build) /license | Underscore.js 1.8.3 underscorejs.org/LICENSE
* Build: `lodash core -o ./dist/lodash.core.js`
*/
-;(function(){function n(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function t(n){return mn(Object(n))}function r(n,t){return n.push.apply(n,t),n}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return x(t,function(t){return n[t]})}function o(n){return n&&n.Object===Object?n:null}function i(n){return cn[n]}function c(n){return n instanceof f?n:new f(n)}function f(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function a(n,t,r,e){
-var u;return(u=n===rn)||(u=hn[r],u=(n===u||n!==n&&u!==u)&&!vn.call(e,r)),u?t:n}function l(n){return L(n)?_n(n):{}}function p(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(rn,r)},t)}function s(n,t){var r=true;return xn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function h(n,t,r){for(var e=-1,u=n.length;++e0&&e(f)?t>1?y(f,t-1,e,u,o):r(o,f):u||(o[o.length]=f)}return o}function b(n,r){return n&&En(n,r,t)}function g(n,t){return v(t,function(t){return K(n[t])})}function _(n,t){return n>t}function j(n,t,r,e,u){return n===t?true:null==n||null==t||!L(n)&&!Q(t)?n!==n&&t!==t:d(n,t,j,r,e,u)}function d(n,t,r,e,u,o){var i=Tn(n),c=Tn(t),f="[object Array]",a="[object Array]";i||(f=bn.call(n),f="[object Arguments]"==f?"[object Object]":f),
-c||(a=bn.call(t),a="[object Arguments]"==a?"[object Object]":a);var l="[object Object]"==f&&true,c="[object Object]"==a&&true,a=f==a;o||(o=[]);var p=kn(o,function(t){return t[0]===n});return p&&p[1]?p[1]==t:(o.push([n,t]),a&&!l?(r=i?I(n,t,r,e,u,o):q(n,t,f),o.pop(),r):2&u||(i=l&&vn.call(n,"__wrapped__"),f=c&&vn.call(t,"__wrapped__"),!i&&!f)?a?(r=$(n,t,r,e,u,o),o.pop(),r):false:(i=i?n.value():n,t=f?t.value():t,r=r(i,t,e,u,o),o.pop(),r))}function m(n){return typeof n=="function"?n:null==n?nn:(typeof n=="object"?E:w)(n);
-}function O(n,t){return t>n}function x(n,t){var r=-1,e=H(n)?Array(n.length):[];return xn(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function E(n){var r=t(n);return function(t){var e=r.length;if(null==t)return!e;for(t=Object(t);e--;){var u=r[e];if(!(u in t&&j(n[u],t[u],rn,3)))return false}return true}}function A(n,t){return n=Object(n),M(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function w(n){return function(t){return null==t?rn:t[n]}}function k(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,
-0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e1?r[u-1]:rn,o=n.length>3&&typeof o=="function"?(u--,
-o):rn;for(t=Object(t);++ei))return false;for(var c=-1,f=true,a=1&u?[]:rn;++cr?On(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rarguments.length,xn)}function P(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Bn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=rn),r}}function U(n){var t;if(typeof n!="function")throw new TypeError("Expected a function");
-return t=On(t===rn?n.length-1:Bn(t),0),function(){for(var r=arguments,e=-1,u=On(r.length-t,0),o=Array(u);++e-1&&0==t%1&&9007199254740991>=t),t&&!K(n)}function K(n){return n=L(n)?bn.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n;
-}function L(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function Q(n){return!!n&&typeof n=="object"}function W(n){return typeof n=="number"||Q(n)&&"[object Number]"==bn.call(n)}function X(n){return typeof n=="string"||!Tn(n)&&Q(n)&&"[object String]"==bn.call(n)}function Y(n){return typeof n=="string"?n:null==n?"":n+""}function Z(n){return n?u(n,t(n)):[]}function nn(n){return n}function tn(n,e,u){var o=t(e),i=g(e,o);null!=u||L(e)&&(i.length||!o.length)||(u=e,e=n,n=this,i=g(e,t(e)));var c=!(L(u)&&"chain"in u&&!u.chain),f=K(n);
-return xn(i,function(t){var u=e[t];n[t]=u,f&&(n.prototype[t]=function(){var t=this.__chain__;if(c||t){var e=n(this.__wrapped__);return(e.__actions__=N(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=t,e}return u.apply(n,r([this.value()],arguments))})}),n}var rn,en=1/0,un=/[&<>"'`]/g,on=RegExp(un.source),cn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},fn=typeof exports=="object"&&exports,an=fn&&typeof module=="object"&&module,ln=o(typeof self=="object"&&self),pn=o(typeof global=="object"&&global)||ln||o(typeof this=="object"&&this)||Function("return this")(),sn=Array.prototype,hn=Object.prototype,vn=hn.hasOwnProperty,yn=0,bn=hn.toString,gn=pn._,_n=Object.create,jn=hn.propertyIsEnumerable,dn=pn.isFinite,mn=Object.keys,On=Math.max;
-f.prototype=l(c.prototype),f.prototype.constructor=f;var xn=function(n,t){return function(r,e){if(null==r)return r;if(!H(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o-1?r[i?i[u]:u]:rn}}(function(n,t,r){var e=n?n.length:0;if(!e)return-1;r=null==r?0:Bn(r),0>r&&(r=On(e+r,0));n:{for(t=m(t),e=n.length,r+=-1;++re||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&e>r||f&&u&&i||!c&&i||!a){r=-1;break n}}r=0}return r||n.index-t.index}),w("value"))},c.tap=function(n,t){return t(n),n},c.thru=function(n,t){return t(n)},c.toArray=function(n){return H(n)?n.length?N(n):[]:Z(n)},c.values=Z,c.extend=In,
-tn(c,c),c.clone=function(n){return L(n)?Tn(n)?N(n):T(n,t(n)):n},c.escape=function(n){return(n=Y(n))&&on.test(n)?n.replace(un,i):n},c.every=function(n,t,r){return t=r?rn:t,s(n,m(t))},c.find=kn,c.forEach=J,c.has=function(n,t){return null!=n&&vn.call(n,t)},c.head=C,c.identity=nn,c.indexOf=G,c.isArguments=V,c.isArray=Tn,c.isBoolean=function(n){return true===n||false===n||Q(n)&&"[object Boolean]"==bn.call(n)},c.isDate=function(n){return Q(n)&&"[object Date]"==bn.call(n)},c.isEmpty=function(n){return H(n)&&(Tn(n)||X(n)||K(n.splice)||V(n))?!n.length:!t(n).length;
-},c.isEqual=function(n,t){return j(n,t)},c.isFinite=function(n){return typeof n=="number"&&dn(n)},c.isFunction=K,c.isNaN=function(n){return W(n)&&n!=+n},c.isNull=function(n){return null===n},c.isNumber=W,c.isObject=L,c.isRegExp=function(n){return L(n)&&"[object RegExp]"==bn.call(n)},c.isString=X,c.isUndefined=function(n){return n===rn},c.last=function(n){var t=n?n.length:0;return t?n[t-1]:rn},c.max=function(n){return n&&n.length?h(n,nn,_):rn},c.min=function(n){return n&&n.length?h(n,nn,O):rn},c.noConflict=function(){
-return pn._===this&&(pn._=gn),this},c.noop=function(){},c.reduce=M,c.result=function(n,t,r){return t=null==n?rn:n[t],t===rn&&(t=r),K(t)?t.call(n):t},c.size=function(n){return null==n?0:(n=H(n)?n:t(n),n.length)},c.some=function(n,t,r){return t=r?rn:t,S(n,m(t))},c.uniqueId=function(n){var t=++yn;return Y(n)+t},c.each=J,c.first=C,tn(c,function(){var n={};return b(c,function(t,r){vn.call(c.prototype,r)||(n[r]=t)}),n}(),{chain:false}),c.VERSION="4.13.1",xn("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){
-var t=(/^(?:replace|split)$/.test(n)?String.prototype:sn)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);c.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Tn(u)?u:[],n)}return this[r](function(r){return t.apply(Tn(r)?r:[],n)})}}),c.prototype.toJSON=c.prototype.valueOf=c.prototype.value=function(){return F(this.__wrapped__,this.__actions__)},(ln||{})._=c,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){
-return c}):an?((an.exports=c)._=c,fn._=c):pn._=c}).call(this);
\ No newline at end of file
+;(function(){function n(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function t(n,t){return n.push.apply(n,t),n}function r(n){return function(t){return null==t?Z:t[n]}}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return m(t,function(t){return n[t]})}function o(n){return n instanceof i?n:new i(n)}function i(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function c(n,t,r,e){return n===Z||J(n,an[r])&&!ln.call(e,r)?t:n;
+}function f(n){return V(n)?vn(n):{}}function a(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(Z,r)},t)}function l(n,t){var r=true;return jn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function p(n,t,r){for(var e=-1,u=n.length;++et}function g(n,t,r,e,u){return n===t||(null==n||null==t||!V(n)&&!H(t)?n!==n&&t!==t:_(n,t,g,r,e,u))}function _(n,t,r,e,u,o){var i=kn(n),c=kn(t),f="[object Array]",a="[object Array]";i||(f=sn.call(n),f="[object Arguments]"==f?"[object Object]":f),c||(a=sn.call(t),a="[object Arguments]"==a?"[object Object]":a);
+var l="[object Object]"==f&&true,c="[object Object]"==a&&true,a=f==a;o||(o=[]);var p=An(o,function(t){return t[0]==n}),s=An(o,function(n){return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=T(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=J(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 2&u||(i=l&&ln.call(n,"__wrapped__"),
+f=c&&ln.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=D(n,t,r,e,u,o),o.pop(),r):(i=i?n.value():n,f=f?t.value():t,r=r(i,f,e,u,o),o.pop(),r)}function j(n){return typeof n=="function"?n:null==n?X:(typeof n=="object"?O:r)(n)}function d(n,t){return nt&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++ei))return false;for(var c=-1,f=true,a=1&u?[]:Z;++cr?_n(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rarguments.length,jn)}function G(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Nn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=Z),r}}function J(n,t){
+return n===t||n!==n&&t!==t}function M(n){return H(n)&&P(n)&&ln.call(n,"callee")&&(!bn.call(n,"callee")||"[object Arguments]"==sn.call(n))}function P(n){var t;return(t=null!=n)&&(t=On(n),t=typeof t=="number"&&-1=t),t&&!U(n)}function U(n){return n=V(n)?sn.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n}function V(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function H(n){return!!n&&typeof n=="object"}function K(n){return typeof n=="number"||H(n)&&"[object Number]"==sn.call(n);
+}function L(n){return typeof n=="string"||!kn(n)&&H(n)&&"[object String]"==sn.call(n)}function Q(n){return typeof n=="string"?n:null==n?"":n+""}function W(n){return n?u(n,Dn(n)):[]}function X(n){return n}function Y(n,r,e){var u=Dn(r),o=b(r,u);null!=e||V(r)&&(o.length||!u.length)||(e=r,r=n,n=this,o=b(r,Dn(r)));var i=!(V(e)&&"chain"in e&&!e.chain),c=U(n);return jn(o,function(e){var u=r[e];n[e]=u,c&&(n.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=n(this.__wrapped__);return(e.__actions__=w(this.__actions__)).push({
+func:u,args:arguments,thisArg:n}),e.__chain__=r,e}return u.apply(n,t([this.value()],arguments))})}),n}var Z,nn=1/0,tn=/[&<>"'`]/g,rn=RegExp(tn.source),en=typeof global=="object"&&global&&global.Object===Object&&global,un=typeof self=="object"&&self&&self.Object===Object&&self,on=en||un||Function("return this")(),un=(en=en&&typeof exports=="object"&&exports)&&typeof module=="object"&&module,cn=function(n){return function(t){return null==n?Z:n[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'",
+"`":"`"}),fn=Array.prototype,an=Object.prototype,ln=an.hasOwnProperty,pn=0,sn=an.toString,hn=on._,vn=Object.create,bn=an.propertyIsEnumerable,yn=on.isFinite,gn=Object.keys,_n=Math.max;i.prototype=f(o.prototype),i.prototype.constructor=i;var jn=function(n,t){return function(r,e){if(null==r)return r;if(!P(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++or&&(r=_n(e+r,0));n:{for(t=j(t),e=n.length,r+=-1;++re||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&r 1))
+ ? curry(func, n)
+ : func;
+ }
+
+ /**
+ * Casts `func` to a fixed arity function if needed.
+ *
+ * @private
+ * @param {string} name The name of the function to inspect.
+ * @param {Function} func The function to inspect.
+ * @param {number} n The arity cap.
+ * @returns {Function} Returns the cast function.
+ */
+ function castFixed(name, func, n) {
+ if (config.fixed && (forceFixed || !mapping.skipFixed[name])) {
+ var data = mapping.methodSpread[name],
+ start = data && data.start;
+
+ return start === undefined ? ary(func, n) : spread(func, start);
+ }
+ return func;
+ }
+
+ /**
+ * Casts `func` to an rearged function if needed.
+ *
+ * @private
+ * @param {string} name The name of the function to inspect.
+ * @param {Function} func The function to inspect.
+ * @param {number} n The arity of `func`.
+ * @returns {Function} Returns the cast function.
+ */
+ function castRearg(name, func, n) {
+ return (config.rearg && n > 1 && (forceRearg || !mapping.skipRearg[name]))
+ ? rearg(func, mapping.methodRearg[name] || mapping.aryRearg[n])
+ : func;
+ }
+
/**
* Creates a clone of `object` by `path`.
*
@@ -390,12 +467,11 @@ return /******/ (function(modules) { // webpackBootstrap
}
/**
- * Creates a function that invokes `func` with its first argument passed
- * thru `transform`.
+ * Creates a function that invokes `func` with its first argument transformed.
*
* @private
* @param {Function} func The function to wrap.
- * @param {...Function} transform The functions to transform the first argument.
+ * @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
@@ -435,42 +511,27 @@ return /******/ (function(modules) { // webpackBootstrap
}
else if (config.immutable) {
if (mutateMap.array[name]) {
- wrapped = immutWrap(func, cloneArray);
+ wrapped = wrapImmutable(func, cloneArray);
}
else if (mutateMap.object[name]) {
- wrapped = immutWrap(func, createCloner(func));
+ wrapped = wrapImmutable(func, createCloner(func));
}
else if (mutateMap.set[name]) {
- wrapped = immutWrap(func, cloneByPath);
+ wrapped = wrapImmutable(func, cloneByPath);
}
}
each(aryMethodKeys, function(aryKey) {
each(mapping.aryMethod[aryKey], function(otherName) {
if (name == otherName) {
- var aryN = !isLib && mapping.iterateeAry[name],
- reargIndexes = mapping.iterateeRearg[name],
- spreadStart = mapping.methodSpread[name];
-
- result = wrapped;
- if (config.fixed && (forceFixed || !mapping.skipFixed[name])) {
- result = spreadStart === undefined
- ? ary(result, aryKey)
- : spread(result, spreadStart);
- }
- if (config.rearg && aryKey > 1 && (forceRearg || !mapping.skipRearg[name])) {
- result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[aryKey]);
- }
- if (config.cap) {
- if (reargIndexes) {
- result = iterateeRearg(result, reargIndexes);
- } else if (aryN) {
- result = iterateeAry(result, aryN);
- }
- }
- if (forceCurry || (config.curry && aryKey > 1)) {
- forceCurry && console.log(forceCurry, name);
- result = curry(result, aryKey);
- }
+ var spreadData = mapping.methodSpread[name],
+ afterRearg = spreadData && spreadData.afterRearg;
+
+ result = afterRearg
+ ? castFixed(name, castRearg(name, wrapped, aryKey), aryKey)
+ : castRearg(name, castFixed(name, wrapped, aryKey), aryKey);
+
+ result = castCap(name, result);
+ result = castCurry(name, result, aryKey);
return false;
}
});
@@ -559,11 +620,20 @@ return /******/ (function(modules) { // webpackBootstrap
'entries': 'toPairs',
'entriesIn': 'toPairsIn',
'extend': 'assignIn',
+ 'extendAll': 'assignInAll',
+ 'extendAllWith': 'assignInAllWith',
'extendWith': 'assignInWith',
'first': 'head',
+ // Methods that are curried variants of others.
+ 'conforms': 'conformsTo',
+ 'matches': 'isMatch',
+ 'property': 'get',
+
// Ramda aliases.
'__': 'placeholder',
+ 'F': 'stubFalse',
+ 'T': 'stubTrue',
'all': 'every',
'allPass': 'overEvery',
'always': 'constant',
@@ -577,8 +647,11 @@ return /******/ (function(modules) { // webpackBootstrap
'contains': 'includes',
'dissoc': 'unset',
'dissocPath': 'unset',
+ 'dropLast': 'dropRight',
+ 'dropLastWhile': 'dropRightWhile',
'equals': 'isEqual',
'identical': 'eq',
+ 'indexBy': 'keyBy',
'init': 'initial',
'invertObj': 'invert',
'juxt': 'over',
@@ -595,36 +668,44 @@ return /******/ (function(modules) { // webpackBootstrap
'propEq': 'matchesProperty',
'propOr': 'getOr',
'props': 'at',
+ 'symmetricDifference': 'xor',
+ 'symmetricDifferenceBy': 'xorBy',
+ 'symmetricDifferenceWith': 'xorWith',
+ 'takeLast': 'takeRight',
+ 'takeLastWhile': 'takeRightWhile',
'unapply': 'rest',
'unnest': 'flatten',
'useWith': 'overArgs',
- 'whereEq': 'filter',
+ 'where': 'conformsTo',
+ 'whereEq': 'isMatch',
'zipObj': 'zipObject'
};
/** Used to map ary to method names. */
exports.aryMethod = {
'1': [
- 'attempt', 'castArray', 'ceil', 'create', 'curry', 'curryRight', 'floor',
- 'flow', 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method',
- 'methodOf', 'mixin', 'over', 'overEvery', 'overSome', 'rest', 'reverse',
- 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart',
- 'uniqueId', 'words'
+ 'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create',
+ 'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow',
+ 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method',
+ 'mergeAll', 'methodOf', 'mixin', 'over', 'overEvery', 'overSome', 'rest',
+ 'reverse', 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd',
+ 'trimStart', 'uniqueId', 'words', 'zipAll'
],
'2': [
- 'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindAll',
- 'bindKey', 'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
- 'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
- 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith',
- 'eq', 'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast',
- 'findLastIndex', 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth',
- 'forEach', 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight',
- 'get', 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf',
- 'intersection', 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch',
- 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues',
- 'matchesProperty', 'maxBy', 'meanBy', 'merge', 'minBy', 'multiply', 'nth',
- 'omit', 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
- 'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',
+ 'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith',
+ 'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith',
+ 'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN',
+ 'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference',
+ 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq',
+ 'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
+ 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', 'forEach',
+ 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', 'get',
+ 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', 'intersection',
+ 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy',
+ 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues', 'matchesProperty',
+ 'maxBy', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit',
+ 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial',
+ 'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
@@ -703,7 +784,9 @@ return /******/ (function(modules) { // webpackBootstrap
/** Used to map method names to rearg configs. */
exports.methodRearg = {
+ 'assignInAllWith': [1, 2, 0],
'assignInWith': [1, 2, 0],
+ 'assignAllWith': [1, 2, 0],
'assignWith': [1, 2, 0],
'differenceBy': [1, 2, 0],
'differenceWith': [1, 2, 0],
@@ -712,6 +795,7 @@ return /******/ (function(modules) { // webpackBootstrap
'intersectionWith': [1, 2, 0],
'isEqualWith': [1, 2, 0],
'isMatchWith': [2, 1, 0],
+ 'mergeAllWith': [1, 2, 0],
'mergeWith': [1, 2, 0],
'padChars': [2, 1, 0],
'padCharsEnd': [2, 1, 0],
@@ -731,11 +815,20 @@ return /******/ (function(modules) { // webpackBootstrap
/** Used to map method names to spread configs. */
exports.methodSpread = {
- 'invokeArgs': 2,
- 'invokeArgsMap': 2,
- 'partial': 1,
- 'partialRight': 1,
- 'without': 1
+ 'assignAll': { 'start': 0 },
+ 'assignAllWith': { 'afterRearg': true, 'start': 1 },
+ 'assignInAll': { 'start': 0 },
+ 'assignInAllWith': { 'afterRearg': true, 'start': 1 },
+ 'defaultsAll': { 'start': 0 },
+ 'defaultsDeepAll': { 'start': 0 },
+ 'invokeArgs': { 'start': 2 },
+ 'invokeArgsMap': { 'start': 2 },
+ 'mergeAll': { 'start': 0 },
+ 'mergeAllWith': { 'afterRearg': true, 'start': 1 },
+ 'partial': { 'start': 1 },
+ 'partialRight': { 'start': 1 },
+ 'without': { 'start': 1 },
+ 'zipAll': { 'start': 0 }
};
/** Used to identify methods which mutate arrays or objects. */
@@ -752,13 +845,21 @@ return /******/ (function(modules) { // webpackBootstrap
},
'object': {
'assign': true,
+ 'assignAll': true,
+ 'assignAllWith': true,
'assignIn': true,
+ 'assignInAll': true,
+ 'assignInAllWith': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
+ 'defaultsAll': true,
'defaultsDeep': true,
+ 'defaultsDeepAll': true,
'merge': true,
- 'mergeWith': true
+ 'mergeAll': true,
+ 'mergeAllWith': true,
+ 'mergeWith': true,
},
'set': {
'set': true,
@@ -798,8 +899,14 @@ return /******/ (function(modules) { // webpackBootstrap
/** Used to map method names to other names. */
exports.remap = {
+ 'assignAll': 'assign',
+ 'assignAllWith': 'assignWith',
+ 'assignInAll': 'assignIn',
+ 'assignInAllWith': 'assignInWith',
'curryN': 'curry',
'curryRightN': 'curryRight',
+ 'defaultsAll': 'defaults',
+ 'defaultsDeepAll': 'defaultsDeep',
'findFrom': 'find',
'findIndexFrom': 'findIndex',
'findLastFrom': 'findLast',
@@ -810,14 +917,18 @@ return /******/ (function(modules) { // webpackBootstrap
'invokeArgs': 'invoke',
'invokeArgsMap': 'invokeMap',
'lastIndexOfFrom': 'lastIndexOf',
+ 'mergeAll': 'merge',
+ 'mergeAllWith': 'mergeWith',
'padChars': 'pad',
'padCharsEnd': 'padEnd',
'padCharsStart': 'padStart',
+ 'propertyOf': 'get',
'restFrom': 'rest',
'spreadFrom': 'spread',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
- 'trimCharsStart': 'trimStart'
+ 'trimCharsStart': 'trimStart',
+ 'zipAll': 'zip'
};
/** Used to track methods that skip fixing their arity. */
@@ -827,6 +938,7 @@ return /******/ (function(modules) { // webpackBootstrap
'flowRight': true,
'iteratee': true,
'mixin': true,
+ 'rearg': true,
'runInContext': true
};
@@ -852,12 +964,14 @@ return /******/ (function(modules) { // webpackBootstrap
'overArgs': true,
'partial': true,
'partialRight': true,
+ 'propertyOf': true,
'random': true,
'range': true,
'rangeRight': true,
'subtract': true,
'zip': true,
- 'zipObject': true
+ 'zipObject': true,
+ 'zipObjectDeep': true
};
diff --git a/dist/lodash.fp.min.js b/dist/lodash.fp.min.js
index 59affc3188..e87ab1c600 100644
--- a/dist/lodash.fp.min.js
+++ b/dist/lodash.fp.min.js
@@ -1,17 +1,20 @@
-!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fp=e():t.fp=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){function n(t,e){return i(t,t,e)}var i=r(1);"function"==typeof _&&(_=n(_.runInContext())),
-t.exports=n},function(t,e,r){function n(t,e){return 2==e?function(e,r){return t.apply(void 0,arguments)}:function(e){return t.apply(void 0,arguments)}}function i(t,e){return 2==e?function(e,r){return t(e,r)}:function(e){return t(e)}}function a(t){for(var e=t?t.length:0,r=Array(e);e--;)r[e]=t[e];return r}function o(t){return function(e){return t({},e)}}function s(t,e){return function(){var r=arguments.length;if(!r)return i;for(var n=Array(r);r--;)n[r]=arguments[r];var i=n[0]=e.apply(void 0,n);return t.apply(void 0,n),
-i}}function u(t,e,r,c){function f(t,e){e=D(e);for(var r=-1,n=e.length,i=n-1,a=w(Object(t)),o=a;null!=o&&++r1&&(k||!p.skipRearg[t])&&(r=z(r,p.methodRearg[t]||p.aryRearg[e])),A.cap&&(o?r=g(r,o):a&&(r=m(r,a))),(O||A.curry&&e>1)&&(O&&console.log(O,t),r=L(r,e)),!1}}),!r}),r||(r=n),r==e&&(r=O?L(r,1):function(){return e.apply(this,arguments)}),r.convert=y(t,e),p.placeholder[t]&&(W=!0,r.placeholder=e.placeholder=B),r}var W,I="function"==typeof e,R=e===Object(e);if(R&&(c=r,r=e,e=void 0),null==r)throw new TypeError;c||(c={});var A={cap:"cap"in c?c.cap:!0,curry:"curry"in c?c.curry:!0,fixed:"fixed"in c?c.fixed:!0,
-immutable:"immutable"in c?c.immutable:!0,rearg:"rearg"in c?c.rearg:!0},O="curry"in c&&c.curry,b="fixed"in c&&c.fixed,k="rearg"in c&&c.rearg,B=I?r:l,E=I?r.runInContext():void 0,F=I?r:{ary:t.ary,assign:t.assign,clone:t.clone,curry:t.curry,forEach:t.forEach,isArray:t.isArray,isFunction:t.isFunction,iteratee:t.iteratee,keys:t.keys,rearg:t.rearg,spread:t.spread,toPath:t.toPath},j=F.ary,C=F.assign,w=F.clone,L=F.curry,M=F.forEach,q=F.isArray,P=F.isFunction,S=F.keys,z=F.rearg,K=F.spread,D=F.toPath,T=S(p.aryMethod),_={
-castArray:function(t){return function(){var e=arguments[0];return q(e)?t(a(e)):t.apply(void 0,arguments)}},iteratee:function(t){return function(){var e=arguments[0],r=arguments[1],n=t(e,r),a=n.length;return A.cap&&"number"==typeof r?(r=r>2?r-2:1,a&&r>=a?n:i(n,r)):n}},mixin:function(t){return function(e){var r=this;if(!P(r))return t(r,Object(e));var n=[];return M(S(e),function(t){P(e[t])&&n.push([t,r.prototype[t]])}),t(r,Object(e)),M(n,function(t){var e=t[1];P(e)?r.prototype[t[0]]=e:delete r.prototype[t[0]];
-}),r}},runInContext:function(e){return function(r){return u(t,e(r),c)}}};if(!R)return x(e,r);var N=r,V=[];return M(T,function(t){M(p.aryMethod[t],function(t){var e=N[p.remap[t]||t];e&&V.push([t,x(t,e)])})}),M(S(N),function(t){var e=N[t];if("function"==typeof e){for(var r=V.length;r--;)if(V[r][0]==t)return;e.convert=y(t,e),V.push([t,e])}}),M(V,function(t){N[t[0]]=t[1]}),N.convert=h,W&&(N.placeholder=B),M(S(N),function(t){M(p.realToAlias[t]||[],function(e){N[e]=N[t]})}),N}var p=r(2),d=p.mutate,l=r(3);
-t.exports=u},function(t,e){e.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendWith:"assignInWith",first:"head",__:"placeholder",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",equals:"isEqual",identical:"eq",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",
-nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",unapply:"rest",unnest:"flatten",useWith:"overArgs",whereEq:"filter",zipObj:"zipObject"},e.aryMethod={1:["attempt","castArray","ceil","create","curry","curryRight","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","methodOf","mixin","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words"],
-2:["add","after","ary","assign","assignIn","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],
+(function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.fp=e():t.fp=e()})(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){function n(t,e){return i(t,t,e)}var i=r(1);"function"==typeof _&&(_=n(_.runInContext())),
+t.exports=n},function(t,e,r){function n(t,e){return 2==e?function(e,r){return t.apply(void 0,arguments)}:function(e){return t.apply(void 0,arguments)}}function i(t,e){return 2==e?function(e,r){return t(e,r)}:function(e){return t(e)}}function a(t){for(var e=t?t.length:0,r=Array(e);e--;)r[e]=t[e];return r}function o(t){return function(e){return t({},e)}}function s(t,e){return function(){var r=arguments.length;if(r){for(var n=Array(r);r--;)n[r]=arguments[r];var i=n[0]=e.apply(void 0,n);return t.apply(void 0,n),
+i}}}function l(t,e,r,d){function c(t,e){if(B.cap){var r=u.iterateeRearg[t];if(r)return x(e,r);var n=!b&&u.iterateeAry[t];if(n)return W(e,n)}return e}function h(t,e,r){return E||B.curry&&r>1?q(e,r):e}function g(t,e,r){if(B.fixed&&(F||!u.skipFixed[t])){var n=u.methodSpread[t],i=n&&n.start;return void 0===i?M(e,r):N(e,i)}return e}function y(t,e,r){return B.rearg&&r>1&&(j||!u.skipRearg[t])?_(e,u.methodRearg[t]||u.aryRearg[r]):e}function m(t,e){e=V(e);for(var r=-1,n=e.length,i=n-1,a=z(Object(t)),o=a;null!=o&&++r2?r-2:1,a&&a<=r?n:i(n,r)):n}},mixin:function(t){return function(e){
+var r=this;if(!T(r))return t(r,Object(e));var n=[];return P(K(e),function(t){T(e[t])&&n.push([t,r.prototype[t]])}),t(r,Object(e)),P(n,function(t){var e=t[1];T(e)?r.prototype[t[0]]=e:delete r.prototype[t[0]]}),r}},rearg:function(t){return function(e,r){var n=r?r.length:0;return q(t(e,r),n)}},runInContext:function(e){return function(r){return l(t,e(r),d)}}};if(!k)return R(e,r);var H=r,J=[];return P(U,function(t){P(u.aryMethod[t],function(t){var e=H[u.remap[t]||t];e&&J.push([t,R(t,e)])})}),P(K(H),function(t){
+var e=H[t];if("function"==typeof e){for(var r=J.length;r--;)if(J[r][0]==t)return;e.convert=A(t,e),J.push([t,e])}}),P(J,function(t){H[t[0]]=t[1]}),H.convert=v,O&&(H.placeholder=L),P(K(H),function(t){P(u.realToAlias[t]||[],function(e){H[e]=H[t]})}),H}var u=r(2),p=u.mutate,f=r(3);t.exports=l},function(t,e){e.aliasToReal={each:"forEach",eachRight:"forEachRight",entries:"toPairs",entriesIn:"toPairsIn",extend:"assignIn",extendAll:"assignInAll",extendAllWith:"assignInAllWith",extendWith:"assignInWith",first:"head",
+conforms:"conformsTo",matches:"isMatch",property:"get",__:"placeholder",F:"stubFalse",T:"stubTrue",all:"every",allPass:"overEvery",always:"constant",any:"some",anyPass:"overSome",apply:"spread",assoc:"set",assocPath:"set",complement:"negate",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",dropLast:"dropRight",dropLastWhile:"dropRightWhile",equals:"isEqual",identical:"eq",indexBy:"keyBy",init:"initial",invertObj:"invert",juxt:"over",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",
+pathOr:"getOr",paths:"at",pickAll:"pick",pipe:"flow",pluck:"map",prop:"get",propEq:"matchesProperty",propOr:"getOr",props:"at",symmetricDifference:"xor",symmetricDifferenceBy:"xorBy",symmetricDifferenceWith:"xorWith",takeLast:"takeRight",takeLastWhile:"takeRightWhile",unapply:"rest",unnest:"flatten",useWith:"overArgs",where:"conformsTo",whereEq:"isMatch",zipObj:"zipObject"},e.aryMethod={1:["assignAll","assignInAll","attempt","castArray","ceil","create","curry","curryRight","defaultsAll","defaultsDeepAll","floor","flow","flowRight","fromPairs","invert","iteratee","memoize","method","mergeAll","methodOf","mixin","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words","zipAll"],
+2:["add","after","ary","assign","assignAllWith","assignIn","assignInAllWith","at","before","bind","bindAll","bindKey","chunk","cloneDeepWith","cloneWith","concat","conformsTo","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","defaultTo","delay","difference","divide","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","flatMapDeep","flattenDepth","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","meanBy","merge","mergeAllWith","minBy","multiply","nth","omit","omitBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","propertyOf","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","restFrom","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","spreadFrom","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","trimChars","trimCharsEnd","trimCharsStart","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],
3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","findFrom","findIndexFrom","findLastFrom","findLastIndexFrom","getOr","includesFrom","indexOfFrom","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","lastIndexOfFrom","mergeWith","orderBy","padChars","padCharsEnd","padCharsStart","pullAllBy","pullAllWith","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","update","xorBy","xorWith","zipWith"],
4:["fill","setWith","updateWith"]},e.aryRearg={2:[1,0],3:[2,0,1],4:[3,2,0,1]},e.iterateeAry={dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findFrom:1,findIndex:1,findIndexFrom:1,findKey:1,findLast:1,findLastFrom:1,findLastIndex:1,findLastIndexFrom:1,findLastKey:1,flatMap:1,flatMapDeep:1,flatMapDepth:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,
-transform:2},e.iterateeRearg={mapKeys:[1]},e.methodRearg={assignInWith:[1,2,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],
-zipWith:[1,2,0]},e.methodSpread={invokeArgs:2,invokeArgsMap:2,partial:1,partialRight:1,without:1},e.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignIn:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsDeep:!0,merge:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},e.placeholder={bind:!0,bindKey:!0,curry:!0,curryRight:!0,partial:!0,partialRight:!0},e.realToAlias=function(){var t=Object.prototype.hasOwnProperty,r=e.aliasToReal,n={};
-for(var i in r){var a=r[i];t.call(n,a)?n[a].push(i):n[a]=[i]}return n}(),e.remap={curryN:"curry",curryRightN:"curryRight",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart"
-},e.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,runInContext:!0},e.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,overArgs:!0,partial:!0,partialRight:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0}},function(t,e){t.exports={}}])});
\ No newline at end of file
+transform:2},e.iterateeRearg={mapKeys:[1]},e.methodRearg={assignInAllWith:[1,2,0],assignInWith:[1,2,0],assignAllWith:[1,2,0],assignWith:[1,2,0],differenceBy:[1,2,0],differenceWith:[1,2,0],getOr:[2,1,0],intersectionBy:[1,2,0],intersectionWith:[1,2,0],isEqualWith:[1,2,0],isMatchWith:[2,1,0],mergeAllWith:[1,2,0],mergeWith:[1,2,0],padChars:[2,1,0],padCharsEnd:[2,1,0],padCharsStart:[2,1,0],pullAllBy:[2,1,0],pullAllWith:[2,1,0],setWith:[3,1,2,0],sortedIndexBy:[2,1,0],sortedLastIndexBy:[2,1,0],unionBy:[1,2,0],
+unionWith:[1,2,0],updateWith:[3,1,2,0],xorBy:[1,2,0],xorWith:[1,2,0],zipWith:[1,2,0]},e.methodSpread={assignAll:{start:0},assignAllWith:{afterRearg:!0,start:1},assignInAll:{start:0},assignInAllWith:{afterRearg:!0,start:1},defaultsAll:{start:0},defaultsDeepAll:{start:0},invokeArgs:{start:2},invokeArgsMap:{start:2},mergeAll:{start:0},mergeAllWith:{afterRearg:!0,start:1},partial:{start:1},partialRight:{start:1},without:{start:1},zipAll:{start:0}},e.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,
+pullAllWith:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignAll:!0,assignAllWith:!0,assignIn:!0,assignInAll:!0,assignInAllWith:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsAll:!0,defaultsDeep:!0,defaultsDeepAll:!0,merge:!0,mergeAll:!0,mergeAllWith:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0,update:!0,updateWith:!0}},e.placeholder={bind:!0,bindKey:!0,curry:!0,curryRight:!0,partial:!0,partialRight:!0},e.realToAlias=function(){var t=Object.prototype.hasOwnProperty,r=e.aliasToReal,n={};
+for(var i in r){var a=r[i];t.call(n,a)?n[a].push(i):n[a]=[i]}return n}(),e.remap={assignAll:"assign",assignAllWith:"assignWith",assignInAll:"assignIn",assignInAllWith:"assignInWith",curryN:"curry",curryRightN:"curryRight",defaultsAll:"defaults",defaultsDeepAll:"defaultsDeep",findFrom:"find",findIndexFrom:"findIndex",findLastFrom:"findLast",findLastIndexFrom:"findLastIndex",getOr:"get",includesFrom:"includes",indexOfFrom:"indexOf",invokeArgs:"invoke",invokeArgsMap:"invokeMap",lastIndexOfFrom:"lastIndexOf",
+mergeAll:"merge",mergeAllWith:"mergeWith",padChars:"pad",padCharsEnd:"padEnd",padCharsStart:"padStart",propertyOf:"get",restFrom:"rest",spreadFrom:"spread",trimChars:"trim",trimCharsEnd:"trimEnd",trimCharsStart:"trimStart",zipAll:"zip"},e.skipFixed={castArray:!0,flow:!0,flowRight:!0,iteratee:!0,mixin:!0,rearg:!0,runInContext:!0},e.skipRearg={add:!0,assign:!0,assignIn:!0,bind:!0,bindKey:!0,concat:!0,difference:!0,divide:!0,eq:!0,gt:!0,gte:!0,isEqual:!0,lt:!0,lte:!0,matchesProperty:!0,merge:!0,multiply:!0,
+overArgs:!0,partial:!0,partialRight:!0,propertyOf:!0,random:!0,range:!0,rangeRight:!0,subtract:!0,zip:!0,zipObject:!0,zipObjectDeep:!0}},function(t,e){t.exports={}}])});
\ No newline at end of file
diff --git a/dist/lodash.js b/dist/lodash.js
index 5b5c703ba0..8dd4672991 100644
--- a/dist/lodash.js
+++ b/dist/lodash.js
@@ -12,7 +12,7 @@
var undefined;
/** Used as the semantic version number. */
- var VERSION = '4.13.1';
+ var VERSION = '4.14.0';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
@@ -26,7 +26,7 @@
/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
- /** Used to compose bitmasks for wrapper metadata. */
+ /** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1,
BIND_KEY_FLAG = 2,
CURRY_BOUND_FLAG = 4,
@@ -66,6 +66,19 @@
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
+ /** Used to associate wrap methods with their bit flags. */
+ var wrapFlags = [
+ ['ary', ARY_FLAG],
+ ['bind', BIND_FLAG],
+ ['bindKey', BIND_KEY_FLAG],
+ ['curry', CURRY_FLAG],
+ ['curryRight', CURRY_RIGHT_FLAG],
+ ['flip', FLIP_FLAG],
+ ['partial', PARTIAL_FLAG],
+ ['partialRight', PARTIAL_RIGHT_FLAG],
+ ['rearg', REARG_FLAG]
+ ];
+
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
@@ -130,6 +143,11 @@
reTrimStart = /^\s+/,
reTrimEnd = /\s+$/;
+ /** Used to match wrap detail comments. */
+ var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
+ reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
+ reSplitDetails = /,? & /;
+
/** Used to match non-compound words composed of alphanumeric characters. */
var reBasicWord = /[a-zA-Z0-9]+/g;
@@ -249,7 +267,7 @@
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError',
'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
- '_', 'isFinite', 'parseInt', 'setTimeout'
+ '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
];
/** Used to make template sourceURLs easier to identify. */
@@ -342,8 +360,17 @@
var freeParseFloat = parseFloat,
freeParseInt = parseInt;
+ /** Detect free variable `global` from Node.js. */
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
+
+ /** Detect free variable `self`. */
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+
+ /** Used as a reference to the global object. */
+ var root = freeGlobal || freeSelf || Function('return this')();
+
/** Detect free variable `exports`. */
- var freeExports = typeof exports == 'object' && exports;
+ var freeExports = freeGlobal && typeof exports == 'object' && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module;
@@ -351,17 +378,23 @@
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = checkGlobal(typeof global == 'object' && global);
+ /** Detect free variable `process` from Node.js. */
+ var freeProcess = moduleExports && freeGlobal.process;
- /** Detect free variable `self`. */
- var freeSelf = checkGlobal(typeof self == 'object' && self);
+ /** Used to access faster Node.js helpers. */
+ var nodeUtil = (function() {
+ try {
+ return freeProcess && freeProcess.binding('util');
+ } catch (e) {}
+ }());
- /** Detect `this` as the global object. */
- var thisGlobal = checkGlobal(typeof this == 'object' && this);
-
- /** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || thisGlobal || Function('return this')();
+ /* Node.js helper references. */
+ var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
+ nodeIsDate = nodeUtil && nodeUtil.isDate,
+ nodeIsMap = nodeUtil && nodeUtil.isMap,
+ nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
+ nodeIsSet = nodeUtil && nodeUtil.isSet,
+ nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/*--------------------------------------------------------------------------*/
@@ -374,7 +407,7 @@
* @returns {Object} Returns `map`.
*/
function addMapEntry(map, pair) {
- // Don't return `Map#set` because it doesn't return the map instance in IE 11.
+ // Don't return `map.set` because it's not chainable in IE 11.
map.set(pair[0], pair[1]);
return map;
}
@@ -388,6 +421,7 @@
* @returns {Object} Returns `set`.
*/
function addSetEntry(set, value) {
+ // Don't return `set.add` because it's not chainable in IE 11.
set.add(value);
return set;
}
@@ -403,8 +437,7 @@
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
- var length = args.length;
- switch (length) {
+ switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
@@ -721,7 +754,7 @@
*/
function baseIndexOf(array, value, fromIndex) {
if (value !== value) {
- return indexOfNaN(array, fromIndex);
+ return baseFindIndex(array, baseIsNaN, fromIndex);
}
var index = fromIndex - 1,
length = array.length;
@@ -756,6 +789,17 @@
return -1;
}
+ /**
+ * The base implementation of `_.isNaN` without support for number objects.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+ */
+ function baseIsNaN(value) {
+ return value !== value;
+ }
+
/**
* The base implementation of `_.mean` and `_.meanBy` without support for
* iteratee shorthands.
@@ -770,6 +814,32 @@
return length ? (baseSum(array, iteratee) / length) : NAN;
}
+ /**
+ * The base implementation of `_.property` without support for deep paths.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function baseProperty(key) {
+ return function(object) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
+ /**
+ * The base implementation of `_.propertyOf` without support for deep paths.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function basePropertyOf(object) {
+ return function(key) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
/**
* The base implementation of `_.reduce` and `_.reduceRight`, without support
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
@@ -870,7 +940,7 @@
}
/**
- * The base implementation of `_.unary` without support for storing wrapper metadata.
+ * The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
@@ -943,17 +1013,6 @@
return index;
}
- /**
- * Checks if `value` is a global object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {null|Object} Returns `value` if it's a global object, else `null`.
- */
- function checkGlobal(value) {
- return (value && value.Object === Object) ? value : null;
- }
-
/**
* Gets the number of `placeholder` occurrences in `array`.
*
@@ -981,9 +1040,7 @@
* @param {string} letter The matched letter to deburr.
* @returns {string} Returns the deburred letter.
*/
- function deburrLetter(letter) {
- return deburredLetters[letter];
- }
+ var deburrLetter = basePropertyOf(deburredLetters);
/**
* Used by `_.escape` to convert characters to HTML entities.
@@ -992,9 +1049,7 @@
* @param {string} chr The matched character to escape.
* @returns {string} Returns the escaped character.
*/
- function escapeHtmlChar(chr) {
- return htmlEscapes[chr];
- }
+ var escapeHtmlChar = basePropertyOf(htmlEscapes);
/**
* Used by `_.template` to escape characters for inclusion in compiled string literals.
@@ -1019,28 +1074,6 @@
return object == null ? undefined : object[key];
}
- /**
- * Gets the index at which the first occurrence of `NaN` is found in `array`.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched `NaN`, else `-1`.
- */
- function indexOfNaN(array, fromIndex, fromRight) {
- var length = array.length,
- index = fromIndex + (fromRight ? 1 : -1);
-
- while ((fromRight ? index-- : ++index < length)) {
- var other = array[index];
- if (other !== other) {
- return index;
- }
- }
- return -1;
- }
-
/**
* Checks if `value` is a host object in IE < 9.
*
@@ -1094,6 +1127,20 @@
return result;
}
+ /**
+ * Creates a function that invokes `func` with its first argument transformed.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {Function} transform The argument transform.
+ * @returns {Function} Returns the new function.
+ */
+ function overArg(func, transform) {
+ return function(arg) {
+ return func(transform(arg));
+ };
+ }
+
/**
* Replaces all `placeholder` elements in `array` with an internal placeholder
* and returns an array of their indexes.
@@ -1189,9 +1236,7 @@
* @param {string} chr The matched character to unescape.
* @returns {string} Returns the unescaped character.
*/
- function unescapeHtmlChar(chr) {
- return htmlUnescapes[chr];
- }
+ var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
/*--------------------------------------------------------------------------*/
@@ -1235,7 +1280,8 @@
context = context ? _.defaults({}, context, _.pick(root, contextProps)) : root;
/** Built-in constructor references. */
- var Date = context.Date,
+ var Array = context.Array,
+ Date = context.Date,
Error = context.Error,
Math = context.Math,
RegExp = context.RegExp,
@@ -1289,19 +1335,22 @@
Symbol = context.Symbol,
Uint8Array = context.Uint8Array,
enumerate = Reflect ? Reflect.enumerate : undefined,
- getOwnPropertySymbols = Object.getOwnPropertySymbols,
- iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined,
- objectCreate = Object.create,
+ iteratorSymbol = Symbol ? Symbol.iterator : undefined,
+ objectCreate = context.Object.create,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
- splice = arrayProto.splice;
+ splice = arrayProto.splice,
+ spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
/** Built-in method references that are mockable. */
- var setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); };
+ var clearTimeout = function(id) { return context.clearTimeout.call(root, id); },
+ setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); };
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil,
nativeFloor = Math.floor,
nativeGetPrototype = Object.getPrototypeOf,
+ nativeGetSymbols = Object.getOwnPropertySymbols,
+ nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeIsFinite = context.isFinite,
nativeJoin = arrayProto.join,
nativeKeys = Object.keys,
@@ -1319,7 +1368,15 @@
Promise = getNative(context, 'Promise'),
Set = getNative(context, 'Set'),
WeakMap = getNative(context, 'WeakMap'),
- nativeCreate = getNative(Object, 'create');
+ nativeCreate = getNative(context.Object, 'create');
+
+ /* Used to set `toString` methods. */
+ var defineProperty = (function() {
+ var func = getNative(context.Object, 'defineProperty'),
+ name = getNative.name;
+
+ return (name && name.length > 2) ? func : undefined;
+ }());
/** Used to store function metadata. */
var metaMap = WeakMap && new WeakMap;
@@ -1410,16 +1467,16 @@
*
* The wrapper methods that are **not** chainable by default are:
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
- * `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`,
+ * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
+ * `defaultTo`, `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`,
@@ -2122,8 +2179,13 @@
*/
function stackSet(key, value) {
var cache = this.__data__;
- if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) {
- cache = this.__data__ = new MapCache(cache.__data__);
+ if (cache instanceof ListCache) {
+ var pairs = cache.__data__;
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
+ pairs.push([key, value]);
+ return this;
+ }
+ cache = this.__data__ = new MapCache(pairs);
}
cache.set(key, value);
return this;
@@ -2260,7 +2322,7 @@
}
/**
- * The base implementation of `_.clamp` which doesn't coerce arguments to numbers.
+ * The base implementation of `_.clamp` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to clamp.
@@ -2344,14 +2406,17 @@
if (!isArr) {
var props = isFull ? getAllKeys(value) : keys(value);
}
- // Recursively populate clone (susceptible to call stack limits).
arrayEach(props || value, function(subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
+ // Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
});
+ if (!isFull) {
+ stack['delete'](value);
+ }
return result;
}
@@ -2363,26 +2428,37 @@
* @returns {Function} Returns the new spec function.
*/
function baseConforms(source) {
- var props = keys(source),
- length = props.length;
-
+ var props = keys(source);
return function(object) {
- if (object == null) {
- return !length;
- }
- var index = length;
- while (index--) {
- var key = props[index],
- predicate = source[key],
- value = object[key];
+ return baseConformsTo(object, source, props);
+ };
+ }
- if ((value === undefined &&
- !(key in Object(object))) || !predicate(value)) {
- return false;
- }
+ /**
+ * The base implementation of `_.conformsTo` which accepts `props` to check.
+ *
+ * @private
+ * @param {Object} object The object to inspect.
+ * @param {Object} source The object of property predicates to conform to.
+ * @returns {boolean} Returns `true` if `object` conforms, else `false`.
+ */
+ function baseConformsTo(object, source, props) {
+ var length = props.length;
+ if (object == null) {
+ return !length;
+ }
+ var index = length;
+ while (index--) {
+ var key = props[index],
+ predicate = source[key],
+ value = object[key];
+
+ if ((value === undefined &&
+ !(key in Object(object))) || !predicate(value)) {
+ return false;
}
- return true;
- };
+ }
+ return true;
}
/**
@@ -2398,13 +2474,13 @@
}
/**
- * The base implementation of `_.delay` and `_.defer` which accepts an array
- * of `func` arguments.
+ * The base implementation of `_.delay` and `_.defer` which accepts `args`
+ * to provide to `func`.
*
* @private
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
- * @param {Object} args The arguments to provide to `func`.
+ * @param {Array} args The arguments to provide to `func`.
* @returns {number} Returns the timer id.
*/
function baseDelay(func, wait, args) {
@@ -2718,7 +2794,18 @@
}
/**
- * The base implementation of `_.gt` which doesn't coerce arguments to numbers.
+ * The base implementation of `getTag`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {string} Returns the `toStringTag`.
+ */
+ function baseGetTag(value) {
+ return objectToString.call(value);
+ }
+
+ /**
+ * The base implementation of `_.gt` which doesn't coerce arguments.
*
* @private
* @param {*} value The value to compare.
@@ -2760,7 +2847,7 @@
}
/**
- * The base implementation of `_.inRange` which doesn't coerce arguments to numbers.
+ * The base implementation of `_.inRange` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to check.
@@ -2873,6 +2960,28 @@
return func == null ? undefined : apply(func, object, args);
}
+ /**
+ * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
+ */
+ function baseIsArrayBuffer(value) {
+ return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
+ }
+
+ /**
+ * The base implementation of `_.isDate` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+ */
+ function baseIsDate(value) {
+ return isObjectLike(value) && objectToString.call(value) == dateTag;
+ }
+
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
@@ -2956,6 +3065,17 @@
return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
}
+ /**
+ * The base implementation of `_.isMap` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
+ */
+ function baseIsMap(value) {
+ return isObjectLike(value) && getTag(value) == mapTag;
+ }
+
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
@@ -3026,6 +3146,40 @@
return pattern.test(toSource(value));
}
+ /**
+ * The base implementation of `_.isRegExp` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
+ */
+ function baseIsRegExp(value) {
+ return isObject(value) && objectToString.call(value) == regexpTag;
+ }
+
+ /**
+ * The base implementation of `_.isSet` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
+ */
+ function baseIsSet(value) {
+ return isObjectLike(value) && getTag(value) == setTag;
+ }
+
+ /**
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
+ */
+ function baseIsTypedArray(value) {
+ return isObjectLike(value) &&
+ isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
+ }
+
/**
* The base implementation of `_.iteratee`.
*
@@ -3058,9 +3212,7 @@
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
- function baseKeys(object) {
- return nativeKeys(Object(object));
- }
+ var baseKeys = overArg(nativeKeys, Object);
/**
* The base implementation of `_.keysIn` which doesn't skip the constructor
@@ -3088,7 +3240,7 @@
}
/**
- * The base implementation of `_.lt` which doesn't coerce arguments to numbers.
+ * The base implementation of `_.lt` which doesn't coerce arguments.
*
* @private
* @param {*} value The value to compare.
@@ -3255,18 +3407,17 @@
isCommon = false;
}
}
- stack.set(srcValue, newValue);
-
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
+ stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
+ stack['delete'](srcValue);
}
- stack['delete'](srcValue);
assignMergeValue(object, key, newValue);
}
/**
- * The base implementation of `_.nth` which doesn't coerce `n` to an integer.
+ * The base implementation of `_.nth` which doesn't coerce arguments.
*
* @private
* @param {Array} array The array to query.
@@ -3318,12 +3469,9 @@
*/
function basePick(object, props) {
object = Object(object);
- return arrayReduce(props, function(result, key) {
- if (key in object) {
- result[key] = object[key];
- }
- return result;
- }, {});
+ return basePickBy(object, props, function(value, key) {
+ return key in object;
+ });
}
/**
@@ -3331,12 +3479,12 @@
*
* @private
* @param {Object} object The source object.
+ * @param {string[]} props The property identifiers to pick from.
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
- function basePickBy(object, predicate) {
+ function basePickBy(object, props, predicate) {
var index = -1,
- props = getAllKeysIn(object),
length = props.length,
result = {};
@@ -3351,19 +3499,6 @@
return result;
}
- /**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new accessor function.
- */
- function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
- }
-
/**
* A specialized version of `baseProperty` which supports deep paths.
*
@@ -3466,7 +3601,7 @@
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
- * coerce arguments to numbers.
+ * coerce arguments.
*
* @private
* @param {number} start The start of the range.
@@ -3515,6 +3650,35 @@
return result;
}
+ /**
+ * The base implementation of `_.rest` which doesn't validate or coerce arguments.
+ *
+ * @private
+ * @param {Function} func The function to apply a rest parameter to.
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
+ * @returns {Function} Returns the new function.
+ */
+ function baseRest(func, start) {
+ start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
+ return function() {
+ var args = arguments,
+ index = -1,
+ length = nativeMax(args.length - start, 0),
+ array = Array(length);
+
+ while (++index < length) {
+ array[index] = args[start + index];
+ }
+ index = -1;
+ var otherArgs = Array(start + 1);
+ while (++index < start) {
+ otherArgs[index] = args[index];
+ }
+ otherArgs[start] = array;
+ return apply(func, this, otherArgs);
+ };
+ }
+
/**
* The base implementation of `_.set`.
*
@@ -4294,9 +4458,9 @@
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
- : source[key];
+ : undefined;
- assignValue(object, key, newValue);
+ assignValue(object, key, newValue === undefined ? source[key] : newValue);
}
return object;
}
@@ -4326,7 +4490,7 @@
var func = isArray(collection) ? arrayAggregator : baseAggregator,
accumulator = initializer ? initializer() : {};
- return func(collection, setter, getIteratee(iteratee), accumulator);
+ return func(collection, setter, getIteratee(iteratee, 2), accumulator);
};
}
@@ -4338,7 +4502,7 @@
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
- return rest(function(object, sources) {
+ return baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,
@@ -4422,14 +4586,13 @@
*
* @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 flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createBaseWrapper(func, bitmask, thisArg) {
+ function createBind(func, bitmask, thisArg) {
var isBind = bitmask & BIND_FLAG,
- Ctor = createCtorWrapper(func);
+ Ctor = createCtor(func);
function wrapper() {
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
@@ -4486,7 +4649,7 @@
* @param {Function} Ctor The constructor to wrap.
* @returns {Function} Returns the new wrapped function.
*/
- function createCtorWrapper(Ctor) {
+ function createCtor(Ctor) {
return function() {
// Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
@@ -4516,13 +4679,12 @@
*
* @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 flags. See `createWrap` for more details.
* @param {number} arity The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createCurryWrapper(func, bitmask, arity) {
- var Ctor = createCtorWrapper(func);
+ function createCurry(func, bitmask, arity) {
+ var Ctor = createCtor(func);
function wrapper() {
var length = arguments.length,
@@ -4539,8 +4701,8 @@
length -= holders.length;
if (length < arity) {
- return createRecurryWrapper(
- func, bitmask, createHybridWrapper, wrapper.placeholder, undefined,
+ return createRecurry(
+ func, bitmask, createHybrid, wrapper.placeholder, undefined,
args, holders, undefined, undefined, arity - length);
}
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
@@ -4559,18 +4721,13 @@
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object(collection);
- predicate = getIteratee(predicate, 3);
if (!isArrayLike(collection)) {
- var props = keys(collection);
+ var iteratee = getIteratee(predicate, 3);
+ collection = keys(collection);
+ predicate = function(key) { return iteratee(iterable[key], key, iterable); };
}
- var index = findIndexFunc(props || collection, function(value, key) {
- if (props) {
- key = value;
- value = iterable[key];
- }
- return predicate(value, key, iterable);
- }, fromIndex);
- return index > -1 ? collection[props ? props[index] : index] : undefined;
+ var index = findIndexFunc(collection, predicate, fromIndex);
+ return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
};
}
@@ -4582,7 +4739,7 @@
* @returns {Function} Returns the new flow function.
*/
function createFlow(fromRight) {
- return rest(function(funcs) {
+ return baseRest(function(funcs) {
funcs = baseFlatten(funcs, 1);
var length = funcs.length,
@@ -4644,8 +4801,7 @@
*
* @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 flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
@@ -4658,13 +4814,13 @@
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
+ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & ARY_FLAG,
isBind = bitmask & BIND_FLAG,
isBindKey = bitmask & BIND_KEY_FLAG,
isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG),
isFlip = bitmask & FLIP_FLAG,
- Ctor = isBindKey ? undefined : createCtorWrapper(func);
+ Ctor = isBindKey ? undefined : createCtor(func);
function wrapper() {
var length = arguments.length,
@@ -4687,8 +4843,8 @@
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
- return createRecurryWrapper(
- func, bitmask, createHybridWrapper, wrapper.placeholder, thisArg,
+ return createRecurry(
+ func, bitmask, createHybrid, wrapper.placeholder, thisArg,
args, newHolders, argPos, ary, arity - length
);
}
@@ -4705,7 +4861,7 @@
args.length = ary;
}
if (this && this !== root && this instanceof wrapper) {
- fn = Ctor || createCtorWrapper(fn);
+ fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
}
@@ -4731,13 +4887,14 @@
*
* @private
* @param {Function} operator The function to perform the operation.
+ * @param {number} [defaultValue] The value used for `undefined` arguments.
* @returns {Function} Returns the new mathematical operation function.
*/
- function createMathOperation(operator) {
+ function createMathOperation(operator, defaultValue) {
return function(value, other) {
var result;
if (value === undefined && other === undefined) {
- return 0;
+ return defaultValue;
}
if (value !== undefined) {
result = value;
@@ -4767,12 +4924,12 @@
* @returns {Function} Returns the new over function.
*/
function createOver(arrayFunc) {
- return rest(function(iteratees) {
+ return baseRest(function(iteratees) {
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
? arrayMap(iteratees[0], baseUnary(getIteratee()))
- : arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseUnary(getIteratee()));
+ : arrayMap(baseFlatten(iteratees, 1), baseUnary(getIteratee()));
- return rest(function(args) {
+ return baseRest(function(args) {
var thisArg = this;
return arrayFunc(iteratees, function(iteratee) {
return apply(iteratee, thisArg, args);
@@ -4809,16 +4966,15 @@
*
* @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 flags. See `createWrap` for more details.
* @param {*} thisArg The `this` binding of `func`.
* @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) {
+ function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & BIND_FLAG,
- Ctor = createCtorWrapper(func);
+ Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1,
@@ -4887,8 +5043,7 @@
*
* @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 flags. See `createWrap` 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`.
@@ -4900,7 +5055,7 @@
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
+ function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
var isCurry = bitmask & CURRY_FLAG,
newHolders = isCurry ? holders : undefined,
newHoldersRight = isCurry ? undefined : holders,
@@ -4923,7 +5078,7 @@
setData(result, newData);
}
result.placeholder = placeholder;
- return result;
+ return setWrapToString(result, func, bitmask);
}
/**
@@ -4952,7 +5107,7 @@
}
/**
- * Creates a set of `values`.
+ * Creates a set object of `values`.
*
* @private
* @param {Array} values The values to add to the set.
@@ -4988,7 +5143,7 @@
*
* @private
* @param {Function|string} func The function or method name to wrap.
- * @param {number} bitmask The bitmask of wrapper flags.
+ * @param {number} bitmask The bitmask flags.
* The bitmask may be composed of the following flags:
* 1 - `_.bind`
* 2 - `_.bindKey`
@@ -5008,7 +5163,7 @@
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
+ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
var isBindKey = bitmask & BIND_KEY_FLAG;
if (!isBindKey && typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
@@ -5051,16 +5206,16 @@
bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG);
}
if (!bitmask || bitmask == BIND_FLAG) {
- var result = createBaseWrapper(func, bitmask, thisArg);
+ var result = createBind(func, bitmask, thisArg);
} else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) {
- result = createCurryWrapper(func, bitmask, arity);
+ result = createCurry(func, bitmask, arity);
} else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) {
- result = createPartialWrapper(func, bitmask, thisArg, partials);
+ result = createPartial(func, bitmask, thisArg, partials);
} else {
- result = createHybridWrapper.apply(undefined, newData);
+ result = createHybrid.apply(undefined, newData);
}
var setter = data ? baseSetData : setData;
- return setter(result, newData);
+ return setWrapToString(setter(result, newData), func, bitmask);
}
/**
@@ -5087,7 +5242,7 @@
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
- if (stacked) {
+ if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
@@ -5095,6 +5250,7 @@
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
stack.set(array, other);
+ stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
@@ -5173,18 +5329,14 @@
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.
- return +object == +other;
+ case numberTag:
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
+ // Invalid dates are coerced to `NaN`.
+ return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
- case numberTag:
- // Treat `NaN` vs. `NaN` as equal.
- return (object != +object) ? other != +other : object == +other;
-
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
@@ -5208,10 +5360,12 @@
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, stack);
+ stack.set(object, other);
+ var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
+ stack['delete'](object);
+ return result;
case symbolTag:
if (symbolValueOf) {
@@ -5254,11 +5408,12 @@
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
- if (stacked) {
+ if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
+ stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
@@ -5450,9 +5605,7 @@
* @param {*} value The value to query.
* @returns {null|Object} Returns the `[[Prototype]]`.
*/
- function getPrototype(value) {
- return nativeGetPrototype(Object(value));
- }
+ var getPrototype = overArg(nativeGetPrototype, Object);
/**
* Creates an array of the own enumerable symbol properties of `object`.
@@ -5461,16 +5614,7 @@
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
- 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 = stubArray;
- }
+ var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
/**
* Creates an array of the own and inherited enumerable symbol properties
@@ -5480,7 +5624,7 @@
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
- var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) {
+ var getSymbolsIn = !nativeGetSymbols ? getSymbols : function(object) {
var result = [];
while (object) {
arrayPush(result, getSymbols(object));
@@ -5496,9 +5640,7 @@
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
- function getTag(value) {
- return objectToString.call(value);
- }
+ var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge, and promises in Node.js.
@@ -5553,6 +5695,18 @@
return { 'start': start, 'end': end };
}
+ /**
+ * Extracts wrapper details from the `source` body comment.
+ *
+ * @private
+ * @param {string} source The source to inspect.
+ * @returns {Array} Returns the wrapper details.
+ */
+ function getWrapDetails(source) {
+ var match = source.match(reWrapDetails);
+ return match ? match[1].split(reSplitDetails) : [];
+ }
+
/**
* Checks if `path` exists on `object`.
*
@@ -5683,26 +5837,32 @@
}
/**
- * Checks if `value` is a flattenable `arguments` object or array.
+ * Inserts wrapper `details` in a comment at the top of the `source` body.
*
* @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
+ * @param {string} source The source to modify.
+ * @returns {Array} details The details to insert.
+ * @returns {string} Returns the modified source.
*/
- function isFlattenable(value) {
- return isArray(value) || isArguments(value);
+ function insertWrapDetails(source, details) {
+ var length = details.length,
+ lastIndex = length - 1;
+
+ details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
+ details = details.join(length > 2 ? ', ' : ' ');
+ return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
}
/**
- * Checks if `value` is a flattenable array and not a `_.matchesProperty`
- * iteratee shorthand.
+ * Checks if `value` is a flattenable `arguments` object or array.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
- function isFlattenableIteratee(value) {
- return isArray(value) && !(value.length == 2 && !isFunction(value[0]));
+ function isFlattenable(value) {
+ return isArray(value) || isArguments(value) ||
+ !!(spreadableSymbol && value && value[spreadableSymbol])
}
/**
@@ -5952,7 +6112,10 @@
*/
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
- baseMerge(objValue, srcValue, undefined, mergeDefaults, stack.set(srcValue, objValue));
+ // Recursively merge objects and arrays (susceptible to call stack limits).
+ stack.set(srcValue, objValue);
+ baseMerge(objValue, srcValue, undefined, mergeDefaults, stack);
+ stack['delete'](srcValue);
}
return objValue;
}
@@ -6025,6 +6188,25 @@
};
}());
+ /**
+ * Sets the `toString` method of `wrapper` to mimic the source of `reference`
+ * with wrapper details in a comment at the top of the source body.
+ *
+ * @private
+ * @param {Function} wrapper The function to modify.
+ * @param {Function} reference The reference function.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @returns {Function} Returns `wrapper`.
+ */
+ var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) {
+ var source = (reference + '');
+ return defineProperty(wrapper, 'toString', {
+ 'configurable': true,
+ 'enumerable': false,
+ 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)))
+ });
+ };
+
/**
* Converts `string` to a property path array.
*
@@ -6074,6 +6256,24 @@
return '';
}
+ /**
+ * Updates wrapper `details` based on `bitmask` flags.
+ *
+ * @private
+ * @returns {Array} details The details to modify.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @returns {Array} Returns `details`.
+ */
+ function updateWrapDetails(details, bitmask) {
+ arrayEach(wrapFlags, function(pair) {
+ var value = '_.' + pair[0];
+ if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
+ details.push(value);
+ }
+ });
+ return details.sort();
+ }
+
/**
* Creates a clone of `wrapper`.
*
@@ -6202,11 +6402,13 @@
}
/**
- * 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 `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.
*
+ * **Note:** Unlike `_.pullAll`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 0.1.0
@@ -6220,7 +6422,7 @@
* _.difference([2, 1], [2, 3]);
* // => [1]
*/
- var difference = rest(function(array, values) {
+ var difference = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
: [];
@@ -6232,14 +6434,15 @@
* by which they're compared. Result values are chosen from the first array.
* The iteratee is invoked with one argument: (value).
*
+ * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
*
@@ -6250,13 +6453,13 @@
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
* // => [{ 'x': 2 }]
*/
- var differenceBy = rest(function(array, values) {
+ var differenceBy = baseRest(function(array, values) {
var iteratee = last(values);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
return isArrayLikeObject(array)
- ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee))
+ ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
: [];
});
@@ -6266,6 +6469,8 @@
* are chosen from the first array. The comparator is invoked with two arguments:
* (arrVal, othVal).
*
+ * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 4.0.0
@@ -6281,7 +6486,7 @@
* _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
* // => [{ 'x': 2, 'y': 1 }]
*/
- var differenceWith = rest(function(array, values) {
+ var differenceWith = baseRest(function(array, values) {
var comparator = last(values);
if (isArrayLikeObject(comparator)) {
comparator = undefined;
@@ -6370,8 +6575,7 @@
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -6412,7 +6616,7 @@
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
@@ -6494,7 +6698,7 @@
* @since 1.1.0
* @category Array
* @param {Array} array The array to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
@@ -6542,7 +6746,7 @@
* @since 2.0.0
* @category Array
* @param {Array} array The array to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=array.length-1] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
@@ -6663,8 +6867,8 @@
* @returns {Object} Returns the new object.
* @example
*
- * _.fromPairs([['fred', 30], ['barney', 40]]);
- * // => { 'fred': 30, 'barney': 40 }
+ * _.fromPairs([['a', 1], ['b', 2]]);
+ * // => { 'a': 1, 'b': 2 }
*/
function fromPairs(pairs) {
var index = -1,
@@ -6770,7 +6974,7 @@
* _.intersection([2, 1], [2, 3]);
* // => [2]
*/
- var intersection = rest(function(arrays) {
+ var intersection = baseRest(function(arrays) {
var mapped = arrayMap(arrays, castArrayLikeObject);
return (mapped.length && mapped[0] === arrays[0])
? baseIntersection(mapped)
@@ -6788,8 +6992,7 @@
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of intersecting values.
* @example
*
@@ -6800,7 +7003,7 @@
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 1 }]
*/
- var intersectionBy = rest(function(arrays) {
+ var intersectionBy = baseRest(function(arrays) {
var iteratee = last(arrays),
mapped = arrayMap(arrays, castArrayLikeObject);
@@ -6810,7 +7013,7 @@
mapped.pop();
}
return (mapped.length && mapped[0] === arrays[0])
- ? baseIntersection(mapped, getIteratee(iteratee))
+ ? baseIntersection(mapped, getIteratee(iteratee, 2))
: [];
});
@@ -6835,7 +7038,7 @@
* _.intersectionWith(objects, others, _.isEqual);
* // => [{ 'x': 1, 'y': 2 }]
*/
- var intersectionWith = rest(function(arrays) {
+ var intersectionWith = baseRest(function(arrays) {
var comparator = last(arrays),
mapped = arrayMap(arrays, castArrayLikeObject);
@@ -6923,7 +7126,7 @@
) + 1;
}
if (value !== value) {
- return indexOfNaN(array, index - 1, true);
+ return baseFindIndex(array, baseIsNaN, index - 1, true);
}
while (index--) {
if (array[index] === value) {
@@ -6981,7 +7184,7 @@
* console.log(array);
* // => ['b', 'b']
*/
- var pull = rest(pullAll);
+ var pull = baseRest(pullAll);
/**
* This method is like `_.pull` except that it accepts an array of values to remove.
@@ -7022,7 +7225,7 @@
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {Array} Returns `array`.
* @example
@@ -7035,7 +7238,7 @@
*/
function pullAllBy(array, values, iteratee) {
return (array && array.length && values && values.length)
- ? basePullAll(array, values, getIteratee(iteratee))
+ ? basePullAll(array, values, getIteratee(iteratee, 2))
: array;
}
@@ -7092,7 +7295,7 @@
* console.log(pulled);
* // => ['b', 'd']
*/
- var pullAt = rest(function(array, indexes) {
+ var pullAt = baseRest(function(array, indexes) {
indexes = baseFlatten(indexes, 1);
var length = array ? array.length : 0,
@@ -7118,7 +7321,7 @@
* @since 2.0.0
* @category Array
* @param {Array} array The array to modify.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the new array of removed elements.
* @example
@@ -7246,7 +7449,7 @@
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
@@ -7262,7 +7465,7 @@
* // => 0
*/
function sortedIndexBy(array, value, iteratee) {
- return baseSortedIndexBy(array, value, getIteratee(iteratee));
+ return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
}
/**
@@ -7325,7 +7528,7 @@
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
@@ -7341,7 +7544,7 @@
* // => 1
*/
function sortedLastIndexBy(array, value, iteratee) {
- return baseSortedIndexBy(array, value, getIteratee(iteratee), true);
+ return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
}
/**
@@ -7410,7 +7613,7 @@
*/
function sortedUniqBy(array, iteratee) {
return (array && array.length)
- ? baseSortedUniq(array, getIteratee(iteratee))
+ ? baseSortedUniq(array, getIteratee(iteratee, 2))
: [];
}
@@ -7510,7 +7713,7 @@
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
@@ -7552,7 +7755,7 @@
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
@@ -7600,14 +7803,15 @@
* _.union([2], [1, 2]);
* // => [2, 1]
*/
- var union = rest(function(arrays) {
+ var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
/**
* 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:
+ * which uniqueness is computed. Result values are chosen from the first
+ * array in which the value occurs. The iteratee is invoked with one argument:
* (value).
*
* @static
@@ -7615,7 +7819,7 @@
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {Array} Returns the new array of combined values.
* @example
@@ -7627,17 +7831,18 @@
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 1 }, { 'x': 2 }]
*/
- var unionBy = rest(function(arrays) {
+ var unionBy = baseRest(function(arrays) {
var iteratee = last(arrays);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
- return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee));
+ return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
});
/**
* This method is like `_.union` except that it accepts `comparator` which
- * is invoked to compare elements of `arrays`. The comparator is invoked
+ * is invoked to compare elements of `arrays`. Result values are chosen from
+ * the first array in which the value occurs. The comparator is invoked
* with two arguments: (arrVal, othVal).
*
* @static
@@ -7655,7 +7860,7 @@
* _.unionWith(objects, others, _.isEqual);
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
*/
- var unionWith = rest(function(arrays) {
+ var unionWith = baseRest(function(arrays) {
var comparator = last(arrays);
if (isArrayLikeObject(comparator)) {
comparator = undefined;
@@ -7696,7 +7901,7 @@
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
* @example
@@ -7710,7 +7915,7 @@
*/
function uniqBy(array, iteratee) {
return (array && array.length)
- ? baseUniq(array, getIteratee(iteratee))
+ ? baseUniq(array, getIteratee(iteratee, 2))
: [];
}
@@ -7752,11 +7957,11 @@
* @returns {Array} Returns the new array of regrouped elements.
* @example
*
- * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
- * // => [['fred', 30, true], ['barney', 40, false]]
+ * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
+ * // => [['a', 1, true], ['b', 2, false]]
*
* _.unzip(zipped);
- * // => [['fred', 'barney'], [30, 40], [true, false]]
+ * // => [['a', 'b'], [1, 2], [true, false]]
*/
function unzip(array) {
if (!(array && array.length)) {
@@ -7813,6 +8018,8 @@
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
*
+ * **Note:** Unlike `_.pull`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 0.1.0
@@ -7826,7 +8033,7 @@
* _.without([2, 1, 2, 3], 1, 2);
* // => [3]
*/
- var without = rest(function(array, values) {
+ var without = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, values)
: [];
@@ -7850,7 +8057,7 @@
* _.xor([2, 1], [2, 3]);
* // => [1, 3]
*/
- var xor = rest(function(arrays) {
+ var xor = baseRest(function(arrays) {
return baseXor(arrayFilter(arrays, isArrayLikeObject));
});
@@ -7865,7 +8072,7 @@
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
@@ -7877,12 +8084,12 @@
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 2 }]
*/
- var xorBy = rest(function(arrays) {
+ var xorBy = baseRest(function(arrays) {
var iteratee = last(arrays);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
- return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee));
+ return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
});
/**
@@ -7905,7 +8112,7 @@
* _.xorWith(objects, others, _.isEqual);
* // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
*/
- var xorWith = rest(function(arrays) {
+ var xorWith = baseRest(function(arrays) {
var comparator = last(arrays);
if (isArrayLikeObject(comparator)) {
comparator = undefined;
@@ -7926,10 +8133,10 @@
* @returns {Array} Returns the new array of grouped elements.
* @example
*
- * _.zip(['fred', 'barney'], [30, 40], [true, false]);
- * // => [['fred', 30, true], ['barney', 40, false]]
+ * _.zip(['a', 'b'], [1, 2], [true, false]);
+ * // => [['a', 1, true], ['b', 2, false]]
*/
- var zip = rest(unzip);
+ var zip = baseRest(unzip);
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
@@ -7989,7 +8196,7 @@
* });
* // => [111, 222]
*/
- var zipWith = rest(function(arrays) {
+ var zipWith = baseRest(function(arrays) {
var length = arrays.length,
iteratee = length > 1 ? arrays[length - 1] : undefined;
@@ -8105,7 +8312,7 @@
* _(object).at(['a[0].b.c', 'a[1]']).value();
* // => [3, 4]
*/
- var wrapperAt = rest(function(paths) {
+ var wrapperAt = baseRest(function(paths) {
paths = baseFlatten(paths, 1);
var length = paths.length,
start = length ? paths[0] : 0,
@@ -8358,7 +8565,7 @@
* @since 0.5.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
@@ -8384,7 +8591,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [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,
@@ -8424,12 +8631,14 @@
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
+ * **Note:** Unlike `_.remove`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
@@ -8470,7 +8679,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
@@ -8508,7 +8717,7 @@
* @since 2.0.0
* @category Collection
* @param {Array|Object} collection The collection to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=collection.length-1] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
@@ -8531,7 +8740,7 @@
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
@@ -8556,7 +8765,7 @@
* @since 4.7.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
@@ -8581,7 +8790,7 @@
* @since 4.7.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The function invoked per iteration.
* @param {number} [depth=1] The maximum recursion depth.
* @returns {Array} Returns the new flattened array.
@@ -8671,7 +8880,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
@@ -8715,10 +8924,10 @@
* _.includes([1, 2, 3], 1, 2);
* // => false
*
- * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
+ * _.includes({ 'a': 1, 'b': 2 }, 1);
* // => true
*
- * _.includes('pebbles', 'eb');
+ * _.includes('abcd', 'bc');
* // => true
*/
function includes(collection, value, fromIndex, guard) {
@@ -8737,8 +8946,8 @@
/**
* Invokes the method at `path` of each element in `collection`, returning
* an array of the results of each invoked method. Any additional arguments
- * are provided to each invoked method. If `methodName` is a function, it's
- * invoked for and `this` bound to, each element in `collection`.
+ * are provided to each invoked method. If `path` is a function, it's invoked
+ * for, and `this` bound to, each element in `collection`.
*
* @static
* @memberOf _
@@ -8757,7 +8966,7 @@
* _.invokeMap([123, 456], String.prototype.split, '');
* // => [['1', '2', '3'], ['4', '5', '6']]
*/
- var invokeMap = rest(function(collection, path, args) {
+ var invokeMap = baseRest(function(collection, path, args) {
var index = -1,
isFunc = typeof path == 'function',
isProp = isKey(path),
@@ -8781,7 +8990,7 @@
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
@@ -8822,8 +9031,7 @@
* @since 0.1.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 {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
* @example
*
@@ -8905,8 +9113,7 @@
* @since 3.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the array of grouped elements.
* @example
*
@@ -9017,8 +9224,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.filter
* @example
@@ -9045,10 +9251,7 @@
*/
function reject(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
- predicate = getIteratee(predicate, 3);
- return func(collection, function(value, index, collection) {
- return !predicate(value, index, collection);
- });
+ return func(collection, negate(getIteratee(predicate, 3)));
}
/**
@@ -9181,8 +9384,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [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`.
@@ -9227,8 +9429,8 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [iteratees=[_.identity]] The iteratees to sort by.
+ * @param {...(Function|Function[])} [iteratees=[_.identity]]
+ * The iteratees to sort by.
* @returns {Array} Returns the new sorted array.
* @example
*
@@ -9250,7 +9452,7 @@
* });
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*/
- var sortBy = rest(function(collection, iteratees) {
+ var sortBy = baseRest(function(collection, iteratees) {
if (collection == null) {
return [];
}
@@ -9260,11 +9462,7 @@
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
iteratees = [iteratees[0]];
}
- iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
- ? iteratees[0]
- : baseFlatten(iteratees, 1, isFlattenableIteratee);
-
- return baseOrderBy(collection, iteratees, []);
+ return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
});
/*------------------------------------------------------------------------*/
@@ -9347,7 +9545,7 @@
function ary(func, n, guard) {
n = guard ? undefined : n;
n = (func && n == null) ? func.length : n;
- return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
+ return createWrap(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
}
/**
@@ -9365,7 +9563,7 @@
* @example
*
* jQuery(element).on('click', _.before(5, addContactToList));
- * // => allows adding up to 4 contacts to the list
+ * // => Allows adding up to 4 contacts to the list.
*/
function before(n, func) {
var result;
@@ -9404,9 +9602,9 @@
* @returns {Function} Returns the new bound function.
* @example
*
- * var greet = function(greeting, punctuation) {
+ * function greet(greeting, punctuation) {
* return greeting + ' ' + this.user + punctuation;
- * };
+ * }
*
* var object = { 'user': 'fred' };
*
@@ -9419,13 +9617,13 @@
* bound('hi');
* // => 'hi fred!'
*/
- var bind = rest(function(func, thisArg, partials) {
+ var bind = baseRest(function(func, thisArg, partials) {
var bitmask = BIND_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bind));
bitmask |= PARTIAL_FLAG;
}
- return createWrapper(func, bitmask, thisArg, partials, holders);
+ return createWrap(func, bitmask, thisArg, partials, holders);
});
/**
@@ -9473,13 +9671,13 @@
* bound('hi');
* // => 'hiya fred!'
*/
- var bindKey = rest(function(object, key, partials) {
+ var bindKey = baseRest(function(object, key, partials) {
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= PARTIAL_FLAG;
}
- return createWrapper(key, bitmask, object, partials, holders);
+ return createWrap(key, bitmask, object, partials, holders);
});
/**
@@ -9525,7 +9723,7 @@
*/
function curry(func, arity, guard) {
arity = guard ? undefined : arity;
- var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
+ var result = createWrap(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curry.placeholder;
return result;
}
@@ -9570,7 +9768,7 @@
*/
function curryRight(func, arity, guard) {
arity = guard ? undefined : arity;
- var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
+ var result = createWrap(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curryRight.placeholder;
return result;
}
@@ -9708,6 +9906,9 @@
}
function cancel() {
+ if (timerId !== undefined) {
+ clearTimeout(timerId);
+ }
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined;
}
@@ -9762,7 +9963,7 @@
* }, 'deferred');
* // => Logs 'deferred' after one or more milliseconds.
*/
- var defer = rest(function(func, args) {
+ var defer = baseRest(function(func, args) {
return baseDelay(func, 1, args);
});
@@ -9785,7 +9986,7 @@
* }, 1000, 'later');
* // => Logs 'later' after one second.
*/
- var delay = rest(function(func, wait, args) {
+ var delay = baseRest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
});
@@ -9808,7 +10009,7 @@
* // => ['d', 'c', 'b', 'a']
*/
function flip(func) {
- return createWrapper(func, FLIP_FLAG);
+ return createWrap(func, FLIP_FLAG);
}
/**
@@ -9903,7 +10104,14 @@
throw new TypeError(FUNC_ERROR_TEXT);
}
return function() {
- return !predicate.apply(this, arguments);
+ var args = arguments;
+ switch (args.length) {
+ case 0: return !predicate.call(this);
+ case 1: return !predicate.call(this, args[0]);
+ case 2: return !predicate.call(this, args[0], args[1]);
+ case 3: return !predicate.call(this, args[0], args[1], args[2]);
+ }
+ return !predicate.apply(this, args);
};
}
@@ -9923,23 +10131,22 @@
* var initialize = _.once(createApplication);
* initialize();
* initialize();
- * // `initialize` invokes `createApplication` once
+ * // => `createApplication` is invoked once
*/
function once(func) {
return before(2, func);
}
/**
- * Creates a function that invokes `func` with arguments transformed by
- * corresponding `transforms`.
+ * Creates a function that invokes `func` with its arguments transformed.
*
* @static
* @since 4.0.0
* @memberOf _
* @category Function
* @param {Function} func The function to wrap.
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [transforms[_.identity]] The functions to transform.
+ * @param {...(Function|Function[])} [transforms=[_.identity]]
+ * The argument transforms.
* @returns {Function} Returns the new function.
* @example
*
@@ -9961,13 +10168,13 @@
* func(10, 5);
* // => [100, 10]
*/
- var overArgs = rest(function(func, transforms) {
+ var overArgs = baseRest(function(func, transforms) {
transforms = (transforms.length == 1 && isArray(transforms[0]))
? arrayMap(transforms[0], baseUnary(getIteratee()))
- : arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseUnary(getIteratee()));
+ : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
var funcsLength = transforms.length;
- return rest(function(args) {
+ return baseRest(function(args) {
var index = -1,
length = nativeMin(args.length, funcsLength);
@@ -9998,9 +10205,9 @@
* @returns {Function} Returns the new partially applied function.
* @example
*
- * var greet = function(greeting, name) {
+ * function greet(greeting, name) {
* return greeting + ' ' + name;
- * };
+ * }
*
* var sayHelloTo = _.partial(greet, 'hello');
* sayHelloTo('fred');
@@ -10011,9 +10218,9 @@
* greetFred('hi');
* // => 'hi fred'
*/
- var partial = rest(function(func, partials) {
+ var partial = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partial));
- return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);
+ return createWrap(func, PARTIAL_FLAG, undefined, partials, holders);
});
/**
@@ -10035,9 +10242,9 @@
* @returns {Function} Returns the new partially applied function.
* @example
*
- * var greet = function(greeting, name) {
+ * function greet(greeting, name) {
* return greeting + ' ' + name;
- * };
+ * }
*
* var greetFred = _.partialRight(greet, 'fred');
* greetFred('hi');
@@ -10048,9 +10255,9 @@
* sayHelloTo('fred');
* // => 'hello fred'
*/
- var partialRight = rest(function(func, partials) {
+ var partialRight = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partialRight));
- return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
+ return createWrap(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
});
/**
@@ -10075,8 +10282,8 @@
* rearged('b', 'c', 'a')
* // => ['a', 'b', 'c']
*/
- var rearg = rest(function(func, indexes) {
- return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1));
+ var rearg = baseRest(function(func, indexes) {
+ return createWrap(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1));
});
/**
@@ -10108,29 +10315,8 @@
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
- start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);
- return function() {
- var args = arguments,
- index = -1,
- length = nativeMax(args.length - start, 0),
- array = Array(length);
-
- while (++index < length) {
- array[index] = args[start + index];
- }
- switch (start) {
- case 0: return func.call(this, array);
- case 1: return func.call(this, args[0], array);
- case 2: return func.call(this, args[0], args[1], array);
- }
- var otherArgs = Array(start + 1);
- index = -1;
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = array;
- return apply(func, this, otherArgs);
- };
+ start = start === undefined ? start : toInteger(start);
+ return baseRest(func, start);
}
/**
@@ -10172,7 +10358,7 @@
throw new TypeError(FUNC_ERROR_TEXT);
}
start = start === undefined ? 0 : nativeMax(toInteger(start), 0);
- return rest(function(args) {
+ return baseRest(function(args) {
var array = args[start],
otherArgs = castSlice(args, 0, start);
@@ -10262,10 +10448,10 @@
}
/**
- * Creates a function that provides `value` to the wrapper function as its
- * first argument. Any additional arguments provided to the function are
- * appended to those provided to the wrapper function. The wrapper is invoked
- * with the `this` binding of the created function.
+ * Creates a function that provides `value` to `wrapper` as its first
+ * argument. Any additional arguments provided to the function are appended
+ * to those provided to the `wrapper`. The wrapper is invoked with the `this`
+ * binding of the created function.
*
* @static
* @memberOf _
@@ -10450,6 +10636,32 @@
return baseClone(value, true, true, customizer);
}
+ /**
+ * Checks if `object` conforms to `source` by invoking the predicate properties
+ * of `source` with the corresponding property values of `object`. This method
+ * is equivalent to a `_.conforms` function when `source` is partially applied.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.14.0
+ * @category Lang
+ * @param {Object} object The object to inspect.
+ * @param {Object} source The object of property predicates to conform to.
+ * @returns {boolean} Returns `true` if `object` conforms, else `false`.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': 2 };
+ *
+ * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
+ * // => true
+ *
+ * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
+ * // => false
+ */
+ function conformsTo(object, source) {
+ return source == null || baseConformsTo(object, source, keys(source));
+ }
+
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -10464,8 +10676,8 @@
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
- * var object = { 'user': 'fred' };
- * var other = { 'user': 'fred' };
+ * var object = { 'a': 1 };
+ * var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
@@ -10546,7 +10758,7 @@
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
@@ -10568,11 +10780,9 @@
* @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 an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
@@ -10597,8 +10807,7 @@
* @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 an array buffer, else `false`.
* @example
*
* _.isArrayBuffer(new ArrayBuffer(2));
@@ -10607,9 +10816,7 @@
* _.isArrayBuffer(new Array(2));
* // => false
*/
- function isArrayBuffer(value) {
- return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
- }
+ var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
@@ -10677,8 +10884,7 @@
* @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 a boolean, else `false`.
* @example
*
* _.isBoolean(false);
@@ -10709,9 +10915,7 @@
* _.isBuffer(new Uint8Array(2));
* // => false
*/
- var isBuffer = !Buffer ? stubFalse : function(value) {
- return value instanceof Buffer;
- };
+ var isBuffer = nativeIsBuffer || stubFalse;
/**
* Checks if `value` is classified as a `Date` object.
@@ -10721,8 +10925,7 @@
* @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 a date object, else `false`.
* @example
*
* _.isDate(new Date);
@@ -10731,9 +10934,7 @@
* _.isDate('Mon April 23 2012');
* // => false
*/
- function isDate(value) {
- return isObjectLike(value) && objectToString.call(value) == dateTag;
- }
+ var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
/**
* Checks if `value` is likely a DOM element.
@@ -10830,8 +11031,8 @@
* else `false`.
* @example
*
- * var object = { 'user': 'fred' };
- * var other = { 'user': 'fred' };
+ * var object = { 'a': 1 };
+ * var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
@@ -10948,8 +11149,7 @@
* @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 a function, else `false`.
* @example
*
* _.isFunction(_);
@@ -11094,8 +11294,7 @@
* @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 a map, else `false`.
* @example
*
* _.isMap(new Map);
@@ -11104,9 +11303,7 @@
* _.isMap(new WeakMap);
* // => false
*/
- function isMap(value) {
- return isObjectLike(value) && getTag(value) == mapTag;
- }
+ var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
/**
* Performs a partial deep comparison between `object` and `source` to
@@ -11124,12 +11321,12 @@
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
* @example
*
- * var object = { 'user': 'fred', 'age': 40 };
+ * var object = { 'a': 1, 'b': 2 };
*
- * _.isMatch(object, { 'age': 40 });
+ * _.isMatch(object, { 'b': 2 });
* // => true
*
- * _.isMatch(object, { 'age': 36 });
+ * _.isMatch(object, { 'b': 1 });
* // => false
*/
function isMatch(object, source) {
@@ -11211,13 +11408,13 @@
/**
* Checks if `value` is a pristine native function.
*
- * **Note:** This method can't reliably detect native functions in the
- * presence of the `core-js` package because `core-js` circumvents this kind
- * of detection. Despite multiple requests, the `core-js` maintainer has made
- * it clear: any attempt to fix the detection will be obstructed. As a result,
- * we're left with little choice but to throw an error. Unfortunately, this
- * also affects packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
- * which rely on `core-js`.
+ * **Note:** This method can't reliably detect native functions in the presence
+ * of the core-js package because core-js circumvents this kind of detection.
+ * Despite multiple requests, the core-js maintainer has made it clear: any
+ * attempt to fix the detection will be obstructed. As a result, we're left
+ * with little choice but to throw an error. Unfortunately, this also affects
+ * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
+ * which rely on core-js.
*
* @static
* @memberOf _
@@ -11236,7 +11433,7 @@
*/
function isNative(value) {
if (isMaskable(value)) {
- throw new Error('This method is not supported with `core-js`. Try https://github.com/es-shims.');
+ throw new Error('This method is not supported with core-js. Try https://github.com/es-shims.');
}
return baseIsNative(value);
}
@@ -11297,8 +11494,7 @@
* @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 a number, else `false`.
* @example
*
* _.isNumber(3);
@@ -11369,8 +11565,7 @@
* @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 a regexp, else `false`.
* @example
*
* _.isRegExp(/abc/);
@@ -11379,9 +11574,7 @@
* _.isRegExp('/abc/');
* // => false
*/
- function isRegExp(value) {
- return isObject(value) && objectToString.call(value) == regexpTag;
- }
+ var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
/**
* Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
@@ -11423,8 +11616,7 @@
* @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 a set, else `false`.
* @example
*
* _.isSet(new Set);
@@ -11433,9 +11625,7 @@
* _.isSet(new WeakSet);
* // => false
*/
- function isSet(value) {
- return isObjectLike(value) && getTag(value) == setTag;
- }
+ var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
/**
* Checks if `value` is classified as a `String` primitive or object.
@@ -11445,8 +11635,7 @@
* @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 a string, else `false`.
* @example
*
* _.isString('abc');
@@ -11468,8 +11657,7 @@
* @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 a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
@@ -11491,8 +11679,7 @@
* @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 a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
@@ -11501,10 +11688,7 @@
* _.isTypedArray([]);
* // => false
*/
- function isTypedArray(value) {
- return isObjectLike(value) &&
- isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
- }
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
/**
* Checks if `value` is `undefined`.
@@ -11535,8 +11719,7 @@
* @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 a weak map, else `false`.
* @example
*
* _.isWeakMap(new WeakMap);
@@ -11557,8 +11740,7 @@
* @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 a weak set, else `false`.
* @example
*
* _.isWeakSet(new WeakSet);
@@ -11907,18 +12089,18 @@
* @example
*
* function Foo() {
- * this.c = 3;
+ * this.a = 1;
* }
*
* function Bar() {
- * this.e = 5;
+ * this.c = 3;
* }
*
- * Foo.prototype.d = 4;
- * Bar.prototype.f = 6;
+ * Foo.prototype.b = 2;
+ * Bar.prototype.d = 4;
*
- * _.assign({ 'a': 1 }, new Foo, new Bar);
- * // => { 'a': 1, 'c': 3, 'e': 5 }
+ * _.assign({ 'a': 0 }, new Foo, new Bar);
+ * // => { 'a': 1, 'c': 3 }
*/
var assign = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
@@ -11950,18 +12132,18 @@
* @example
*
* function Foo() {
- * this.b = 2;
+ * this.a = 1;
* }
*
* function Bar() {
- * this.d = 4;
+ * this.c = 3;
* }
*
- * Foo.prototype.c = 3;
- * Bar.prototype.e = 5;
+ * Foo.prototype.b = 2;
+ * Bar.prototype.d = 4;
*
- * _.assignIn({ 'a': 1 }, new Foo, new Bar);
- * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }
+ * _.assignIn({ 'a': 0 }, new Foo, new Bar);
+ * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/
var assignIn = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
@@ -12055,7 +12237,7 @@
* _.at(object, ['a[0].b.c', 'a[1]']);
* // => [3, 4]
*/
- var at = rest(function(object, paths) {
+ var at = baseRest(function(object, paths) {
return baseAt(object, baseFlatten(paths, 1));
});
@@ -12116,10 +12298,10 @@
* @see _.defaultsDeep
* @example
*
- * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
- * // => { 'user': 'barney', 'age': 36 }
+ * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+ * // => { 'a': 1, 'b': 2 }
*/
- var defaults = rest(function(args) {
+ var defaults = baseRest(function(args) {
args.push(undefined, assignInDefaults);
return apply(assignInWith, undefined, args);
});
@@ -12140,11 +12322,10 @@
* @see _.defaults
* @example
*
- * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
- * // => { 'user': { 'name': 'barney', 'age': 36 } }
- *
+ * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
+ * // => { 'a': { 'b': 2, 'c': 3 } }
*/
- var defaultsDeep = rest(function(args) {
+ var defaultsDeep = baseRest(function(args) {
args.push(undefined, mergeDefaults);
return apply(mergeWith, undefined, args);
});
@@ -12158,8 +12339,7 @@
* @since 1.1.0
* @category Object
* @param {Object} object The object to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {string|undefined} Returns the key of the matched element,
* else `undefined`.
* @example
@@ -12198,8 +12378,7 @@
* @since 2.0.0
* @category Object
* @param {Object} object The object to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {string|undefined} Returns the key of the matched element,
* else `undefined`.
* @example
@@ -12413,7 +12592,7 @@
/**
* Gets the value at `path` of `object`. If the resolved value is
- * `undefined`, the `defaultValue` is used in its place.
+ * `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
@@ -12536,8 +12715,7 @@
* @since 4.1.0
* @category Object
* @param {Object} object The object to invert.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Object} Returns the new inverted object.
* @example
*
@@ -12577,7 +12755,7 @@
* _.invoke(object, 'a[0].b.c.slice', 1, 3);
* // => [2, 3]
*/
- var invoke = rest(baseInvoke);
+ var invoke = baseRest(baseInvoke);
/**
* Creates an array of the own enumerable property names of `object`.
@@ -12681,8 +12859,7 @@
* @since 3.8.0
* @category Object
* @param {Object} object The object to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @see _.mapValues
* @example
@@ -12713,8 +12890,7 @@
* @since 2.4.0
* @category Object
* @param {Object} object The object to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @see _.mapKeys
* @example
@@ -12761,16 +12937,16 @@
* @returns {Object} Returns `object`.
* @example
*
- * var users = {
- * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
+ * var object = {
+ * 'a': [{ 'b': 2 }, { 'd': 4 }]
* };
*
- * var ages = {
- * 'data': [{ 'age': 36 }, { 'age': 40 }]
+ * var other = {
+ * 'a': [{ 'c': 3 }, { 'e': 5 }]
* };
*
- * _.merge(users, ages);
- * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
+ * _.merge(object, other);
+ * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
*/
var merge = createAssigner(function(object, source, srcIndex) {
baseMerge(object, source, srcIndex);
@@ -12801,18 +12977,11 @@
* }
* }
*
- * var object = {
- * 'fruits': ['apple'],
- * 'vegetables': ['beet']
- * };
- *
- * var other = {
- * 'fruits': ['banana'],
- * 'vegetables': ['carrot']
- * };
+ * var object = { 'a': [1], 'b': [2] };
+ * var other = { 'a': [3], 'b': [4] };
*
* _.mergeWith(object, other, customizer);
- * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
+ * // => { 'a': [1, 3], 'b': [2, 4] }
*/
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
@@ -12837,7 +13006,7 @@
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
- var omit = rest(function(object, props) {
+ var omit = baseRest(function(object, props) {
if (object == null) {
return {};
}
@@ -12856,8 +13025,7 @@
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per property.
+ * @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
@@ -12867,10 +13035,7 @@
* // => { 'b': '2' }
*/
function omitBy(object, predicate) {
- predicate = getIteratee(predicate);
- return basePickBy(object, function(value, key) {
- return !predicate(value, key);
- });
+ return pickBy(object, negate(getIteratee(predicate)));
}
/**
@@ -12890,7 +13055,7 @@
* _.pick(object, ['a', 'c']);
* // => { 'a': 1, 'c': 3 }
*/
- var pick = rest(function(object, props) {
+ var pick = baseRest(function(object, props) {
return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey));
});
@@ -12903,8 +13068,7 @@
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per property.
+ * @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
@@ -12914,7 +13078,7 @@
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
- return object == null ? {} : basePickBy(object, getIteratee(predicate));
+ return object == null ? {} : basePickBy(object, getAllKeysIn(object), getIteratee(predicate));
}
/**
@@ -13539,8 +13703,9 @@
? length
: baseClamp(toInteger(position), 0, length);
+ var end = position;
position -= target.length;
- return position >= 0 && string.indexOf(target, position) == position;
+ return position >= 0 && string.slice(position, end) == target;
}
/**
@@ -13988,7 +14153,8 @@
function startsWith(string, target, position) {
string = toString(string);
position = baseClamp(toInteger(position), 0, string.length);
- return string.lastIndexOf(baseToString(target), position) == position;
+ target = baseToString(target);
+ return string.slice(position, position + target.length) == target;
}
/**
@@ -14571,7 +14737,7 @@
* elements = [];
* }
*/
- var attempt = rest(function(func, args) {
+ var attempt = baseRest(function(func, args) {
try {
return apply(func, undefined, args);
} catch (e) {
@@ -14596,16 +14762,16 @@
*
* var view = {
* 'label': 'docs',
- * 'onClick': function() {
+ * 'click': function() {
* console.log('clicked ' + this.label);
* }
* };
*
- * _.bindAll(view, ['onClick']);
- * jQuery(element).on('click', view.onClick);
+ * _.bindAll(view, ['click']);
+ * jQuery(element).on('click', view.click);
* // => Logs 'clicked docs' when clicked.
*/
- var bindAll = rest(function(object, methodNames) {
+ var bindAll = baseRest(function(object, methodNames) {
arrayEach(baseFlatten(methodNames, 1), function(key) {
key = toKey(key);
object[key] = bind(object[key], object);
@@ -14630,7 +14796,7 @@
* var func = _.cond([
* [_.matches({ 'a': 1 }), _.constant('matches A')],
* [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
- * [_.constant(true), _.constant('no match')]
+ * [_.stubTrue, _.constant('no match')]
* ]);
*
* func({ 'a': 1, 'b': 2 });
@@ -14653,7 +14819,7 @@
return [toIteratee(pair[0]), pair[1]];
});
- return rest(function(args) {
+ return baseRest(function(args) {
var index = -1;
while (++index < length) {
var pair = pairs[index];
@@ -14677,13 +14843,13 @@
* @returns {Function} Returns the new spec function.
* @example
*
- * var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40 }
+ * var objects = [
+ * { 'a': 2, 'b': 1 },
+ * { 'a': 1, 'b': 2 }
* ];
*
- * _.filter(users, _.conforms({ 'age': function(n) { return n > 38; } }));
- * // => [{ 'user': 'fred', 'age': 40 }]
+ * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
+ * // => [{ 'a': 1, 'b': 2 }]
*/
function conforms(source) {
return baseConforms(baseClone(source, true));
@@ -14714,6 +14880,30 @@
};
}
+ /**
+ * Checks `value` to determine whether a default value should be returned in
+ * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
+ * or `undefined`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.14.0
+ * @category Util
+ * @param {*} value The value to check.
+ * @param {*} defaultValue The default value.
+ * @returns {*} Returns the resolved value.
+ * @example
+ *
+ * _.defaultTo(1, 10);
+ * // => 1
+ *
+ * _.defaultTo(undefined, 10);
+ * // => 10
+ */
+ function defaultTo(value, defaultValue) {
+ return (value == null || value !== value) ? defaultValue : value;
+ }
+
/**
* Creates a function that returns the result of invoking the given functions
* with the `this` binding of the created function, where each successive
@@ -14723,7 +14913,7 @@
* @memberOf _
* @since 3.0.0
* @category Util
- * @param {...(Function|Function[])} [funcs] Functions to invoke.
+ * @param {...(Function|Function[])} [funcs] The functions to invoke.
* @returns {Function} Returns the new composite function.
* @see _.flowRight
* @example
@@ -14746,7 +14936,7 @@
* @since 3.0.0
* @memberOf _
* @category Util
- * @param {...(Function|Function[])} [funcs] Functions to invoke.
+ * @param {...(Function|Function[])} [funcs] The functions to invoke.
* @returns {Function} Returns the new composite function.
* @see _.flow
* @example
@@ -14762,7 +14952,7 @@
var flowRight = createFlow(true);
/**
- * This method returns the first argument given to it.
+ * This method returns the first argument it receives.
*
* @static
* @since 0.1.0
@@ -14772,7 +14962,7 @@
* @returns {*} Returns `value`.
* @example
*
- * var object = { 'user': 'fred' };
+ * var object = { 'a': 1 };
*
* console.log(_.identity(object) === object);
* // => true
@@ -14843,13 +15033,13 @@
* @returns {Function} Returns the new spec function.
* @example
*
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': true },
- * { 'user': 'fred', 'age': 40, 'active': false }
+ * var objects = [
+ * { 'a': 1, 'b': 2, 'c': 3 },
+ * { 'a': 4, 'b': 5, 'c': 6 }
* ];
*
- * _.filter(users, _.matches({ 'age': 40, 'active': false }));
- * // => [{ 'user': 'fred', 'age': 40, 'active': false }]
+ * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
+ * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
*/
function matches(source) {
return baseMatches(baseClone(source, true));
@@ -14871,13 +15061,13 @@
* @returns {Function} Returns the new spec function.
* @example
*
- * var users = [
- * { 'user': 'barney' },
- * { 'user': 'fred' }
+ * var objects = [
+ * { 'a': 1, 'b': 2, 'c': 3 },
+ * { 'a': 4, 'b': 5, 'c': 6 }
* ];
*
- * _.find(users, _.matchesProperty('user', 'fred'));
- * // => { 'user': 'fred' }
+ * _.find(objects, _.matchesProperty('a', 4));
+ * // => { 'a': 4, 'b': 5, 'c': 6 }
*/
function matchesProperty(path, srcValue) {
return baseMatchesProperty(path, baseClone(srcValue, true));
@@ -14907,7 +15097,7 @@
* _.map(objects, _.method(['a', 'b']));
* // => [2, 1]
*/
- var method = rest(function(path, args) {
+ var method = baseRest(function(path, args) {
return function(object) {
return baseInvoke(object, path, args);
};
@@ -14936,7 +15126,7 @@
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
* // => [2, 0]
*/
- var methodOf = rest(function(object, args) {
+ var methodOf = baseRest(function(object, args) {
return function(path) {
return baseInvoke(object, path, args);
};
@@ -15035,7 +15225,7 @@
}
/**
- * A method that returns `undefined`.
+ * This method returns `undefined`.
*
* @static
* @memberOf _
@@ -15072,7 +15262,7 @@
*/
function nthArg(n) {
n = toInteger(n);
- return rest(function(args) {
+ return baseRest(function(args) {
return baseNth(args, n);
});
}
@@ -15085,8 +15275,8 @@
* @memberOf _
* @since 4.0.0
* @category Util
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [iteratees=[_.identity]] The iteratees to invoke.
+ * @param {...(Function|Function[])} [iteratees=[_.identity]]
+ * The iteratees to invoke.
* @returns {Function} Returns the new function.
* @example
*
@@ -15105,8 +15295,8 @@
* @memberOf _
* @since 4.0.0
* @category Util
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [predicates=[_.identity]] The predicates to check.
+ * @param {...(Function|Function[])} [predicates=[_.identity]]
+ * The predicates to check.
* @returns {Function} Returns the new function.
* @example
*
@@ -15131,8 +15321,8 @@
* @memberOf _
* @since 4.0.0
* @category Util
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [predicates=[_.identity]] The predicates to check.
+ * @param {...(Function|Function[])} [predicates=[_.identity]]
+ * The predicates to check.
* @returns {Function} Returns the new function.
* @example
*
@@ -15284,7 +15474,7 @@
var rangeRight = createRange(true);
/**
- * A method that returns a new empty array.
+ * This method returns a new empty array.
*
* @static
* @memberOf _
@@ -15306,7 +15496,7 @@
}
/**
- * A method that returns `false`.
+ * This method returns `false`.
*
* @static
* @memberOf _
@@ -15323,7 +15513,7 @@
}
/**
- * A method that returns a new empty object.
+ * This method returns a new empty object.
*
* @static
* @memberOf _
@@ -15345,7 +15535,7 @@
}
/**
- * A method that returns an empty string.
+ * This method returns an empty string.
*
* @static
* @memberOf _
@@ -15362,7 +15552,7 @@
}
/**
- * A method that returns `true`.
+ * This method returns `true`.
*
* @static
* @memberOf _
@@ -15480,7 +15670,7 @@
*/
var add = createMathOperation(function(augend, addend) {
return augend + addend;
- });
+ }, 0);
/**
* Computes `number` rounded up to `precision`.
@@ -15522,7 +15712,7 @@
*/
var divide = createMathOperation(function(dividend, divisor) {
return dividend / divisor;
- });
+ }, 1);
/**
* Computes `number` rounded down to `precision`.
@@ -15581,8 +15771,7 @@
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {*} Returns the maximum value.
* @example
*
@@ -15597,7 +15786,7 @@
*/
function maxBy(array, iteratee) {
return (array && array.length)
- ? baseExtremum(array, getIteratee(iteratee), baseGt)
+ ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
: undefined;
}
@@ -15629,8 +15818,7 @@
* @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.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the mean.
* @example
*
@@ -15644,7 +15832,7 @@
* // => 5
*/
function meanBy(array, iteratee) {
- return baseMean(array, getIteratee(iteratee));
+ return baseMean(array, getIteratee(iteratee, 2));
}
/**
@@ -15681,8 +15869,7 @@
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {*} Returns the minimum value.
* @example
*
@@ -15697,7 +15884,7 @@
*/
function minBy(array, iteratee) {
return (array && array.length)
- ? baseExtremum(array, getIteratee(iteratee), baseLt)
+ ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
: undefined;
}
@@ -15718,7 +15905,7 @@
*/
var multiply = createMathOperation(function(multiplier, multiplicand) {
return multiplier * multiplicand;
- });
+ }, 1);
/**
* Computes `number` rounded to `precision`.
@@ -15760,7 +15947,7 @@
*/
var subtract = createMathOperation(function(minuend, subtrahend) {
return minuend - subtrahend;
- });
+ }, 0);
/**
* Computes the sum of the values in `array`.
@@ -15792,8 +15979,7 @@
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the sum.
* @example
*
@@ -15808,7 +15994,7 @@
*/
function sumBy(array, iteratee) {
return (array && array.length)
- ? baseSum(array, getIteratee(iteratee))
+ ? baseSum(array, getIteratee(iteratee, 2))
: 0;
}
@@ -15987,7 +16173,9 @@
lodash.cloneDeep = cloneDeep;
lodash.cloneDeepWith = cloneDeepWith;
lodash.cloneWith = cloneWith;
+ lodash.conformsTo = conformsTo;
lodash.deburr = deburr;
+ lodash.defaultTo = defaultTo;
lodash.divide = divide;
lodash.endsWith = endsWith;
lodash.eq = eq;
@@ -16228,7 +16416,7 @@
return this.reverse().find(predicate);
};
- LazyWrapper.prototype.invokeMap = rest(function(path, args) {
+ LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
if (typeof path == 'function') {
return new LazyWrapper(this);
}
@@ -16238,10 +16426,7 @@
});
LazyWrapper.prototype.reject = function(predicate) {
- predicate = getIteratee(predicate, 3);
- return this.filter(function(value) {
- return !predicate(value);
- });
+ return this.filter(negate(getIteratee(predicate)));
};
LazyWrapper.prototype.slice = function(start, end) {
@@ -16345,7 +16530,7 @@
}
});
- realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{
+ realNames[createHybrid(undefined, BIND_KEY_FLAG).name] = [{
'name': 'wrapper',
'func': undefined
}];
@@ -16364,6 +16549,9 @@
lodash.prototype.reverse = wrapperReverse;
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
+ // Add lazy aliases.
+ lodash.prototype.first = lodash.prototype.head;
+
if (iteratorSymbol) {
lodash.prototype[iteratorSymbol] = wrapperToIterator;
}
@@ -16375,22 +16563,21 @@
// Export lodash.
var _ = runInContext();
- // Expose Lodash on the free variable `window` or `self` when available so it's
- // globally accessible, even when bundled with Browserify, Webpack, etc. This
- // also prevents errors in cases where Lodash is loaded by a script tag in the
- // presence of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch
- // for more details. Use `_.noConflict` to remove Lodash from the global object.
- (freeSelf || {})._ = _;
-
- // Some AMD build optimizers like r.js check for condition patterns like the following:
+ // Some AMD build optimizers, like r.js, check for condition patterns like:
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+ // Expose Lodash on the global object to prevent errors when Lodash is
+ // loaded by a script tag in the presence of an AMD loader.
+ // See http://requirejs.org/docs/errors.html#mismatch for more details.
+ // Use `_.noConflict` to remove Lodash from the global object.
+ root._ = _;
+
// Define as an anonymous module so, through path mapping, it can be
// referenced as the "underscore" module.
define(function() {
return _;
});
}
- // Check for `exports` after `define` in case a build optimizer adds an `exports` object.
+ // Check for `exports` after `define` in case a build optimizer adds it.
else if (freeModule) {
// Export for Node.js.
(freeModule.exports = _)._ = _;
diff --git a/dist/lodash.min.js b/dist/lodash.min.js
index 018b6a7668..0d129d44ab 100644
--- a/dist/lodash.min.js
+++ b/dist/lodash.min.js
@@ -4,124 +4,127 @@
*/
;(function(){function t(t,n){return t.set(n[0],n[1]),t}function n(t,n){return t.add(n),t}function r(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}function e(t,n,r,e){for(var u=-1,o=t?t.length:0;++u=t?t:r),n!==T&&(t=t>=n?t:n)),t}function rn(t,n,r,e,o,i,f){var c;if(e&&(c=i?e(t,o,i,f):e(t)),c!==T)return c;if(!Ze(t))return t;if(o=yi(t)){if(c=Kr(t),!n)return lr(t,c)}else{var a=qr(t),l="[object Function]"==a||"[object GeneratorFunction]"==a;if(bi(t))return or(t,n);if("[object Object]"==a||"[object Arguments]"==a||l&&!i){if(C(t))return i?t:{};if(c=Gr(l?{}:t),
-!n)return hr(t,Xt(c,t))}else{if(!Ct[a])return i?t:{};c=Jr(t,a,rn,n)}}if(f||(f=new qt),i=f.get(t))return i;if(f.set(t,c),!o)var s=r?gn(t,iu,Tr):iu(t);return u(s||t,function(u,o){s&&(o=u,u=t[o]),Yt(c,o,rn(u,n,r,e,o,t,f))}),c}function en(t){var n=iu(t),r=n.length;return function(e){if(null==e)return!r;for(var u=r;u--;){var o=n[u],i=t[o],f=e[o];if(f===T&&!(o in Object(e))||!i(f))return false}return true}}function un(t){return Ze(t)?Tu(t):{}}function on(t,n,r){if(typeof t!="function")throw new Au("Expected a function");
-return At(function(){t.apply(T,r)},n)}function fn(t,n,r,e){var u=-1,o=c,i=true,f=t.length,s=[],h=n.length;if(!f)return s;r&&(n=l(n,O(r))),e?(o=a,i=false):n.length>=200&&(o=E,i=false,n=new Zt(n));t:for(;++u0&&r(f)?n>1?sn(f,n-1,r,e,u):s(u,f):e||(u[u.length]=f)}return u}function hn(t,n){return t&&ko(t,n,iu)}function pn(t,n){return t&&Eo(t,n,iu)}function _n(t,n){return f(n,function(n){return Fe(t[n])})}function vn(t,n){n=ne(n,t)?[n]:er(n);for(var r=0,e=n.length;null!=t&&e>r;)t=t[fe(n[r++])];return r&&r==e?t:T}function gn(t,n,r){
-return n=n(t),yi(t)?n:s(n,r(t))}function dn(t,n){return t>n}function yn(t,n){return null!=t&&(Wu.call(t,n)||typeof t=="object"&&n in t&&null===Ju(Object(t)))}function bn(t,n){return null!=t&&n in Object(t)}function xn(t,n,r){for(var e=r?a:c,u=t[0].length,o=t.length,i=o,f=Array(o),s=1/0,h=[];i--;){var p=t[i];i&&n&&(p=l(p,O(n))),s=to(p.length,s),f[i]=!r&&(n||u>=120&&p.length>=120)?new Zt(i&&p):T}var p=t[0],_=-1,v=f[0];t:for(;++_h.length;){var g=p[_],d=n?n(g):g,g=r||0!==g?g:0;if(v?!E(v,d):!e(h,d,r)){
-for(i=o;--i;){var y=f[i];if(y?!E(y,d):!e(t[i],d,r))continue t}v&&v.push(d),h.push(g)}}return h}function jn(t,n,r){var e={};return hn(t,function(t,u,o){n(e,r(t),u,o)}),e}function wn(t,n,e){return ne(n,t)||(n=er(n),t=ie(t,n),n=ve(n)),n=null==t?t:t[fe(n)],null==n?T:r(n,t,e)}function mn(t,n,r,e,u){if(t===n)n=true;else if(null==t||null==n||!Ze(t)&&!Te(n))n=t!==t&&n!==n;else t:{var o=yi(t),i=yi(n),f="[object Array]",c="[object Array]";o||(f=qr(t),f="[object Arguments]"==f?"[object Object]":f),i||(c=qr(n),
-c="[object Arguments]"==c?"[object Object]":c);var a="[object Object]"==f&&!C(t),i="[object Object]"==c&&!C(n);if((c=f==c)&&!a)u||(u=new qt),n=o||Ye(t)?zr(t,n,mn,r,e,u):Ur(t,n,f,mn,r,e,u);else{if(!(2&e)&&(o=a&&Wu.call(t,"__wrapped__"),f=i&&Wu.call(n,"__wrapped__"),o||f)){t=o?t.value():t,n=f?n.value():n,u||(u=new qt),n=mn(t,n,r,e,u);break t}if(c)n:if(u||(u=new qt),o=2&e,f=iu(t),i=f.length,c=iu(n).length,i==c||o){for(a=i;a--;){var l=f[a];if(!(o?l in n:yn(n,l))){n=false;break n}}if(c=u.get(t))n=c==n;else{
-c=true,u.set(t,n);for(var s=o;++at}function In(t,n){var r=-1,e=Ue(t)?Array(t.length):[];
-return Ao(t,function(t,u,o){e[++r]=n(t,u,o)}),e}function Rn(t){var n=Pr(t);return 1==n.length&&n[0][2]?ue(n[0][0],n[0][1]):function(r){return r===t||An(r,t,n)}}function Wn(t,n){return ne(t)&&n===n&&!Ze(n)?ue(fe(t),n):function(r){var e=uu(r,t);return e===T&&e===n?ou(r,t):mn(n,e,T,3)}}function Bn(t,n,r,e,o){if(t!==n){if(!yi(n)&&!Ye(n))var i=fu(n);u(i||n,function(u,f){if(i&&(f=u,u=n[f]),Ze(u)){o||(o=new qt);var c=f,a=o,l=t[c],s=n[c],h=a.get(s);if(h)Jt(t,c,h);else{var h=e?e(l,s,c+"",t,n,a):T,p=h===T;p&&(h=s,
-yi(s)||Ye(s)?yi(l)?h=l:$e(l)?h=lr(l):(p=false,h=rn(s,true)):Ve(s)||ze(s)?ze(l)?h=ru(l):!Ze(l)||r&&Fe(l)?(p=false,h=rn(s,true)):h=l:p=false),a.set(s,h),p&&Bn(h,s,r,e,a),a["delete"](s),Jt(t,c,h)}}else c=e?e(t[f],u,f+"",t,n,o):T,c===T&&(c=u),Jt(t,f,c)})}}function Ln(t,n){var r=t.length;return r?(n+=0>n?r:0,Xr(n,r)?t[n]:T):void 0}function Mn(t,n,r){var e=-1;return n=l(n.length?n:[pu],O(Fr())),t=In(t,function(t){return{a:l(n,function(n){return n(t)}),b:++e,c:t}}),j(t,function(t,n){var e;t:{e=-1;for(var u=t.a,o=n.a,i=u.length,f=r.length;++e=f?c:c*("desc"==r[e]?-1:1);break t}}e=t.b-n.b}return e})}function Cn(t,n){return t=Object(t),h(n,function(n,r){return r in t&&(n[r]=t[r]),n},{})}function zn(t,n){for(var r=-1,e=gn(t,fu,Bo),u=e.length,o={};++rn||n>9007199254740991)return r;do n%2&&(r+=t),(n=Gu(n/2))&&(t+=t);while(n);return r}function Zn(t,n,r,e){n=ne(n,t)?[n]:er(n);for(var u=-1,o=n.length,i=o-1,f=t;null!=f&&++un&&(n=-n>u?0:u+n),r=r>u?u:r,0>r&&(r+=u),u=n>r?0:r-n>>>0,n>>>=0,r=Array(u);++e=u){for(;u>e;){var o=e+u>>>1,i=t[o];null!==i&&!Je(i)&&(r?n>=i:n>i)?e=o+1:u=o}return u}
-return Kn(t,n,pu,r)}function Kn(t,n,r,e){n=r(n);for(var u=0,o=t?t.length:0,i=n!==n,f=null===n,c=Je(n),a=n===T;o>u;){var l=Gu((u+o)/2),s=r(t[l]),h=s!==T,p=null===s,_=s===s,v=Je(s);(i?e||_:a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):p||v?0:e?n>=s:n>s)?u=l+1:o=l}return to(o,4294967294)}function Gn(t,n){for(var r=-1,e=t.length,u=0,o=[];++r=200){if(u=n?null:Io(t))return D(u);i=false,u=E,l=new Zt}else l=n?[]:f;t:for(;++ee?n[e]:T);return i}function rr(t){return $e(t)?t:[]}function er(t){return yi(t)?t:Co(t)}function ur(t,n,r){var e=t.length;return r=r===T?e:r,!n&&r>=e?t:Tn(t,n,r)}function or(t,n){
-if(n)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function ir(t){var n=new t.constructor(t.byteLength);return new Fu(n).set(new Fu(t)),n}function fr(t,n){if(t!==n){var r=t!==T,e=null===t,u=t===t,o=Je(t),i=n!==T,f=null===n,c=n===n,a=Je(n);if(!f&&!a&&!o&&t>n||o&&i&&c&&!f&&!a||e&&i&&c||!r&&c||!u)return 1;if(!e&&!o&&!a&&n>t||a&&r&&u&&!e&&!o||f&&r&&u||!i&&u||!c)return-1}return 0}function cr(t,n,r,e){var u=-1,o=t.length,i=r.length,f=-1,c=n.length,a=Xu(o-i,0),l=Array(c+a);for(e=!e;++fu)&&(l[r[u]]=t[u]);for(;a--;)l[f++]=t[u++];return l}function ar(t,n,r,e){var u=-1,o=t.length,i=-1,f=r.length,c=-1,a=n.length,l=Xu(o-f,0),s=Array(l+a);for(e=!e;++uu)&&(s[l+r[i]]=t[u++]);return s}function lr(t,n){var r=-1,e=t.length;for(n||(n=Array(e));++r1?r[u-1]:T,i=u>2?r[2]:T,o=t.length>3&&typeof o=="function"?(u--,o):T;for(i&&te(r[0],r[1],i)&&(o=3>u?T:o,u=1),n=Object(n);++ei&&f[0]!==a&&f[i-1]!==a?[]:$(f,a),
-i-=c.length,e>i?Br(t,n,Ar,u.placeholder,T,f,c,T,T,e-i):r(this&&this!==Kt&&this instanceof u?o:t,this,f)}var o=xr(t);return u}function wr(t){return function(n,r,e){var u=Object(n);if(r=Fr(r,3),!Ue(n))var o=iu(n);return e=t(o||n,function(t,n){return o&&(n=t,t=u[n]),r(t,n,u)},e),e>-1?n[o?o[e]:e]:T}}function mr(t){return Me(function(n){n=sn(n,1);var r=n.length,e=r,u=zt.prototype.thru;for(t&&n.reverse();e--;){var o=n[e];if(typeof o!="function")throw new Au("Expected a function");if(u&&!i&&"wrapper"==$r(o))var i=new zt([],true);
-}for(e=i?e:r;++e=200)return i.plant(e).value();for(var u=0,t=r?n[u].apply(this,t):e;++ud)return j=$(y,j),Br(t,n,Ar,l.placeholder,r,y,j,f,c,a-d);if(j=h?r:this,b=p?j[t]:t,d=y.length,f){x=y.length;for(var w=to(f.length,x),m=lr(y);w--;){var A=f[w];y[w]=Xr(A,x)?m[A]:T}}else v&&d>1&&y.reverse();return s&&d>c&&(y.length=c),this&&this!==Kt&&this instanceof l&&(b=g||xr(b)),b.apply(j,y)}var s=128&n,h=1&n,p=2&n,_=24&n,v=512&n,g=p?T:xr(t);return l}function Or(t,n){return function(r,e){return jn(r,t,n(e))}}function kr(t){return function(n,r){var e;
-if(n===T&&r===T)return 0;if(n!==T&&(e=n),r!==T){if(e===T)return r;typeof n=="string"||typeof r=="string"?(n=Yn(n),r=Yn(r)):(n=Jn(n),r=Jn(r)),e=t(n,r)}return e}}function Er(t){return Me(function(n){return n=1==n.length&&yi(n[0])?l(n[0],O(Fr())):l(sn(n,1,Qr),O(Fr())),Me(function(e){var u=this;return t(n,function(t){return r(t,u,e)})})})}function Sr(t,n){n=n===T?" ":Yn(n);var r=n.length;return 2>r?r?Pn(n,t):n:(r=Pn(n,Ku(t/N(n))),Wt.test(n)?ur(r.match(It),0,t).join(""):r.slice(0,t))}function Ir(t,n,e,u){
-function o(){for(var n=-1,c=arguments.length,a=-1,l=u.length,s=Array(l+c),h=this&&this!==Kt&&this instanceof o?f:t;++an?1:-1:nu(e)||0;var u=-1;r=Xu(Ku((r-n)/(e||1)),0);for(var o=Array(r);r--;)o[t?r:++u]=n,n+=e;return o}}function Wr(t){return function(n,r){return typeof n=="string"&&typeof r=="string"||(n=nu(n),
-r=nu(r)),t(n,r)}}function Br(t,n,r,e,u,o,i,f,c,a){var l=8&n,s=l?i:T;i=l?T:i;var h=l?o:T;return o=l?T:o,n=(n|(l?32:64))&~(l?64:32),4&n||(n&=-4),n=[t,n,u,h,s,o,i,f,c,a],r=r.apply(T,n),re(t)&&Mo(r,n),r.placeholder=e,r}function Lr(t){var n=wu[t];return function(t,r){if(t=nu(t),r=to(Xe(r),292)){var e=(eu(t)+"e").split("e"),e=n(e[0]+"e"+(+e[1]+r)),e=(eu(e)+"e").split("e");return+(e[0]+"e"+(+e[1]-r))}return n(t)}}function Mr(t){return function(n){var r=qr(n);return"[object Map]"==r?U(n):"[object Set]"==r?F(n):A(n,t(n));
-}}function Cr(t,n,r,e,u,o,i,f){var c=2&n;if(!c&&typeof t!="function")throw new Au("Expected a function");var a=e?e.length:0;if(a||(n&=-97,e=u=T),i=i===T?i:Xu(Xe(i),0),f=f===T?f:Xe(f),a-=u?u.length:0,64&n){var l=e,s=u;e=u=T}var h=c?T:Ro(t);return o=[t,n,r,e,u,l,s,o,i,f],h&&(r=o[1],t=h[1],n=r|t,e=128==t&&8==r||128==t&&256==r&&h[8]>=o[7].length||384==t&&h[8]>=h[7].length&&8==r,131>n||e)&&(1&t&&(o[2]=h[2],n|=1&r?0:4),(r=h[3])&&(e=o[3],o[3]=e?cr(e,r,h[4]):r,o[4]=e?$(o[3],"__lodash_placeholder__"):h[4]),
-(r=h[5])&&(e=o[5],o[5]=e?ar(e,r,h[6]):r,o[6]=e?$(o[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(o[7]=r),128&t&&(o[8]=null==o[8]?h[8]:to(o[8],h[8])),null==o[9]&&(o[9]=h[9]),o[0]=h[0],o[1]=n),t=o[0],n=o[1],r=o[2],e=o[3],u=o[4],f=o[9]=null==o[9]?c?0:t.length:Xu(o[9]-a,0),!f&&24&n&&(n&=-25),(h?So:Mo)(n&&1!=n?8==n||16==n?jr(t,n,f):32!=n&&33!=n||u.length?Ar.apply(T,o):Ir(t,n,r,e):dr(t,n,r),o)}function zr(t,n,r,e,u,o){var i=2&u,f=t.length,c=n.length;if(f!=c&&!(i&&c>f))return false;if(c=o.get(t))return c==n;
-var c=-1,a=true,l=1&u?new Zt:T;for(o.set(t,n);++c-1&&0==t%1&&n>t}function te(t,n,r){if(!Ze(r))return false;var e=typeof n;return("number"==e?Ue(r)&&Xr(n,r.length):"string"==e&&n in r)?Ce(r[n],t):false}function ne(t,n){if(yi(t))return false;var r=typeof t;return"number"==r||"symbol"==r||"boolean"==r||null==t||Je(t)?true:ut.test(t)||!et.test(t)||null!=n&&t in Object(n)}function re(t){
-var n=$r(t),r=Ot[n];return typeof r=="function"&&n in Ut.prototype?t===r?true:(n=Ro(r),!!n&&t===n[0]):false}function ee(t){var n=t&&t.constructor;return t===(typeof n=="function"&&n.prototype||ku)}function ue(t,n){return function(r){return null==r?false:r[t]===n&&(n!==T||t in Object(r))}}function oe(t,n,r,e,u,o){return Ze(t)&&Ze(n)&&Bn(t,n,T,oe,o.set(n,t)),t}function ie(t,n){return 1==n.length?t:vn(t,Tn(n,0,-1))}function fe(t){if(typeof t=="string"||Je(t))return t;var n=t+"";return"0"==n&&1/t==-q?"-0":n}function ce(t){
-if(null!=t){try{return Ru.call(t)}catch(n){}return t+""}return""}function ae(t){if(t instanceof Ut)return t.clone();var n=new zt(t.__wrapped__,t.__chain__);return n.__actions__=lr(t.__actions__),n.__index__=t.__index__,n.__values__=t.__values__,n}function le(t,n,r){var e=t?t.length:0;return e?(n=r||n===T?1:Xe(n),Tn(t,0>n?0:n,e)):[]}function se(t,n,r){var e=t?t.length:0;return e?(n=r||n===T?1:Xe(n),n=e-n,Tn(t,0,0>n?0:n)):[]}function he(t,n,r){var e=t?t.length:0;return e?(r=null==r?0:Xe(r),0>r&&(r=Xu(e+r,0)),
-g(t,Fr(n,3),r)):-1}function pe(t,n,r){var e=t?t.length:0;if(!e)return-1;var u=e-1;return r!==T&&(u=Xe(r),u=0>r?Xu(e+u,0):to(u,e-1)),g(t,Fr(n,3),u,true)}function _e(t){return t&&t.length?t[0]:T}function ve(t){var n=t?t.length:0;return n?t[n-1]:T}function ge(t,n){return t&&t.length&&n&&n.length?Dn(t,n):t}function de(t){return t?uo.call(t):t}function ye(t){if(!t||!t.length)return[];var n=0;return t=f(t,function(t){return $e(t)?(n=Xu(t.length,n),true):void 0}),m(n,function(n){return l(t,Un(n))})}function be(t,n){
-if(!t||!t.length)return[];var e=ye(t);return null==n?e:l(e,function(t){return r(n,T,t)})}function xe(t){return t=Ot(t),t.__chain__=true,t}function je(t,n){return n(t)}function we(){return this}function me(t,n){return(yi(t)?u:Ao)(t,Fr(n,3))}function Ae(t,n){return(yi(t)?o:Oo)(t,Fr(n,3))}function Oe(t,n){return(yi(t)?l:In)(t,Fr(n,3))}function ke(t,n,r){var e=-1,u=He(t),o=u.length,i=o-1;for(n=(r?te(t,n,r):n===T)?1:nn(Xe(n),0,o);++e=t&&(n=T),r}}function Re(t,n,r){return n=r?T:n,t=Cr(t,8,T,T,T,T,T,n),t.placeholder=Re.placeholder,t}function We(t,n,r){return n=r?T:n,t=Cr(t,16,T,T,T,T,T,n),t.placeholder=We.placeholder,t}function Be(t,n,r){function e(n){var r=c,e=a;return c=a=T,_=n,s=t.apply(e,r);
-}function u(t){var r=t-p;return t-=_,p===T||r>=n||0>r||g&&t>=l}function o(){var t=Ee();if(u(t))return i(t);var r;r=t-_,t=n-(t-p),r=g?to(t,l-r):t,h=At(o,r)}function i(t){return h=T,d&&c?e(t):(c=a=T,s)}function f(){var t=Ee(),r=u(t);if(c=arguments,a=this,p=t,r){if(h===T)return _=t=p,h=At(o,n),v?e(t):s;if(g)return h=At(o,n),e(p)}return h===T&&(h=At(o,n)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof t!="function")throw new Au("Expected a function");return n=nu(n)||0,Ze(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Xu(nu(r.maxWait)||0,n):l,
-d="trailing"in r?!!r.trailing:d),f.cancel=function(){_=0,c=p=a=h=T},f.flush=function(){return h===T?s:i(Ee())},f}function Le(t,n){function r(){var e=arguments,u=n?n.apply(this,e):e[0],o=r.cache;return o.has(u)?o.get(u):(e=t.apply(this,e),r.cache=o.set(u,e),e)}if(typeof t!="function"||n&&typeof n!="function")throw new Au("Expected a function");return r.cache=new(Le.Cache||Pt),r}function Me(t,n){if(typeof t!="function")throw new Au("Expected a function");return n=Xu(n===T?t.length-1:Xe(n),0),function(){
-for(var e=arguments,u=-1,o=Xu(e.length-n,0),i=Array(o);++u-1&&0==t%1&&9007199254740991>=t}function Ze(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function Te(t){return!!t&&typeof t=="object"}function qe(t){return typeof t=="number"||Te(t)&&"[object Number]"==Mu.call(t);
-}function Ve(t){return!Te(t)||"[object Object]"!=Mu.call(t)||C(t)?false:(t=Ju(Object(t)),null===t?true:(t=Wu.call(t,"constructor")&&t.constructor,typeof t=="function"&&t instanceof t&&Ru.call(t)==Lu))}function Ke(t){return Ze(t)&&"[object RegExp]"==Mu.call(t)}function Ge(t){return typeof t=="string"||!yi(t)&&Te(t)&&"[object String]"==Mu.call(t)}function Je(t){return typeof t=="symbol"||Te(t)&&"[object Symbol]"==Mu.call(t)}function Ye(t){return Te(t)&&Pe(t.length)&&!!Mt[Mu.call(t)]}function He(t){if(!t)return[];
-if(Ue(t))return Ge(t)?t.match(It):lr(t);if(Zu&&t[Zu])return z(t[Zu]());var n=qr(t);return("[object Map]"==n?U:"[object Set]"==n?D:cu)(t)}function Qe(t){return t?(t=nu(t),t===q||t===-q?1.7976931348623157e308*(0>t?-1:1):t===t?t:0):0===t?t:0}function Xe(t){t=Qe(t);var n=t%1;return t===t?n?t-n:t:0}function tu(t){return t?nn(Xe(t),0,4294967295):0}function nu(t){if(typeof t=="number")return t;if(Je(t))return V;if(Ze(t)&&(t=Fe(t.valueOf)?t.valueOf():t,t=Ze(t)?t+"":t),typeof t!="string")return 0===t?t:+t;
-t=t.replace(ct,"");var n=dt.test(t);return n||bt.test(t)?Nt(t.slice(2),n?2:8):gt.test(t)?V:+t}function ru(t){return sr(t,fu(t))}function eu(t){return null==t?"":Yn(t)}function uu(t,n,r){return t=null==t?T:vn(t,n),t===T?r:t}function ou(t,n){return null!=t&&Vr(t,n,bn)}function iu(t){var n=ee(t);if(!n&&!Ue(t))return Qu(Object(t));var r,e=Yr(t),u=!!e,e=e||[],o=e.length;for(r in t)!yn(t,r)||u&&("length"==r||Xr(r,o))||n&&"constructor"==r||e.push(r);return e}function fu(t){for(var n=-1,r=ee(t),e=En(t),u=e.length,o=Yr(t),i=!!o,o=o||[],f=o.length;++nt?false:(t==n.length-1?n.pop():Vu.call(n,t,1),true)},Dt.prototype.get=function(t){
-var n=this.__data__;return t=Ht(n,t),0>t?T:n[t][1]},Dt.prototype.has=function(t){return-1e?r.push([t,n]):r[e][1]=n,this},Pt.prototype.clear=function(){this.__data__={hash:new $t,map:new(fo||Dt),string:new $t}},Pt.prototype["delete"]=function(t){return Nr(this,t)["delete"](t)},Pt.prototype.get=function(t){return Nr(this,t).get(t)},Pt.prototype.has=function(t){return Nr(this,t).has(t)},Pt.prototype.set=function(t,n){
-return Nr(this,t).set(t,n),this},Zt.prototype.add=Zt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Zt.prototype.has=function(t){return this.__data__.has(t)},qt.prototype.clear=function(){this.__data__=new Dt},qt.prototype["delete"]=function(t){return this.__data__["delete"](t)},qt.prototype.get=function(t){return this.__data__.get(t)},qt.prototype.has=function(t){return this.__data__.has(t)},qt.prototype.set=function(t,n){var r=this.__data__;return r instanceof Dt&&200==r.__data__.length&&(r=this.__data__=new Pt(r.__data__)),
-r.set(t,n),this};var Ao=vr(hn),Oo=vr(pn,true),ko=gr(),Eo=gr(true);Nu&&!qu.call({valueOf:1},"valueOf")&&(En=function(t){return z(Nu(t))});var So=ho?function(t,n){return ho.set(t,n),t}:pu,Io=ao&&1/D(new ao([,-0]))[1]==q?function(t){return new ao(t)}:gu,Ro=ho?function(t){return ho.get(t)}:gu,Wo=Un("length");Pu||(Tr=yu);var Bo=Pu?function(t){for(var n=[];t;)s(n,Tr(t)),t=Ju(Object(t));return n}:Tr;(io&&"[object DataView]"!=qr(new io(new ArrayBuffer(1)))||fo&&"[object Map]"!=qr(new fo)||co&&"[object Promise]"!=qr(co.resolve())||ao&&"[object Set]"!=qr(new ao)||lo&&"[object WeakMap]"!=qr(new lo))&&(qr=function(t){
-var n=Mu.call(t);if(t=(t="[object Object]"==n?t.constructor:T)?ce(t):T)switch(t){case vo:return"[object DataView]";case go:return"[object Map]";case yo:return"[object Promise]";case bo:return"[object Set]";case xo:return"[object WeakMap]"}return n});var Lo=Su?Fe:bu,Mo=function(){var t=0,n=0;return function(r,e){var u=Ee(),o=16-(u-n);if(n=u,o>0){if(150<=++t)return r}else t=0;return So(r,e)}}(),Co=Le(function(t){var n=[];return eu(t).replace(ot,function(t,r,e,u){n.push(e?u.replace(ht,"$1"):r||t)}),
-n}),zo=Me(function(t,n){return $e(t)?fn(t,sn(n,1,$e,true)):[]}),Uo=Me(function(t,n){var r=ve(n);return $e(r)&&(r=T),$e(t)?fn(t,sn(n,1,$e,true),Fr(r)):[]}),$o=Me(function(t,n){var r=ve(n);return $e(r)&&(r=T),$e(t)?fn(t,sn(n,1,$e,true),T,r):[]}),Do=Me(function(t){var n=l(t,rr);return n.length&&n[0]===t[0]?xn(n):[]}),Fo=Me(function(t){var n=ve(t),r=l(t,rr);return n===ve(r)?n=T:r.pop(),r.length&&r[0]===t[0]?xn(r,Fr(n)):[]}),No=Me(function(t){var n=ve(t),r=l(t,rr);return n===ve(r)?n=T:r.pop(),r.length&&r[0]===t[0]?xn(r,T,n):[];
-}),Po=Me(ge),Zo=Me(function(t,n){n=sn(n,1);var r=t?t.length:0,e=tn(t,n);return Fn(t,l(n,function(t){return Xr(t,r)?+t:t}).sort(fr)),e}),To=Me(function(t){return Hn(sn(t,1,$e,true))}),qo=Me(function(t){var n=ve(t);return $e(n)&&(n=T),Hn(sn(t,1,$e,true),Fr(n))}),Vo=Me(function(t){var n=ve(t);return $e(n)&&(n=T),Hn(sn(t,1,$e,true),T,n)}),Ko=Me(function(t,n){return $e(t)?fn(t,n):[]}),Go=Me(function(t){return tr(f(t,$e))}),Jo=Me(function(t){var n=ve(t);return $e(n)&&(n=T),tr(f(t,$e),Fr(n))}),Yo=Me(function(t){
-var n=ve(t);return $e(n)&&(n=T),tr(f(t,$e),T,n)}),Ho=Me(ye),Qo=Me(function(t){var n=t.length,n=n>1?t[n-1]:T,n=typeof n=="function"?(t.pop(),n):T;return be(t,n)}),Xo=Me(function(t){function n(n){return tn(n,t)}t=sn(t,1);var r=t.length,e=r?t[0]:0,u=this.__wrapped__;return!(r>1||this.__actions__.length)&&u instanceof Ut&&Xr(e)?(u=u.slice(e,+e+(r?1:0)),u.__actions__.push({func:je,args:[n],thisArg:T}),new zt(u,this.__chain__).thru(function(t){return r&&!t.length&&t.push(T),t})):this.thru(n)}),ti=pr(function(t,n,r){
-Wu.call(t,r)?++t[r]:t[r]=1}),ni=wr(he),ri=wr(pe),ei=pr(function(t,n,r){Wu.call(t,r)?t[r].push(n):t[r]=[n]}),ui=Me(function(t,n,e){var u=-1,o=typeof n=="function",i=ne(n),f=Ue(t)?Array(t.length):[];return Ao(t,function(t){var c=o?n:i&&null!=t?t[n]:T;f[++u]=c?r(c,t,e):wn(t,n,e)}),f}),oi=pr(function(t,n,r){t[r]=n}),ii=pr(function(t,n,r){t[r?0:1].push(n)},function(){return[[],[]]}),fi=Me(function(t,n){if(null==t)return[];var r=n.length;return r>1&&te(t,n[0],n[1])?n=[]:r>2&&te(n[0],n[1],n[2])&&(n=[n[0]]),
-n=1==n.length&&yi(n[0])?n[0]:sn(n,1,Qr),Mn(t,n,[])}),ci=Me(function(t,n,r){var e=1;if(r.length)var u=$(r,Dr(ci)),e=32|e;return Cr(t,e,n,r,u)}),ai=Me(function(t,n,r){var e=3;if(r.length)var u=$(r,Dr(ai)),e=32|e;return Cr(n,e,t,r,u)}),li=Me(function(t,n){return on(t,1,n)}),si=Me(function(t,n,r){return on(t,nu(n)||0,r)});Le.Cache=Pt;var hi=Me(function(t,n){n=1==n.length&&yi(n[0])?l(n[0],O(Fr())):l(sn(n,1,Qr),O(Fr()));var e=n.length;return Me(function(u){for(var o=-1,i=to(u.length,e);++o=n}),yi=Array.isArray,bi=Uu?function(t){return t instanceof Uu}:bu,xi=Wr(Sn),ji=Wr(function(t,n){return n>=t}),wi=_r(function(t,n){if(po||ee(n)||Ue(n))sr(n,iu(n),t);else for(var r in n)Wu.call(n,r)&&Yt(t,r,n[r])}),mi=_r(function(t,n){if(po||ee(n)||Ue(n))sr(n,fu(n),t);else for(var r in n)Yt(t,r,n[r]);
-}),Ai=_r(function(t,n,r,e){sr(n,fu(n),t,e)}),Oi=_r(function(t,n,r,e){sr(n,iu(n),t,e)}),ki=Me(function(t,n){return tn(t,sn(n,1))}),Ei=Me(function(t){return t.push(T,Vt),r(Ai,T,t)}),Si=Me(function(t){return t.push(T,oe),r(Li,T,t)}),Ii=Or(function(t,n,r){t[n]=r},hu(pu)),Ri=Or(function(t,n,r){Wu.call(t,n)?t[n].push(r):t[n]=[r]},Fr),Wi=Me(wn),Bi=_r(function(t,n,r){Bn(t,n,r)}),Li=_r(function(t,n,r,e){Bn(t,n,r,e)}),Mi=Me(function(t,n){return null==t?{}:(n=l(sn(n,1),fe),Cn(t,fn(gn(t,fu,Bo),n)))}),Ci=Me(function(t,n){
-return null==t?{}:Cn(t,l(sn(n,1),fe))}),zi=Mr(iu),Ui=Mr(fu),$i=br(function(t,n,r){return n=n.toLowerCase(),t+(r?au(n):n)}),Di=br(function(t,n,r){return t+(r?"-":"")+n.toLowerCase()}),Fi=br(function(t,n,r){return t+(r?" ":"")+n.toLowerCase()}),Ni=yr("toLowerCase"),Pi=br(function(t,n,r){return t+(r?"_":"")+n.toLowerCase()}),Zi=br(function(t,n,r){return t+(r?" ":"")+qi(n)}),Ti=br(function(t,n,r){return t+(r?" ":"")+n.toUpperCase()}),qi=yr("toUpperCase"),Vi=Me(function(t,n){try{return r(t,T,n)}catch(e){
-return De(e)?e:new ju(e)}}),Ki=Me(function(t,n){return u(sn(n,1),function(n){n=fe(n),t[n]=ci(t[n],t)}),t}),Gi=mr(),Ji=mr(true),Yi=Me(function(t,n){return function(r){return wn(r,t,n)}}),Hi=Me(function(t,n){return function(r){return wn(t,r,n)}}),Qi=Er(l),Xi=Er(i),tf=Er(_),nf=Rr(),rf=Rr(true),ef=kr(function(t,n){return t+n}),uf=Lr("ceil"),of=kr(function(t,n){return t/n}),ff=Lr("floor"),cf=kr(function(t,n){return t*n}),af=Lr("round"),lf=kr(function(t,n){return t-n});return Ot.after=function(t,n){if(typeof n!="function")throw new Au("Expected a function");
-return t=Xe(t),function(){return 1>--t?n.apply(this,arguments):void 0}},Ot.ary=Se,Ot.assign=wi,Ot.assignIn=mi,Ot.assignInWith=Ai,Ot.assignWith=Oi,Ot.at=ki,Ot.before=Ie,Ot.bind=ci,Ot.bindAll=Ki,Ot.bindKey=ai,Ot.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return yi(t)?t:[t]},Ot.chain=xe,Ot.chunk=function(t,n,r){if(n=(r?te(t,n,r):n===T)?1:Xu(Xe(n),0),r=t?t.length:0,!r||1>n)return[];for(var e=0,u=0,o=Array(Ku(r/n));r>e;)o[u++]=Tn(t,e,e+=n);return o},Ot.compact=function(t){for(var n=-1,r=t?t.length:0,e=0,u=[];++nr&&(r=-r>u?0:u+r),e=e===T||e>u?u:Xe(e),0>e&&(e+=u),e=r>e?0:tu(e);e>r;)t[r++]=n;return t},Ot.filter=function(t,n){return(yi(t)?f:ln)(t,Fr(n,3))},Ot.flatMap=function(t,n){return sn(Oe(t,n),1)},Ot.flatMapDeep=function(t,n){return sn(Oe(t,n),q)},Ot.flatMapDepth=function(t,n,r){return r=r===T?1:Xe(r),sn(Oe(t,n),r)},Ot.flatten=function(t){return t&&t.length?sn(t,1):[]},Ot.flattenDeep=function(t){return t&&t.length?sn(t,q):[]},Ot.flattenDepth=function(t,n){return t&&t.length?(n=n===T?1:Xe(n),sn(t,n)):[];
-},Ot.flip=function(t){return Cr(t,512)},Ot.flow=Gi,Ot.flowRight=Ji,Ot.fromPairs=function(t){for(var n=-1,r=t?t.length:0,e={};++n>>0,r?(t=eu(t))&&(typeof n=="string"||null!=n&&!Ke(n))&&(n=Yn(n),""==n&&Wt.test(t))?ur(t.match(It),0,r):oo.call(t,n,r):[]},Ot.spread=function(t,n){if(typeof t!="function")throw new Au("Expected a function");return n=n===T?0:Xu(Xe(n),0),Me(function(e){var u=e[n];return e=ur(e,0,n),u&&s(e,u),r(t,this,e)})},Ot.tail=function(t){return le(t,1)},Ot.take=function(t,n,r){return t&&t.length?(n=r||n===T?1:Xe(n),
-Tn(t,0,0>n?0:n)):[]},Ot.takeRight=function(t,n,r){var e=t?t.length:0;return e?(n=r||n===T?1:Xe(n),n=e-n,Tn(t,0>n?0:n,e)):[]},Ot.takeRightWhile=function(t,n){return t&&t.length?Qn(t,Fr(n,3),false,true):[]},Ot.takeWhile=function(t,n){return t&&t.length?Qn(t,Fr(n,3)):[]},Ot.tap=function(t,n){return n(t),t},Ot.throttle=function(t,n,r){var e=true,u=true;if(typeof t!="function")throw new Au("Expected a function");return Ze(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),Be(t,n,{leading:e,maxWait:n,
-trailing:u})},Ot.thru=je,Ot.toArray=He,Ot.toPairs=zi,Ot.toPairsIn=Ui,Ot.toPath=function(t){return yi(t)?l(t,fe):Je(t)?[t]:lr(Co(t))},Ot.toPlainObject=ru,Ot.transform=function(t,n,r){var e=yi(t)||Ye(t);if(n=Fr(n,4),null==r)if(e||Ze(t)){var o=t.constructor;r=e?yi(t)?new o:[]:Fe(o)?un(Ju(Object(t))):{}}else r={};return(e?u:hn)(t,function(t,e,u){return n(r,t,e,u)}),r},Ot.unary=function(t){return Se(t,1)},Ot.union=To,Ot.unionBy=qo,Ot.unionWith=Vo,Ot.uniq=function(t){return t&&t.length?Hn(t):[]},Ot.uniqBy=function(t,n){
-return t&&t.length?Hn(t,Fr(n)):[]},Ot.uniqWith=function(t,n){return t&&t.length?Hn(t,T,n):[]},Ot.unset=function(t,n){var r;if(null==t)r=true;else{r=t;var e=n,e=ne(e,r)?[e]:er(e);r=ie(r,e),e=fe(ve(e)),r=!(null!=r&&yn(r,e))||delete r[e]}return r},Ot.unzip=ye,Ot.unzipWith=be,Ot.update=function(t,n,r){return null==t?t:Zn(t,n,(typeof r=="function"?r:pu)(vn(t,n)),void 0)},Ot.updateWith=function(t,n,r,e){return e=typeof e=="function"?e:T,null!=t&&(t=Zn(t,n,(typeof r=="function"?r:pu)(vn(t,n)),e)),t},Ot.values=cu,
-Ot.valuesIn=function(t){return null==t?[]:k(t,fu(t))},Ot.without=Ko,Ot.words=su,Ot.wrap=function(t,n){return n=null==n?pu:n,pi(n,t)},Ot.xor=Go,Ot.xorBy=Jo,Ot.xorWith=Yo,Ot.zip=Ho,Ot.zipObject=function(t,n){return nr(t||[],n||[],Yt)},Ot.zipObjectDeep=function(t,n){return nr(t||[],n||[],Zn)},Ot.zipWith=Qo,Ot.entries=zi,Ot.entriesIn=Ui,Ot.extend=mi,Ot.extendWith=Ai,vu(Ot,Ot),Ot.add=ef,Ot.attempt=Vi,Ot.camelCase=$i,Ot.capitalize=au,Ot.ceil=uf,Ot.clamp=function(t,n,r){return r===T&&(r=n,n=T),r!==T&&(r=nu(r),
-r=r===r?r:0),n!==T&&(n=nu(n),n=n===n?n:0),nn(nu(t),n,r)},Ot.clone=function(t){return rn(t,false,true)},Ot.cloneDeep=function(t){return rn(t,true,true)},Ot.cloneDeepWith=function(t,n){return rn(t,true,true,n)},Ot.cloneWith=function(t,n){return rn(t,false,true,n)},Ot.deburr=lu,Ot.divide=of,Ot.endsWith=function(t,n,r){t=eu(t),n=Yn(n);var e=t.length;return r=r===T?e:nn(Xe(r),0,e),r-=n.length,r>=0&&t.indexOf(n,r)==r},Ot.eq=Ce,Ot.escape=function(t){return(t=eu(t))&&X.test(t)?t.replace(H,B):t},Ot.escapeRegExp=function(t){
-return(t=eu(t))&&ft.test(t)?t.replace(it,"\\$&"):t},Ot.every=function(t,n,r){var e=yi(t)?i:cn;return r&&te(t,n,r)&&(n=T),e(t,Fr(n,3))},Ot.find=ni,Ot.findIndex=he,Ot.findKey=function(t,n){return v(t,Fr(n,3),hn)},Ot.findLast=ri,Ot.findLastIndex=pe,Ot.findLastKey=function(t,n){return v(t,Fr(n,3),pn)},Ot.floor=ff,Ot.forEach=me,Ot.forEachRight=Ae,Ot.forIn=function(t,n){return null==t?t:ko(t,Fr(n,3),fu)},Ot.forInRight=function(t,n){return null==t?t:Eo(t,Fr(n,3),fu)},Ot.forOwn=function(t,n){return t&&hn(t,Fr(n,3));
-},Ot.forOwnRight=function(t,n){return t&&pn(t,Fr(n,3))},Ot.get=uu,Ot.gt=gi,Ot.gte=di,Ot.has=function(t,n){return null!=t&&Vr(t,n,yn)},Ot.hasIn=ou,Ot.head=_e,Ot.identity=pu,Ot.includes=function(t,n,r,e){return t=Ue(t)?t:cu(t),r=r&&!e?Xe(r):0,e=t.length,0>r&&(r=Xu(e+r,0)),Ge(t)?e>=r&&-1r&&(r=Xu(e+r,0)),d(t,n,r)):-1},Ot.inRange=function(t,n,r){return n=nu(n)||0,r===T?(r=n,n=0):r=nu(r)||0,t=nu(t),
-t>=to(n,r)&&t=-9007199254740991&&9007199254740991>=t;
-},Ot.isSet=function(t){return Te(t)&&"[object Set]"==qr(t)},Ot.isString=Ge,Ot.isSymbol=Je,Ot.isTypedArray=Ye,Ot.isUndefined=function(t){return t===T},Ot.isWeakMap=function(t){return Te(t)&&"[object WeakMap]"==qr(t)},Ot.isWeakSet=function(t){return Te(t)&&"[object WeakSet]"==Mu.call(t)},Ot.join=function(t,n){return t?Hu.call(t,n):""},Ot.kebabCase=Di,Ot.last=ve,Ot.lastIndexOf=function(t,n,r){var e=t?t.length:0;if(!e)return-1;var u=e;if(r!==T&&(u=Xe(r),u=(0>u?Xu(e+u,0):to(u,e-1))+1),n!==n)return M(t,u-1,true);
-for(;u--;)if(t[u]===n)return u;return-1},Ot.lowerCase=Fi,Ot.lowerFirst=Ni,Ot.lt=xi,Ot.lte=ji,Ot.max=function(t){return t&&t.length?an(t,pu,dn):T},Ot.maxBy=function(t,n){return t&&t.length?an(t,Fr(n),dn):T},Ot.mean=function(t){return b(t,pu)},Ot.meanBy=function(t,n){return b(t,Fr(n))},Ot.min=function(t){return t&&t.length?an(t,pu,Sn):T},Ot.minBy=function(t,n){return t&&t.length?an(t,Fr(n),Sn):T},Ot.stubArray=yu,Ot.stubFalse=bu,Ot.stubObject=function(){return{}},Ot.stubString=function(){return""},Ot.stubTrue=function(){
-return true},Ot.multiply=cf,Ot.nth=function(t,n){return t&&t.length?Ln(t,Xe(n)):T},Ot.noConflict=function(){return Kt._===this&&(Kt._=Cu),this},Ot.noop=gu,Ot.now=Ee,Ot.pad=function(t,n,r){t=eu(t);var e=(n=Xe(n))?N(t):0;return!n||e>=n?t:(n=(n-e)/2,Sr(Gu(n),r)+t+Sr(Ku(n),r))},Ot.padEnd=function(t,n,r){t=eu(t);var e=(n=Xe(n))?N(t):0;return n&&n>e?t+Sr(n-e,r):t},Ot.padStart=function(t,n,r){t=eu(t);var e=(n=Xe(n))?N(t):0;return n&&n>e?Sr(n-e,r)+t:t},Ot.parseInt=function(t,n,r){return r||null==n?n=0:n&&(n=+n),
-t=eu(t).replace(ct,""),no(t,n||(vt.test(t)?16:10))},Ot.random=function(t,n,r){if(r&&typeof r!="boolean"&&te(t,n,r)&&(n=r=T),r===T&&(typeof n=="boolean"?(r=n,n=T):typeof t=="boolean"&&(r=t,t=T)),t===T&&n===T?(t=0,n=1):(t=nu(t)||0,n===T?(n=t,t=0):n=nu(n)||0),t>n){var e=t;t=n,n=e}return r||t%1||n%1?(r=ro(),to(t+r*(n-t+Ft("1e-"+((r+"").length-1))),n)):Nn(t,n)},Ot.reduce=function(t,n,r){var e=yi(t)?h:x,u=3>arguments.length;return e(t,Fr(n,4),r,u,Ao)},Ot.reduceRight=function(t,n,r){var e=yi(t)?p:x,u=3>arguments.length;
-return e(t,Fr(n,4),r,u,Oo)},Ot.repeat=function(t,n,r){return n=(r?te(t,n,r):n===T)?1:Xe(n),Pn(eu(t),n)},Ot.replace=function(){var t=arguments,n=eu(t[0]);return 3>t.length?n:eo.call(n,t[1],t[2])},Ot.result=function(t,n,r){n=ne(n,t)?[n]:er(n);var e=-1,u=n.length;for(u||(t=T,u=1);++e0?t[Nn(0,n-1)]:T},Ot.size=function(t){if(null==t)return 0;
-if(Ue(t)){var n=t.length;return n&&Ge(t)?N(t):n}return Te(t)&&(n=qr(t),"[object Map]"==n||"[object Set]"==n)?t.size:iu(t).length},Ot.snakeCase=Pi,Ot.some=function(t,n,r){var e=yi(t)?_:qn;return r&&te(t,n,r)&&(n=T),e(t,Fr(n,3))},Ot.sortedIndex=function(t,n){return Vn(t,n)},Ot.sortedIndexBy=function(t,n,r){return Kn(t,n,Fr(r))},Ot.sortedIndexOf=function(t,n){var r=t?t.length:0;if(r){var e=Vn(t,n);if(r>e&&Ce(t[e],n))return e}return-1},Ot.sortedLastIndex=function(t,n){return Vn(t,n,true)},Ot.sortedLastIndexBy=function(t,n,r){
-return Kn(t,n,Fr(r),true)},Ot.sortedLastIndexOf=function(t,n){if(t&&t.length){var r=Vn(t,n,true)-1;if(Ce(t[r],n))return r}return-1},Ot.startCase=Zi,Ot.startsWith=function(t,n,r){return t=eu(t),r=nn(Xe(r),0,t.length),t.lastIndexOf(Yn(n),r)==r},Ot.subtract=lf,Ot.sum=function(t){return t&&t.length?w(t,pu):0},Ot.sumBy=function(t,n){return t&&t.length?w(t,Fr(n)):0},Ot.template=function(t,n,r){var e=Ot.templateSettings;r&&te(t,n,r)&&(n=T),t=eu(t),n=Ai({},n,e,Vt),r=Ai({},n.imports,e.imports,Vt);var u,o,i=iu(r),f=k(r,i),c=0;
-r=n.interpolate||wt;var a="__p+='";r=mu((n.escape||wt).source+"|"+r.source+"|"+(r===rt?pt:wt).source+"|"+(n.evaluate||wt).source+"|$","g");var l="sourceURL"in n?"//# sourceURL="+n.sourceURL+"\n":"";if(t.replace(r,function(n,r,e,i,f,l){return e||(e=i),a+=t.slice(c,l).replace(mt,L),r&&(u=true,a+="'+__e("+r+")+'"),f&&(o=true,a+="';"+f+";\n__p+='"),e&&(a+="'+((__t=("+e+"))==null?'':__t)+'"),c=l+n.length,n}),a+="';",(n=n.variable)||(a="with(obj){"+a+"}"),a=(o?a.replace(K,""):a).replace(G,"$1").replace(J,"$1;"),
-a="function("+(n||"obj")+"){"+(n?"":"obj||(obj={});")+"var __t,__p=''"+(u?",__e=_.escape":"")+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+a+"return __p}",n=Vi(function(){return Function(i,l+"return "+a).apply(T,f)}),n.source=a,De(n))throw n;return n},Ot.times=function(t,n){if(t=Xe(t),1>t||t>9007199254740991)return[];var r=4294967295,e=to(t,4294967295);for(n=Fr(n),t-=4294967295,e=m(e,n);++r=o)return t;if(o=r-N(e),1>o)return e;if(r=i?ur(i,0,o).join(""):t.slice(0,o),u===T)return r+e;if(i&&(o+=r.length-o),Ke(u)){if(t.slice(o).search(u)){var f=r;for(u.global||(u=mu(u.source,eu(_t.exec(u))+"g")),
-u.lastIndex=0;i=u.exec(f);)var c=i.index;r=r.slice(0,c===T?o:c)}}else t.indexOf(Yn(u),o)!=o&&(u=r.lastIndexOf(u),u>-1&&(r=r.slice(0,u)));return r+e},Ot.unescape=function(t){return(t=eu(t))&&Q.test(t)?t.replace(Y,P):t},Ot.uniqueId=function(t){var n=++Bu;return eu(t)+n},Ot.upperCase=Ti,Ot.upperFirst=qi,Ot.each=me,Ot.eachRight=Ae,Ot.first=_e,vu(Ot,function(){var t={};return hn(Ot,function(n,r){Wu.call(Ot.prototype,r)||(t[r]=n)}),t}(),{chain:false}),Ot.VERSION="4.13.1",u("bind bindKey curry curryRight partial partialRight".split(" "),function(t){
-Ot[t].placeholder=Ot}),u(["drop","take"],function(t,n){Ut.prototype[t]=function(r){var e=this.__filtered__;if(e&&!n)return new Ut(this);r=r===T?1:Xu(Xe(r),0);var u=this.clone();return e?u.__takeCount__=to(r,u.__takeCount__):u.__views__.push({size:to(r,4294967295),type:t+(0>u.__dir__?"Right":"")}),u},Ut.prototype[t+"Right"]=function(n){return this.reverse()[t](n).reverse()}}),u(["filter","map","takeWhile"],function(t,n){var r=n+1,e=1==r||3==r;Ut.prototype[t]=function(t){var n=this.clone();return n.__iteratees__.push({
-iteratee:Fr(t,3),type:r}),n.__filtered__=n.__filtered__||e,n}}),u(["head","last"],function(t,n){var r="take"+(n?"Right":"");Ut.prototype[t]=function(){return this[r](1).value()[0]}}),u(["initial","tail"],function(t,n){var r="drop"+(n?"":"Right");Ut.prototype[t]=function(){return this.__filtered__?new Ut(this):this[r](1)}}),Ut.prototype.compact=function(){return this.filter(pu)},Ut.prototype.find=function(t){return this.filter(t).head()},Ut.prototype.findLast=function(t){return this.reverse().find(t);
-},Ut.prototype.invokeMap=Me(function(t,n){return typeof t=="function"?new Ut(this):this.map(function(r){return wn(r,t,n)})}),Ut.prototype.reject=function(t){return t=Fr(t,3),this.filter(function(n){return!t(n)})},Ut.prototype.slice=function(t,n){t=Xe(t);var r=this;return r.__filtered__&&(t>0||0>n)?new Ut(r):(0>t?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==T&&(n=Xe(n),r=0>n?r.dropRight(-n):r.take(n-t)),r)},Ut.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Ut.prototype.toArray=function(){
-return this.take(4294967295)},hn(Ut.prototype,function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),e=/^(?:head|last)$/.test(n),u=Ot[e?"take"+("last"==n?"Right":""):n],o=e||/^find/.test(n);u&&(Ot.prototype[n]=function(){function n(t){return t=u.apply(Ot,s([t],f)),e&&h?t[0]:t}var i=this.__wrapped__,f=e?[1]:arguments,c=i instanceof Ut,a=f[0],l=c||yi(i);l&&r&&typeof a=="function"&&1!=a.length&&(c=l=false);var h=this.__chain__,p=!!this.__actions__.length,a=o&&!h,c=c&&!p;return!o&&l?(i=c?i:new Ut(this),
-i=t.apply(i,f),i.__actions__.push({func:je,args:[n],thisArg:T}),new zt(i,h)):a&&c?t.apply(this,f):(i=this.thru(n),a?e?i.value()[0]:i.value():i)})}),u("pop push shift sort splice unshift".split(" "),function(t){var n=Ou[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",e=/^(?:pop|shift)$/.test(t);Ot.prototype[t]=function(){var t=arguments;if(e&&!this.__chain__){var u=this.value();return n.apply(yi(u)?u:[],t)}return this[r](function(r){return n.apply(yi(r)?r:[],t)})}}),hn(Ut.prototype,function(t,n){
-var r=Ot[n];if(r){var e=r.name+"";(_o[e]||(_o[e]=[])).push({name:n,func:r})}}),_o[Ar(T,2).name]=[{name:"wrapper",func:T}],Ut.prototype.clone=function(){var t=new Ut(this.__wrapped__);return t.__actions__=lr(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=lr(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=lr(this.__views__),t},Ut.prototype.reverse=function(){if(this.__filtered__){var t=new Ut(this);t.__dir__=-1,t.__filtered__=true}else t=this.clone(),
-t.__dir__*=-1;return t},Ut.prototype.value=function(){var t,n=this.__wrapped__.value(),r=this.__dir__,e=yi(n),u=0>r,o=e?n.length:0;t=o;for(var i=this.__views__,f=0,c=-1,a=i.length;++co||o==t&&a==t)return Xn(n,this.__actions__);e=[];
-t:for(;t--&&a>c;){for(u+=r,o=-1,l=n[u];++o=this.__values__.length,n=t?T:this.__values__[this.__index__++];return{done:t,value:n}},Ot.prototype.plant=function(t){
-for(var n,r=this;r instanceof kt;){var e=ae(r);e.__index__=0,e.__values__=T,n?u.__wrapped__=e:n=e;var u=e,r=r.__wrapped__}return u.__wrapped__=t,n},Ot.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof Ut?(this.__actions__.length&&(t=new Ut(this)),t=t.reverse(),t.__actions__.push({func:je,args:[de],thisArg:T}),new zt(t,this.__chain__)):this.thru(de)},Ot.prototype.toJSON=Ot.prototype.valueOf=Ot.prototype.value=function(){return Xn(this.__wrapped__,this.__actions__)},Zu&&(Ot.prototype[Zu]=we),
-Ot}var T,q=1/0,V=NaN,K=/\b__p\+='';/g,G=/\b(__p\+=)''\+/g,J=/(__e\(.*?\)|\b__t\))\+'';/g,Y=/&(?:amp|lt|gt|quot|#39|#96);/g,H=/[&<>"'`]/g,Q=RegExp(Y.source),X=RegExp(H.source),tt=/<%-([\s\S]+?)%>/g,nt=/<%([\s\S]+?)%>/g,rt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ut=/^\w*$/,ot=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ft=RegExp(it.source),ct=/^\s+|\s+$/g,at=/^\s+/,lt=/\s+$/,st=/[a-zA-Z0-9]+/g,ht=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_t=/\w*$/,vt=/^0x/i,gt=/^[-+]0x[0-9a-f]+$/i,dt=/^0b[01]+$/i,yt=/^\[object .+?Constructor\]$/,bt=/^0o[0-7]+$/i,xt=/^(?:0|[1-9]\d*)$/,jt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,wt=/($^)/,mt=/['\n\r\u2028\u2029\\]/g,At="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?)*",Ot="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+At,kt="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]?|[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",Et=RegExp("['\u2019]","g"),St=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),It=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+kt+At,"g"),Rt=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d+",Ot].join("|"),"g"),Wt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),Bt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Lt="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise Reflect RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ isFinite parseInt setTimeout".split(" "),Mt={};
-Mt["[object Float32Array]"]=Mt["[object Float64Array]"]=Mt["[object Int8Array]"]=Mt["[object Int16Array]"]=Mt["[object Int32Array]"]=Mt["[object Uint8Array]"]=Mt["[object Uint8ClampedArray]"]=Mt["[object Uint16Array]"]=Mt["[object Uint32Array]"]=true,Mt["[object Arguments]"]=Mt["[object Array]"]=Mt["[object ArrayBuffer]"]=Mt["[object Boolean]"]=Mt["[object DataView]"]=Mt["[object Date]"]=Mt["[object Error]"]=Mt["[object Function]"]=Mt["[object Map]"]=Mt["[object Number]"]=Mt["[object Object]"]=Mt["[object RegExp]"]=Mt["[object Set]"]=Mt["[object String]"]=Mt["[object WeakMap]"]=false;
-var Ct={};Ct["[object Arguments]"]=Ct["[object Array]"]=Ct["[object ArrayBuffer]"]=Ct["[object DataView]"]=Ct["[object Boolean]"]=Ct["[object Date]"]=Ct["[object Float32Array]"]=Ct["[object Float64Array]"]=Ct["[object Int8Array]"]=Ct["[object Int16Array]"]=Ct["[object Int32Array]"]=Ct["[object Map]"]=Ct["[object Number]"]=Ct["[object Object]"]=Ct["[object RegExp]"]=Ct["[object Set]"]=Ct["[object String]"]=Ct["[object Symbol]"]=Ct["[object Uint8Array]"]=Ct["[object Uint8ClampedArray]"]=Ct["[object Uint16Array]"]=Ct["[object Uint32Array]"]=true,
-Ct["[object Error]"]=Ct["[object Function]"]=Ct["[object WeakMap]"]=false;var zt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O",
-"\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Ut={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},$t={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Dt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ft=parseFloat,Nt=parseInt,Pt=typeof exports=="object"&&exports,Zt=Pt&&typeof module=="object"&&module,Tt=Zt&&Zt.exports===Pt,qt=R(typeof self=="object"&&self),Vt=R(typeof this=="object"&&this),Kt=R(typeof global=="object"&&global)||qt||Vt||Function("return this")(),Gt=Z();
-(qt||{})._=Gt,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){return Gt}):Zt?((Zt.exports=Gt)._=Gt,Pt._=Gt):Kt._=Gt}).call(this);
\ No newline at end of file
+var u=-1,o=t?t.length:0;for(e&&o&&(r=t[++u]);++u=n?t:n)),t}function gn(t,n,r,e,o,i,f){var c;if(e&&(c=i?e(t,o,i,f):e(t)),c!==P)return c;if(!fu(t))return t;if(o=Pi(t)){if(c=se(t),!n)return Ir(t,c)}else{var a=Et(t),l="[object Function]"==a||"[object GeneratorFunction]"==a;if(qi(t))return Or(t,n);if("[object Object]"==a||"[object Arguments]"==a||l&&!i){if(C(t))return i?t:{};if(c=he(l?{}:t),
+!n)return Br(t,pn(c,t))}else{if(!Dt[a])return i?t:{};c=pe(t,a,gn,n)}}if(f||(f=new fn),i=f.get(t))return i;if(f.set(t,c),!o)var s=r?In(t,wu,ni):wu(t);return u(s||t,function(u,o){s&&(o=u,u=t[o]),ln(c,o,gn(u,n,r,e,o,t,f))}),r||f.delete(t),c}function dn(t){var n=wu(t);return function(r){return yn(r,t,n)}}function yn(t,n,r){var e=r.length;if(null==t)return!e;for(;e--;){var u=r[e],o=n[u],i=t[u];if(i===P&&!(u in Object(t))||!o(i))return false}return true}function bn(t){return fu(t)?fo(t):{}}function xn(t,n,r){
+if(typeof t!="function")throw new Nu("Expected a function");return St(function(){t.apply(P,r)},n)}function jn(t,n,r,e){var u=-1,o=c,i=true,f=t.length,s=[],h=n.length;if(!f)return s;r&&(n=l(n,S(r))),e?(o=a,i=false):200<=n.length&&(o=I,i=false,n=new Jt(n));t:for(;++un}function Bn(t,n){return null!=t&&(Ju.call(t,n)||typeof t=="object"&&n in t&&null===ti(t))}function Mn(t,n){return null!=t&&n in Object(t)}function Cn(t,n,r){for(var e=r?a:c,u=t[0].length,o=t.length,i=o,f=Uu(o),s=1/0,h=[];i--;){var p=t[i];i&&n&&(p=l(p,S(n))),s=jo(p.length,s),f[i]=!r&&(n||120<=u&&120<=p.length)?new Jt(i&&p):P}var p=t[0],_=-1,v=f[0];t:for(;++_n?r:0,ge(n,r)?t[n]:P}function tr(t,n,r){var e=-1;return n=l(n.length?n:[Iu],S(ie())),t=Jn(t,function(t){return{a:l(n,function(n){return n(t)}),b:++e,c:t}}),A(t,function(t,n){var e;t:{e=-1;for(var u=t.a,o=n.a,i=u.length,f=r.length;++e=f?c:c*("desc"==r[e]?-1:1);break t}}e=t.b-n.b}return e})}function nr(t,n){
+return t=Object(t),rr(t,n,function(n,r){return r in t})}function rr(t,n,r){for(var e=-1,u=n.length,o={};++en||9007199254740991n&&(n=-n>u?0:u+n),r=r>u?u:r,0>r&&(r+=u),u=n>r?0:r-n>>>0,n>>>=0,r=Uu(u);++e=u){for(;e>>1,i=t[o];null!==i&&!hu(i)&&(r?i<=n:i=e?t:lr(t,n,r)}function Or(t,n){
+if(n)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function kr(t){var n=new t.constructor(t.byteLength);return new uo(n).set(new uo(t)),n}function Er(t,n){if(t!==n){var r=t!==P,e=null===t,u=t===t,o=hu(t),i=n!==P,f=null===n,c=n===n,a=hu(n);if(!f&&!a&&!o&&t>n||o&&i&&c&&!f&&!a||e&&i&&c||!r&&c||!u)return 1;if(!e&&!o&&!a&&tu?P:o,u=1),n=Object(n);++ei&&f[0]!==a&&f[i-1]!==a?[]:D(f,a),
+i-=c.length,ir?r?fr(n,t):n:(r=fr(n,so(t/T(n))),Ct.test(n)?Ar(r.match(Bt),0,t).join(""):r.slice(0,t))}function Jr(t,n,e,u){
+function o(){for(var n=-1,c=arguments.length,a=-1,l=u.length,s=Uu(l+c),h=this&&this!==qt&&this instanceof o?f:t;++an||e)&&(1&t&&(o[2]=h[2],n|=1&r?0:4),(r=h[3])&&(e=o[3],o[3]=e?Sr(e,r,h[4]):r,o[4]=e?D(o[3],"__lodash_placeholder__"):h[4]),
+(r=h[5])&&(e=o[5],o[5]=e?Rr(e,r,h[6]):r,o[6]=e?D(o[5],"__lodash_placeholder__"):h[6]),(r=h[7])&&(o[7]=r),128&t&&(o[8]=null==o[8]?h[8]:jo(o[8],h[8])),null==o[9]&&(o[9]=h[9]),o[0]=h[0],o[1]=n),t=o[0],n=o[1],r=o[2],e=o[3],u=o[4],f=o[9]=null==o[9]?c?0:t.length:xo(o[9]-a,0),!f&&24&n&&(n&=-25),oi((h?Yo:ui)(n&&1!=n?8==n||16==n?Tr(t,n,f):32!=n&&33!=n||u.length?Zr.apply(P,o):Jr(t,n,r,e):Ur(t,n,r),o),t,n)}function re(t,n,r,e,u,o){var i=2&u,f=t.length,c=n.length;if(f!=c&&!(i&&c>f))return false;if((c=o.get(t))&&o.get(n))return c==n;
+var c=-1,a=true,l=1&u?new Jt:P;for(o.set(t,n),o.set(n,t);++cn?0:n,e)):[]}function Re(t,n,r){var e=t?t.length:0;return e?(n=r||n===P?1:vu(n),n=e-n,lr(t,0,0>n?0:n)):[]}function Ie(t,n,r){var e=t?t.length:0;return e?(r=null==r?0:vu(r),
+0>r&&(r=xo(e+r,0)),g(t,ie(n,3),r)):-1}function We(t,n,r){var e=t?t.length:0;if(!e)return-1;var u=e-1;return r!==P&&(u=vu(r),u=0>r?xo(e+u,0):jo(u,e-1)),g(t,ie(n,3),u,true)}function Be(t){return t&&t.length?t[0]:P}function Me(t){var n=t?t.length:0;return n?t[n-1]:P}function Ce(t,n){return t&&t.length&&n&&n.length?ur(t,n):t}function Le(t){return t?Oo.call(t):t}function ze(t){if(!t||!t.length)return[];var n=0;return t=f(t,function(t){if(ru(t))return n=xo(t.length,n),true}),k(n,function(n){return l(t,j(n));
+})}function Ue(t,n){if(!t||!t.length)return[];var e=ze(t);return null==n?e:l(e,function(t){return r(n,P,t)})}function De(t){return t=Rt(t),t.__chain__=true,t}function $e(t,n){return n(t)}function Fe(){return this}function Te(t,n){return(Pi(t)?u:qo)(t,ie(n,3))}function Ne(t,n){return(Pi(t)?o:Vo)(t,ie(n,3))}function Pe(t,n){return(Pi(t)?l:Jn)(t,ie(n,3))}function Ze(t,n,r){var e=-1,u=pu(t),o=u.length,i=o-1;for(n=(r?de(t,n,r):n===P)?1:vn(vu(n),0,o);++e=t&&(n=P),r}}function Ge(t,n,r){return n=r?P:n,t=ne(t,8,P,P,P,P,P,n),t.placeholder=Ge.placeholder,t}function Je(t,n,r){return n=r?P:n,t=ne(t,16,P,P,P,P,P,n),t.placeholder=Je.placeholder,t}function Ye(t,n,r){function e(n){var r=c,e=a;return c=a=P,
+_=n,s=t.apply(e,r)}function u(t){var r=t-p;return t-=_,p===P||r>=n||0>r||g&&t>=l}function o(){var t=qe();if(u(t))return i(t);var r;r=t-_,t=n-(t-p),r=g?jo(t,l-r):t,h=St(o,r)}function i(t){return h=P,d&&c?e(t):(c=a=P,s)}function f(){var t=qe(),r=u(t);if(c=arguments,a=this,p=t,r){if(h===P)return _=t=p,h=St(o,n),v?e(t):s;if(g)return h=St(o,n),e(p)}return h===P&&(h=St(o,n)),s}var c,a,l,s,h,p,_=0,v=false,g=false,d=true;if(typeof t!="function")throw new Nu("Expected a function");return n=du(n)||0,fu(r)&&(v=!!r.leading,
+l=(g="maxWait"in r)?xo(du(r.maxWait)||0,n):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==P&&w.clearTimeout.call(qt,h),_=0,c=p=a=h=P},f.flush=function(){return h===P?s:i(qe())},f}function He(t,n){function r(){var e=arguments,u=n?n.apply(this,e):e[0],o=r.cache;return o.has(u)?o.get(u):(e=t.apply(this,e),r.cache=o.set(u,e),e)}if(typeof t!="function"||n&&typeof n!="function")throw new Nu("Expected a function");return r.cache=new(He.Cache||Kt),r}function Qe(t){if(typeof t!="function")throw new Nu("Expected a function");
+return function(){var n=arguments;switch(n.length){case 0:return!t.call(this);case 1:return!t.call(this,n[0]);case 2:return!t.call(this,n[0],n[1]);case 3:return!t.call(this,n[0],n[1],n[2])}return!t.apply(this,n)}}function Xe(t,n){return t===n||t!==t&&n!==n}function tu(t){return ru(t)&&Ju.call(t,"callee")&&(!co.call(t,"callee")||"[object Arguments]"==Qu.call(t))}function nu(t){return null!=t&&iu(Xo(t))&&!uu(t)}function ru(t){return cu(t)&&nu(t)}function eu(t){return!!cu(t)&&("[object Error]"==Qu.call(t)||typeof t.message=="string"&&typeof t.name=="string");
+}function uu(t){return t=fu(t)?Qu.call(t):"","[object Function]"==t||"[object GeneratorFunction]"==t}function ou(t){return typeof t=="number"&&t==vu(t)}function iu(t){return typeof t=="number"&&-1=t}function fu(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function cu(t){return!!t&&typeof t=="object"}function au(t){return typeof t=="number"||cu(t)&&"[object Number]"==Qu.call(t)}function lu(t){return!(!cu(t)||"[object Object]"!=Qu.call(t)||C(t))&&(t=ti(t),null===t||(t=Ju.call(t,"constructor")&&t.constructor,
+typeof t=="function"&&t instanceof t&&Gu.call(t)==Hu))}function su(t){return typeof t=="string"||!Pi(t)&&cu(t)&&"[object String]"==Qu.call(t)}function hu(t){return typeof t=="symbol"||cu(t)&&"[object Symbol]"==Qu.call(t)}function pu(t){if(!t)return[];if(nu(t))return su(t)?t.match(Bt):Ir(t);if(io&&t[io])return L(t[io]());var n=Et(t);return("[object Map]"==n?z:"[object Set]"==n?$:Ou)(t)}function _u(t){return t?(t=du(t),t===Z||t===-Z?1.7976931348623157e308*(0>t?-1:1):t===t?t:0):0===t?t:0}function vu(t){
+t=_u(t);var n=t%1;return t===t?n?t-n:t:0}function gu(t){return t?vn(vu(t),0,4294967295):0}function du(t){if(typeof t=="number")return t;if(hu(t))return q;if(fu(t)&&(t=uu(t.valueOf)?t.valueOf():t,t=fu(t)?t+"":t),typeof t!="string")return 0===t?t:+t;t=t.replace(ct,"");var n=xt.test(t);return n||wt.test(t)?Nt(t.slice(2),n?2:8):bt.test(t)?q:+t}function yu(t){return Wr(t,mu(t))}function bu(t){return null==t?"":gr(t)}function xu(t,n,r){return t=null==t?P:Rn(t,n),t===P?r:t}function ju(t,n){return null!=t&&le(t,n,Mn);
+}function wu(t){var n=xe(t);if(!n&&!nu(t))return Jo(t);var r,e=_e(t),u=!!e,e=e||[],o=e.length;for(r in t)!Bn(t,r)||u&&("length"==r||ge(r,o))||n&&"constructor"==r||e.push(r);return e}function mu(t){for(var n=-1,r=xe(t),e=Kn(t),u=e.length,o=_e(t),i=!!o,o=o||[],f=o.length;++nt)&&(t==n.length-1?n.pop():ao.call(n,t,1),true)},Vt.prototype.get=function(t){var n=this.__data__;return t=sn(n,t),0>t?P:n[t][1]},Vt.prototype.has=function(t){return-1e?r.push([t,n]):r[e][1]=n,this},Kt.prototype.clear=function(){this.__data__={hash:new Zt,map:new(So||Vt),string:new Zt}},Kt.prototype.delete=function(t){return fe(this,t).delete(t)},Kt.prototype.get=function(t){return fe(this,t).get(t);
+},Kt.prototype.has=function(t){return fe(this,t).has(t)},Kt.prototype.set=function(t,n){return fe(this,t).set(t,n),this},Jt.prototype.add=Jt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Jt.prototype.has=function(t){return this.__data__.has(t)},fn.prototype.clear=function(){this.__data__=new Vt},fn.prototype.delete=function(t){return this.__data__.delete(t)},fn.prototype.get=function(t){return this.__data__.get(t)},fn.prototype.has=function(t){return this.__data__.has(t);
+},fn.prototype.set=function(t,n){var r=this.__data__;if(r instanceof Vt){if(r=r.__data__,!So||199>r.length)return r.push([t,n]),this;r=this.__data__=new Kt(r)}return r.set(t,n),this};var qo=Lr(kn),Vo=Lr(En,true),Ko=zr(),Go=zr(true),Jo=U(bo);oo&&!co.call({valueOf:1},"valueOf")&&(Kn=function(t){return L(oo(t))});var Yo=Co?function(t,n){return Co.set(t,n),t}:Iu,Ho=Io&&1/$(new Io([,-0]))[1]==Z?function(t){return new Io(t)}:Mu,Qo=Co?function(t){return Co.get(t)}:Mu,Xo=j("length"),ti=U(po),ni=_o?U(_o):Lu,ri=_o?function(t){
+for(var n=[];t;)s(n,ni(t)),t=ti(t);return n}:ni;(Eo&&"[object DataView]"!=Et(new Eo(new ArrayBuffer(1)))||So&&"[object Map]"!=Et(new So)||Ro&&"[object Promise]"!=Et(Ro.resolve())||Io&&"[object Set]"!=Et(new Io)||Wo&&"[object WeakMap]"!=Et(new Wo))&&(Et=function(t){var n=Qu.call(t);if(t=(t="[object Object]"==n?t.constructor:P)?Oe(t):P)switch(t){case Uo:return"[object DataView]";case Do:return"[object Map]";case $o:return"[object Promise]";case Fo:return"[object Set]";case To:return"[object WeakMap]";
+}return n});var ei=Vu?uu:zu,ui=function(){var t=0,n=0;return function(r,e){var u=qe(),o=16-(u-n);if(n=u,0=n}),Pi=Uu.isArray,Zi=Yt?S(Yt):Un,qi=vo||zu,Vi=Ht?S(Ht):Dn,Ki=Qt?S(Qt):Fn,Gi=Xt?S(Xt):Pn,Ji=tn?S(tn):Zn,Yi=nn?S(nn):qn,Hi=Hr(Gn),Qi=Hr(function(t,n){return t<=n}),Xi=Cr(function(t,n){if(Lo||xe(n)||nu(n))Wr(n,wu(n),t);else for(var r in n)Ju.call(n,r)&&ln(t,r,n[r])}),tf=Cr(function(t,n){
+if(Lo||xe(n)||nu(n))Wr(n,mu(n),t);else for(var r in n)ln(t,r,n[r])}),nf=Cr(function(t,n,r,e){Wr(n,mu(n),t,e)}),rf=Cr(function(t,n,r,e){Wr(n,wu(n),t,e)}),ef=cr(function(t,n){return _n(t,On(n,1))}),uf=cr(function(t){return t.push(P,cn),r(nf,P,t)}),of=cr(function(t){return t.push(P,we),r(sf,P,t)}),ff=qr(function(t,n,r){t[n]=r},Ru(Iu)),cf=qr(function(t,n,r){Ju.call(t,n)?t[n].push(r):t[n]=[r]},ie),af=cr(zn),lf=Cr(function(t,n,r){Qn(t,n,r)}),sf=Cr(function(t,n,r,e){Qn(t,n,r,e)}),hf=cr(function(t,n){return null==t?{}:(n=l(On(n,1),Ae),
+nr(t,jn(In(t,mu,ri),n)))}),pf=cr(function(t,n){return null==t?{}:nr(t,l(On(n,1),Ae))}),_f=te(wu),vf=te(mu),gf=$r(function(t,n,r){return n=n.toLowerCase(),t+(r?ku(n):n)}),df=$r(function(t,n,r){return t+(r?"-":"")+n.toLowerCase()}),yf=$r(function(t,n,r){return t+(r?" ":"")+n.toLowerCase()}),bf=Dr("toLowerCase"),xf=$r(function(t,n,r){return t+(r?"_":"")+n.toLowerCase()}),jf=$r(function(t,n,r){return t+(r?" ":"")+mf(n)}),wf=$r(function(t,n,r){return t+(r?" ":"")+n.toUpperCase()}),mf=Dr("toUpperCase"),Af=cr(function(t,n){
+try{return r(t,P,n)}catch(t){return eu(t)?t:new $u(t)}}),Of=cr(function(t,n){return u(On(n,1),function(n){n=Ae(n),t[n]=Mi(t[n],t)}),t}),kf=Pr(),Ef=Pr(true),Sf=cr(function(t,n){return function(r){return zn(r,t,n)}}),Rf=cr(function(t,n){return function(r){return zn(t,r,n)}}),If=Kr(l),Wf=Kr(i),Bf=Kr(_),Mf=Yr(),Cf=Yr(true),Lf=Vr(function(t,n){return t+n},0),zf=Xr("ceil"),Uf=Vr(function(t,n){return t/n},1),Df=Xr("floor"),$f=Vr(function(t,n){return t*n},1),Ff=Xr("round"),Tf=Vr(function(t,n){return t-n},0);return Rt.after=function(t,n){
+if(typeof n!="function")throw new Nu("Expected a function");return t=vu(t),function(){if(1>--t)return n.apply(this,arguments)}},Rt.ary=Ve,Rt.assign=Xi,Rt.assignIn=tf,Rt.assignInWith=nf,Rt.assignWith=rf,Rt.at=ef,Rt.before=Ke,Rt.bind=Mi,Rt.bindAll=Of,Rt.bindKey=Ci,Rt.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Pi(t)?t:[t]},Rt.chain=De,Rt.chunk=function(t,n,r){if(n=(r?de(t,n,r):n===P)?1:xo(vu(n),0),r=t?t.length:0,!r||1>n)return[];for(var e=0,u=0,o=Uu(so(r/n));er&&(r=-r>u?0:u+r),e=e===P||e>u?u:vu(e),0>e&&(e+=u),e=r>e?0:gu(e);r>>0,r?(t=bu(t))&&(typeof n=="string"||null!=n&&!Gi(n))&&(n=gr(n),""==n&&Ct.test(t))?Ar(t.match(Bt),0,r):ko.call(t,n,r):[]},Rt.spread=function(t,n){if(typeof t!="function")throw new Nu("Expected a function");return n=n===P?0:xo(vu(n),0),cr(function(e){var u=e[n];return e=Ar(e,0,n),u&&s(e,u),r(t,this,e)})},Rt.tail=function(t){return Se(t,1)},Rt.take=function(t,n,r){return t&&t.length?(n=r||n===P?1:vu(n),
+lr(t,0,0>n?0:n)):[]},Rt.takeRight=function(t,n,r){var e=t?t.length:0;return e?(n=r||n===P?1:vu(n),n=e-n,lr(t,0>n?0:n,e)):[]},Rt.takeRightWhile=function(t,n){return t&&t.length?yr(t,ie(n,3),false,true):[]},Rt.takeWhile=function(t,n){return t&&t.length?yr(t,ie(n,3)):[]},Rt.tap=function(t,n){return n(t),t},Rt.throttle=function(t,n,r){var e=true,u=true;if(typeof t!="function")throw new Nu("Expected a function");return fu(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),Ye(t,n,{leading:e,maxWait:n,
+trailing:u})},Rt.thru=$e,Rt.toArray=pu,Rt.toPairs=_f,Rt.toPairsIn=vf,Rt.toPath=function(t){return Pi(t)?l(t,Ae):hu(t)?[t]:Ir(ii(t))},Rt.toPlainObject=yu,Rt.transform=function(t,n,r){var e=Pi(t)||Yi(t);if(n=ie(n,4),null==r)if(e||fu(t)){var o=t.constructor;r=e?Pi(t)?new o:[]:uu(o)?bn(ti(t)):{}}else r={};return(e?u:kn)(t,function(t,e,u){return n(r,t,e,u)}),r},Rt.unary=function(t){return Ve(t,1)},Rt.union=vi,Rt.unionBy=gi,Rt.unionWith=di,Rt.uniq=function(t){return t&&t.length?dr(t):[]},Rt.uniqBy=function(t,n){
+return t&&t.length?dr(t,ie(n,2)):[]},Rt.uniqWith=function(t,n){return t&&t.length?dr(t,P,n):[]},Rt.unset=function(t,n){var r;if(null==t)r=true;else{r=t;var e=n,e=ye(e,r)?[e]:mr(e);r=me(r,e),e=Ae(Me(e)),r=!(null!=r&&Bn(r,e))||delete r[e]}return r},Rt.unzip=ze,Rt.unzipWith=Ue,Rt.update=function(t,n,r){return null==t?t:ar(t,n,(typeof r=="function"?r:Iu)(Rn(t,n)),void 0)},Rt.updateWith=function(t,n,r,e){return e=typeof e=="function"?e:P,null!=t&&(t=ar(t,n,(typeof r=="function"?r:Iu)(Rn(t,n)),e)),t},Rt.values=Ou,
+Rt.valuesIn=function(t){return null==t?[]:R(t,mu(t))},Rt.without=yi,Rt.words=Su,Rt.wrap=function(t,n){return n=null==n?Iu:n,Di(n,t)},Rt.xor=bi,Rt.xorBy=xi,Rt.xorWith=ji,Rt.zip=wi,Rt.zipObject=function(t,n){return jr(t||[],n||[],ln)},Rt.zipObjectDeep=function(t,n){return jr(t||[],n||[],ar)},Rt.zipWith=mi,Rt.entries=_f,Rt.entriesIn=vf,Rt.extend=tf,Rt.extendWith=nf,Bu(Rt,Rt),Rt.add=Lf,Rt.attempt=Af,Rt.camelCase=gf,Rt.capitalize=ku,Rt.ceil=zf,Rt.clamp=function(t,n,r){return r===P&&(r=n,n=P),r!==P&&(r=du(r),
+r=r===r?r:0),n!==P&&(n=du(n),n=n===n?n:0),vn(du(t),n,r)},Rt.clone=function(t){return gn(t,false,true)},Rt.cloneDeep=function(t){return gn(t,true,true)},Rt.cloneDeepWith=function(t,n){return gn(t,true,true,n)},Rt.cloneWith=function(t,n){return gn(t,false,true,n)},Rt.conformsTo=function(t,n){return null==n||yn(t,n,wu(n))},Rt.deburr=Eu,Rt.defaultTo=function(t,n){return null==t||t!==t?n:t},Rt.divide=Uf,Rt.endsWith=function(t,n,r){t=bu(t),n=gr(n);var e=t.length,e=r=r===P?e:vn(vu(r),0,e);return r-=n.length,0<=r&&t.slice(r,e)==n;
+},Rt.eq=Xe,Rt.escape=function(t){return(t=bu(t))&&X.test(t)?t.replace(H,en):t},Rt.escapeRegExp=function(t){return(t=bu(t))&&ft.test(t)?t.replace(it,"\\$&"):t},Rt.every=function(t,n,r){var e=Pi(t)?i:wn;return r&&de(t,n,r)&&(n=P),e(t,ie(n,3))},Rt.find=ki,Rt.findIndex=Ie,Rt.findKey=function(t,n){return v(t,ie(n,3),kn)},Rt.findLast=Ei,Rt.findLastIndex=We,Rt.findLastKey=function(t,n){return v(t,ie(n,3),En)},Rt.floor=Df,Rt.forEach=Te,Rt.forEachRight=Ne,Rt.forIn=function(t,n){return null==t?t:Ko(t,ie(n,3),mu);
+},Rt.forInRight=function(t,n){return null==t?t:Go(t,ie(n,3),mu)},Rt.forOwn=function(t,n){return t&&kn(t,ie(n,3))},Rt.forOwnRight=function(t,n){return t&&En(t,ie(n,3))},Rt.get=xu,Rt.gt=Ti,Rt.gte=Ni,Rt.has=function(t,n){return null!=t&&le(t,n,Bn)},Rt.hasIn=ju,Rt.head=Be,Rt.identity=Iu,Rt.includes=function(t,n,r,e){return t=nu(t)?t:Ou(t),r=r&&!e?vu(r):0,e=t.length,0>r&&(r=xo(e+r,0)),su(t)?r<=e&&-1r&&(r=xo(e+r,0)),d(t,n,r)):-1},Rt.inRange=function(t,n,r){return n=du(n)||0,r===P?(r=n,n=0):r=du(r)||0,t=du(t),t>=jo(n,r)&&t=t},Rt.isSet=Ji,Rt.isString=su,
+Rt.isSymbol=hu,Rt.isTypedArray=Yi,Rt.isUndefined=function(t){return t===P},Rt.isWeakMap=function(t){return cu(t)&&"[object WeakMap]"==Et(t)},Rt.isWeakSet=function(t){return cu(t)&&"[object WeakSet]"==Qu.call(t)},Rt.join=function(t,n){return t?yo.call(t,n):""},Rt.kebabCase=df,Rt.last=Me,Rt.lastIndexOf=function(t,n,r){var e=t?t.length:0;if(!e)return-1;var u=e;if(r!==P&&(u=vu(r),u=(0>u?xo(e+u,0):jo(u,e-1))+1),n!==n)return g(t,b,u-1,true);for(;u--;)if(t[u]===n)return u;return-1},Rt.lowerCase=yf,Rt.lowerFirst=bf,
+Rt.lt=Hi,Rt.lte=Qi,Rt.max=function(t){return t&&t.length?mn(t,Iu,Wn):P},Rt.maxBy=function(t,n){return t&&t.length?mn(t,ie(n,2),Wn):P},Rt.mean=function(t){return x(t,Iu)},Rt.meanBy=function(t,n){return x(t,ie(n,2))},Rt.min=function(t){return t&&t.length?mn(t,Iu,Gn):P},Rt.minBy=function(t,n){return t&&t.length?mn(t,ie(n,2),Gn):P},Rt.stubArray=Lu,Rt.stubFalse=zu,Rt.stubObject=function(){return{}},Rt.stubString=function(){return""},Rt.stubTrue=function(){return true},Rt.multiply=$f,Rt.nth=function(t,n){
+return t&&t.length?Xn(t,vu(n)):P},Rt.noConflict=function(){return qt._===this&&(qt._=Xu),this},Rt.noop=Mu,Rt.now=qe,Rt.pad=function(t,n,r){t=bu(t);var e=(n=vu(n))?T(t):0;return!n||e>=n?t:(n=(n-e)/2,Gr(ho(n),r)+t+Gr(so(n),r))},Rt.padEnd=function(t,n,r){t=bu(t);var e=(n=vu(n))?T(t):0;return n&&en){var e=t;t=n,n=e}return r||t%1||n%1?(r=mo(),jo(t+r*(n-t+Tt("1e-"+((r+"").length-1))),n)):ir(t,n)},Rt.reduce=function(t,n,r){var e=Pi(t)?h:m,u=3>arguments.length;return e(t,ie(n,4),r,u,qo)},Rt.reduceRight=function(t,n,r){var e=Pi(t)?p:m,u=3>arguments.length;return e(t,ie(n,4),r,u,Vo)},Rt.repeat=function(t,n,r){
+return n=(r?de(t,n,r):n===P)?1:vu(n),fr(bu(t),n)},Rt.replace=function(){var t=arguments,n=bu(t[0]);return 3>t.length?n:Ao.call(n,t[1],t[2])},Rt.result=function(t,n,r){n=ye(n,t)?[n]:mr(n);var e=-1,u=n.length;for(u||(t=P,u=1);++et||9007199254740991=o)return t;if(o=r-T(e),1>o)return e;if(r=i?Ar(i,0,o).join(""):t.slice(0,o),u===P)return r+e;if(i&&(o+=r.length-o),Gi(u)){if(t.slice(o).search(u)){var f=r;for(u.global||(u=Tu(u.source,bu(dt.exec(u))+"g")),
+u.lastIndex=0;i=u.exec(f);)var c=i.index;r=r.slice(0,c===P?o:c)}}else t.indexOf(gr(u),o)!=o&&(u=r.lastIndexOf(u),-1u.__dir__?"Right":"")}),u},Pt.prototype[t+"Right"]=function(n){return this.reverse()[t](n).reverse()}}),u(["filter","map","takeWhile"],function(t,n){var r=n+1,e=1==r||3==r;Pt.prototype[t]=function(t){var n=this.clone();return n.__iteratees__.push({
+iteratee:ie(t,3),type:r}),n.__filtered__=n.__filtered__||e,n}}),u(["head","last"],function(t,n){var r="take"+(n?"Right":"");Pt.prototype[t]=function(){return this[r](1).value()[0]}}),u(["initial","tail"],function(t,n){var r="drop"+(n?"":"Right");Pt.prototype[t]=function(){return this.__filtered__?new Pt(this):this[r](1)}}),Pt.prototype.compact=function(){return this.filter(Iu)},Pt.prototype.find=function(t){return this.filter(t).head()},Pt.prototype.findLast=function(t){return this.reverse().find(t);
+},Pt.prototype.invokeMap=cr(function(t,n){return typeof t=="function"?new Pt(this):this.map(function(r){return zn(r,t,n)})}),Pt.prototype.reject=function(t){return this.filter(Qe(ie(t)))},Pt.prototype.slice=function(t,n){t=vu(t);var r=this;return r.__filtered__&&(0n)?new Pt(r):(0>t?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==P&&(n=vu(n),r=0>n?r.dropRight(-n):r.take(n-t)),r)},Pt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Pt.prototype.toArray=function(){return this.take(4294967295);
+},kn(Pt.prototype,function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),e=/^(?:head|last)$/.test(n),u=Rt[e?"take"+("last"==n?"Right":""):n],o=e||/^find/.test(n);u&&(Rt.prototype[n]=function(){function n(t){return t=u.apply(Rt,s([t],f)),e&&h?t[0]:t}var i=this.__wrapped__,f=e?[1]:arguments,c=i instanceof Pt,a=f[0],l=c||Pi(i);l&&r&&typeof a=="function"&&1!=a.length&&(c=l=false);var h=this.__chain__,p=!!this.__actions__.length,a=o&&!h,c=c&&!p;return!o&&l?(i=c?i:new Pt(this),i=t.apply(i,f),i.__actions__.push({
+func:$e,args:[n],thisArg:P}),new Ft(i,h)):a&&c?t.apply(this,f):(i=this.thru(n),a?e?i.value()[0]:i.value():i)})}),u("pop push shift sort splice unshift".split(" "),function(t){var n=Pu[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",e=/^(?:pop|shift)$/.test(t);Rt.prototype[t]=function(){var t=arguments;if(e&&!this.__chain__){var u=this.value();return n.apply(Pi(u)?u:[],t)}return this[r](function(r){return n.apply(Pi(r)?r:[],t)})}}),kn(Pt.prototype,function(t,n){var r=Rt[n];if(r){var e=r.name+"";
+(zo[e]||(zo[e]=[])).push({name:n,func:r})}}),zo[Zr(P,2).name]=[{name:"wrapper",func:P}],Pt.prototype.clone=function(){var t=new Pt(this.__wrapped__);return t.__actions__=Ir(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ir(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ir(this.__views__),t},Pt.prototype.reverse=function(){if(this.__filtered__){var t=new Pt(this);t.__dir__=-1,t.__filtered__=true}else t=this.clone(),t.__dir__*=-1;return t;
+},Pt.prototype.value=function(){var t,n=this.__wrapped__.value(),r=this.__dir__,e=Pi(n),u=0>r,o=e?n.length:0;t=o;for(var i=this.__views__,f=0,c=-1,a=i.length;++co||o==t&&a==t)return br(n,this.__actions__);e=[];t:for(;t--&&c=this.__values__.length,n=t?P:this.__values__[this.__index__++];return{done:t,value:n}},Rt.prototype.plant=function(t){
+for(var n,r=this;r instanceof $t;){var e=Ee(r);e.__index__=0,e.__values__=P,n?u.__wrapped__=e:n=e;var u=e,r=r.__wrapped__}return u.__wrapped__=t,n},Rt.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof Pt?(this.__actions__.length&&(t=new Pt(this)),t=t.reverse(),t.__actions__.push({func:$e,args:[Le],thisArg:P}),new Ft(t,this.__chain__)):this.thru(Le)},Rt.prototype.toJSON=Rt.prototype.valueOf=Rt.prototype.value=function(){return br(this.__wrapped__,this.__actions__)},Rt.prototype.first=Rt.prototype.head,
+io&&(Rt.prototype[io]=Fe),Rt}var P,Z=1/0,q=NaN,V=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],K=/\b__p\+='';/g,G=/\b(__p\+=)''\+/g,J=/(__e\(.*?\)|\b__t\))\+'';/g,Y=/&(?:amp|lt|gt|quot|#39|#96);/g,H=/[&<>"'`]/g,Q=RegExp(Y.source),X=RegExp(H.source),tt=/<%-([\s\S]+?)%>/g,nt=/<%([\s\S]+?)%>/g,rt=/<%=([\s\S]+?)%>/g,et=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ut=/^\w*$/,ot=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g,it=/[\\^$.*+?()[\]{}|]/g,ft=RegExp(it.source),ct=/^\s+|\s+$/g,at=/^\s+/,lt=/\s+$/,st=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ht=/\{\n\/\* \[wrapped with (.+)\] \*/,pt=/,? & /,_t=/[a-zA-Z0-9]+/g,vt=/\\(\\)?/g,gt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,yt=/^0x/i,bt=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,jt=/^\[object .+?Constructor\]$/,wt=/^0o[0-7]+$/i,mt=/^(?:0|[1-9]\d*)$/,At=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Ot=/($^)/,kt=/['\n\r\u2028\u2029\\]/g,Et="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|\\ud83c[\\udffb-\\udfff])?)*",St="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+Et,Rt="(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]?|[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])",It=RegExp("['\u2019]","g"),Wt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),Bt=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|"+Rt+Et,"g"),Mt=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['\u2019](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?|\\d+",St].join("|"),"g"),Ct=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),Lt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,zt="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise Reflect RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),Ut={};
+Ut["[object Float32Array]"]=Ut["[object Float64Array]"]=Ut["[object Int8Array]"]=Ut["[object Int16Array]"]=Ut["[object Int32Array]"]=Ut["[object Uint8Array]"]=Ut["[object Uint8ClampedArray]"]=Ut["[object Uint16Array]"]=Ut["[object Uint32Array]"]=true,Ut["[object Arguments]"]=Ut["[object Array]"]=Ut["[object ArrayBuffer]"]=Ut["[object Boolean]"]=Ut["[object DataView]"]=Ut["[object Date]"]=Ut["[object Error]"]=Ut["[object Function]"]=Ut["[object Map]"]=Ut["[object Number]"]=Ut["[object Object]"]=Ut["[object RegExp]"]=Ut["[object Set]"]=Ut["[object String]"]=Ut["[object WeakMap]"]=false;
+var Dt={};Dt["[object Arguments]"]=Dt["[object Array]"]=Dt["[object ArrayBuffer]"]=Dt["[object DataView]"]=Dt["[object Boolean]"]=Dt["[object Date]"]=Dt["[object Float32Array]"]=Dt["[object Float64Array]"]=Dt["[object Int8Array]"]=Dt["[object Int16Array]"]=Dt["[object Int32Array]"]=Dt["[object Map]"]=Dt["[object Number]"]=Dt["[object Object]"]=Dt["[object RegExp]"]=Dt["[object Set]"]=Dt["[object String]"]=Dt["[object Symbol]"]=Dt["[object Uint8Array]"]=Dt["[object Uint8ClampedArray]"]=Dt["[object Uint16Array]"]=Dt["[object Uint32Array]"]=true,
+Dt["[object Error]"]=Dt["[object Function]"]=Dt["[object WeakMap]"]=false;var $t,Ft={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Tt=parseFloat,Nt=parseInt,Pt=typeof global=="object"&&global&&global.Object===Object&&global,Zt=typeof self=="object"&&self&&self.Object===Object&&self,qt=Pt||Zt||Function("return this")(),Vt=Pt&&typeof exports=="object"&&exports,Kt=Vt&&typeof module=="object"&&module,Gt=Kt&&Kt.exports===Vt,Jt=Gt&&Pt.h;t:{try{$t=Jt&&Jt.f("util");break t}catch(t){}
+$t=void 0}var Yt=$t&&$t.isArrayBuffer,Ht=$t&&$t.isDate,Qt=$t&&$t.isMap,Xt=$t&&$t.isRegExp,tn=$t&&$t.isSet,nn=$t&&$t.isTypedArray,rn=w({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n",
+"\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"}),en=w({"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"}),un=w({"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"}),on=N();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(qt._=on,
+define(function(){return on})):Kt?((Kt.exports=on)._=on,Vt._=on):qt._=on}).call(this);
\ No newline at end of file
diff --git a/dist/mapping.fp.js b/dist/mapping.fp.js
index abf71920f9..4d9c62b037 100644
--- a/dist/mapping.fp.js
+++ b/dist/mapping.fp.js
@@ -63,11 +63,20 @@ return /******/ (function(modules) { // webpackBootstrap
'entries': 'toPairs',
'entriesIn': 'toPairsIn',
'extend': 'assignIn',
+ 'extendAll': 'assignInAll',
+ 'extendAllWith': 'assignInAllWith',
'extendWith': 'assignInWith',
'first': 'head',
+ // Methods that are curried variants of others.
+ 'conforms': 'conformsTo',
+ 'matches': 'isMatch',
+ 'property': 'get',
+
// Ramda aliases.
'__': 'placeholder',
+ 'F': 'stubFalse',
+ 'T': 'stubTrue',
'all': 'every',
'allPass': 'overEvery',
'always': 'constant',
@@ -81,8 +90,11 @@ return /******/ (function(modules) { // webpackBootstrap
'contains': 'includes',
'dissoc': 'unset',
'dissocPath': 'unset',
+ 'dropLast': 'dropRight',
+ 'dropLastWhile': 'dropRightWhile',
'equals': 'isEqual',
'identical': 'eq',
+ 'indexBy': 'keyBy',
'init': 'initial',
'invertObj': 'invert',
'juxt': 'over',
@@ -99,36 +111,44 @@ return /******/ (function(modules) { // webpackBootstrap
'propEq': 'matchesProperty',
'propOr': 'getOr',
'props': 'at',
+ 'symmetricDifference': 'xor',
+ 'symmetricDifferenceBy': 'xorBy',
+ 'symmetricDifferenceWith': 'xorWith',
+ 'takeLast': 'takeRight',
+ 'takeLastWhile': 'takeRightWhile',
'unapply': 'rest',
'unnest': 'flatten',
'useWith': 'overArgs',
- 'whereEq': 'filter',
+ 'where': 'conformsTo',
+ 'whereEq': 'isMatch',
'zipObj': 'zipObject'
};
/** Used to map ary to method names. */
exports.aryMethod = {
'1': [
- 'attempt', 'castArray', 'ceil', 'create', 'curry', 'curryRight', 'floor',
- 'flow', 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method',
- 'methodOf', 'mixin', 'over', 'overEvery', 'overSome', 'rest', 'reverse',
- 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart',
- 'uniqueId', 'words'
+ 'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create',
+ 'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow',
+ 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method',
+ 'mergeAll', 'methodOf', 'mixin', 'over', 'overEvery', 'overSome', 'rest',
+ 'reverse', 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd',
+ 'trimStart', 'uniqueId', 'words', 'zipAll'
],
'2': [
- 'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindAll',
- 'bindKey', 'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
- 'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
- 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith',
- 'eq', 'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast',
- 'findLastIndex', 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth',
- 'forEach', 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight',
- 'get', 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf',
- 'intersection', 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch',
- 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues',
- 'matchesProperty', 'maxBy', 'meanBy', 'merge', 'minBy', 'multiply', 'nth',
- 'omit', 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
- 'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',
+ 'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith',
+ 'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith',
+ 'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN',
+ 'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference',
+ 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq',
+ 'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
+ 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', 'forEach',
+ 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', 'get',
+ 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', 'intersection',
+ 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy',
+ 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues', 'matchesProperty',
+ 'maxBy', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit',
+ 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial',
+ 'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
@@ -207,7 +227,9 @@ return /******/ (function(modules) { // webpackBootstrap
/** Used to map method names to rearg configs. */
exports.methodRearg = {
+ 'assignInAllWith': [1, 2, 0],
'assignInWith': [1, 2, 0],
+ 'assignAllWith': [1, 2, 0],
'assignWith': [1, 2, 0],
'differenceBy': [1, 2, 0],
'differenceWith': [1, 2, 0],
@@ -216,6 +238,7 @@ return /******/ (function(modules) { // webpackBootstrap
'intersectionWith': [1, 2, 0],
'isEqualWith': [1, 2, 0],
'isMatchWith': [2, 1, 0],
+ 'mergeAllWith': [1, 2, 0],
'mergeWith': [1, 2, 0],
'padChars': [2, 1, 0],
'padCharsEnd': [2, 1, 0],
@@ -235,11 +258,20 @@ return /******/ (function(modules) { // webpackBootstrap
/** Used to map method names to spread configs. */
exports.methodSpread = {
- 'invokeArgs': 2,
- 'invokeArgsMap': 2,
- 'partial': 1,
- 'partialRight': 1,
- 'without': 1
+ 'assignAll': { 'start': 0 },
+ 'assignAllWith': { 'afterRearg': true, 'start': 1 },
+ 'assignInAll': { 'start': 0 },
+ 'assignInAllWith': { 'afterRearg': true, 'start': 1 },
+ 'defaultsAll': { 'start': 0 },
+ 'defaultsDeepAll': { 'start': 0 },
+ 'invokeArgs': { 'start': 2 },
+ 'invokeArgsMap': { 'start': 2 },
+ 'mergeAll': { 'start': 0 },
+ 'mergeAllWith': { 'afterRearg': true, 'start': 1 },
+ 'partial': { 'start': 1 },
+ 'partialRight': { 'start': 1 },
+ 'without': { 'start': 1 },
+ 'zipAll': { 'start': 0 }
};
/** Used to identify methods which mutate arrays or objects. */
@@ -256,13 +288,21 @@ return /******/ (function(modules) { // webpackBootstrap
},
'object': {
'assign': true,
+ 'assignAll': true,
+ 'assignAllWith': true,
'assignIn': true,
+ 'assignInAll': true,
+ 'assignInAllWith': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
+ 'defaultsAll': true,
'defaultsDeep': true,
+ 'defaultsDeepAll': true,
'merge': true,
- 'mergeWith': true
+ 'mergeAll': true,
+ 'mergeAllWith': true,
+ 'mergeWith': true,
},
'set': {
'set': true,
@@ -302,8 +342,14 @@ return /******/ (function(modules) { // webpackBootstrap
/** Used to map method names to other names. */
exports.remap = {
+ 'assignAll': 'assign',
+ 'assignAllWith': 'assignWith',
+ 'assignInAll': 'assignIn',
+ 'assignInAllWith': 'assignInWith',
'curryN': 'curry',
'curryRightN': 'curryRight',
+ 'defaultsAll': 'defaults',
+ 'defaultsDeepAll': 'defaultsDeep',
'findFrom': 'find',
'findIndexFrom': 'findIndex',
'findLastFrom': 'findLast',
@@ -314,14 +360,18 @@ return /******/ (function(modules) { // webpackBootstrap
'invokeArgs': 'invoke',
'invokeArgsMap': 'invokeMap',
'lastIndexOfFrom': 'lastIndexOf',
+ 'mergeAll': 'merge',
+ 'mergeAllWith': 'mergeWith',
'padChars': 'pad',
'padCharsEnd': 'padEnd',
'padCharsStart': 'padStart',
+ 'propertyOf': 'get',
'restFrom': 'rest',
'spreadFrom': 'spread',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
- 'trimCharsStart': 'trimStart'
+ 'trimCharsStart': 'trimStart',
+ 'zipAll': 'zip'
};
/** Used to track methods that skip fixing their arity. */
@@ -331,6 +381,7 @@ return /******/ (function(modules) { // webpackBootstrap
'flowRight': true,
'iteratee': true,
'mixin': true,
+ 'rearg': true,
'runInContext': true
};
@@ -356,12 +407,14 @@ return /******/ (function(modules) { // webpackBootstrap
'overArgs': true,
'partial': true,
'partialRight': true,
+ 'propertyOf': true,
'random': true,
'range': true,
'rangeRight': true,
'subtract': true,
'zip': true,
- 'zipObject': true
+ 'zipObject': true,
+ 'zipObjectDeep': true
};
diff --git a/doc/README.md b/doc/README.md
index 7f201043cb..a77dc6e09b 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -1,4 +1,4 @@
-# lodashv4.13.1
+# lodashv4.14.0
@@ -131,7 +131,7 @@
* `_.memoize`
* `_.negate`
* `_.once`
-* `_.overArgs`
+* `_.overArgs`
* `_.partial`
* `_.partialRight`
* `_.rearg`
@@ -151,6 +151,7 @@
* `_.cloneDeep`
* `_.cloneDeepWith`
* `_.cloneWith`
+* `_.conformsTo`
* `_.eq`
* `_.gt`
* `_.gte`
@@ -351,6 +352,7 @@
* `_.cond`
* `_.conforms`
* `_.constant`
+* `_.defaultTo`
* `_.flow`
* `_.flowRight`
* `_.identity`
@@ -413,7 +415,7 @@
### `_.chunk(array, [size=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6118 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.chunk "See the npm package")
+[#](#_chunkarray-size1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6318 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.chunk "See the npm package") [Ⓣ][1]
Creates an array of elements split into groups the length of `size`.
If `array` can't be split evenly, the final chunk will be the remaining
@@ -436,14 +438,14 @@ _.chunk(['a', 'b', 'c', 'd'], 2);
_.chunk(['a', 'b', 'c', 'd'], 3);
// => [['a', 'b', 'c'], ['d']]
```
-* * *
+---
### `_.compact(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6153 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.compact "See the npm package")
+[#](#_compactarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6353 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.compact "See the npm package") [Ⓣ][1]
Creates an array with all falsey values removed. The values `false`, `null`,
`0`, `""`, `undefined`, and `NaN` are falsey.
@@ -461,14 +463,14 @@ Creates an array with all falsey values removed. The values `false`, `null`,
_.compact([0, 1, false, 2, '', 3]);
// => [1, 2, 3]
```
-* * *
+---
### `_.concat(array, [values])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6190 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.concat "See the npm package")
+[#](#_concatarray-values) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6390 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.concat "See the npm package") [Ⓣ][1]
Creates a new array concatenating `array` with any additional arrays
and/or values.
@@ -493,19 +495,22 @@ console.log(other);
console.log(array);
// => [1]
```
-* * *
+---
### `_.difference(array, [values])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6223 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.difference "See the npm package")
+[#](#_differencearray-values) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6425 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.difference "See the npm package") [Ⓣ][1]
-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 `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.
+
+
+**Note:** Unlike `_.pullAll`, this method returns a new array.
#### Since
0.1.0
@@ -521,26 +526,29 @@ order they occur in the first array.
_.difference([2, 1], [2, 3]);
// => [1]
```
-* * *
+---
### `_.differenceBy(array, [values], [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6253 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.differenceby "See the npm package")
+[#](#_differencebyarray-values-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6456 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.differenceby "See the npm package") [Ⓣ][1]
This method is like `_.difference` except that it accepts `iteratee` which
is invoked for each element of `array` and `values` to generate the criterion
by which they're compared. Result values are chosen from the first array.
The iteratee is invoked with one argument: *(value)*.
+
+
+**Note:** Unlike `_.pullAllBy`, this method returns a new array.
#### Since
4.0.0
#### Arguments
1. `array` *(Array)*: The array to inspect.
2. `[values]` *(...Array)*: The values to exclude.
-3. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+3. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(Array)*: Returns the new array of filtered values.
@@ -554,19 +562,22 @@ _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
_.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
// => [{ 'x': 2 }]
```
-* * *
+---
### `_.differenceWith(array, [values], [comparator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6284 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.differencewith "See the npm package")
+[#](#_differencewitharray-values-comparator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6489 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.differencewith "See the npm package") [Ⓣ][1]
This method is like `_.difference` except that it accepts `comparator`
which is invoked to compare elements of `array` to `values`. Result values
are chosen from the first array. The comparator is invoked with two arguments:
*(arrVal, othVal)*.
+
+
+**Note:** Unlike `_.pullAllWith`, this method returns a new array.
#### Since
4.0.0
@@ -585,14 +596,14 @@ var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
_.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
// => [{ 'x': 2, 'y': 1 }]
```
-* * *
+---
### `_.drop(array, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6319 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.drop "See the npm package")
+[#](#_droparray-n1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6524 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.drop "See the npm package") [Ⓣ][1]
Creates a slice of `array` with `n` elements dropped from the beginning.
@@ -619,14 +630,14 @@ _.drop([1, 2, 3], 5);
_.drop([1, 2, 3], 0);
// => [1, 2, 3]
```
-* * *
+---
### `_.dropRight(array, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6353 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropright "See the npm package")
+[#](#_droprightarray-n1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6558 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.dropright "See the npm package") [Ⓣ][1]
Creates a slice of `array` with `n` elements dropped from the end.
@@ -653,14 +664,14 @@ _.dropRight([1, 2, 3], 5);
_.dropRight([1, 2, 3], 0);
// => [1, 2, 3]
```
-* * *
+---
### `_.dropRightWhile(array, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6399 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.droprightwhile "See the npm package")
+[#](#_droprightwhilearray-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6603 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.droprightwhile "See the npm package") [Ⓣ][1]
Creates a slice of `array` excluding elements dropped from the end.
Elements are dropped until `predicate` returns falsey. The predicate is
@@ -670,7 +681,7 @@ invoked with three arguments: *(value, index, array)*.
3.0.0
#### Arguments
1. `array` *(Array)*: The array to query.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the slice of `array`.
@@ -698,14 +709,14 @@ _.dropRightWhile(users, ['active', false]);
_.dropRightWhile(users, 'active');
// => objects for ['barney', 'fred', 'pebbles']
```
-* * *
+---
### `_.dropWhile(array, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6441 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropwhile "See the npm package")
+[#](#_dropwhilearray-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6645 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.dropwhile "See the npm package") [Ⓣ][1]
Creates a slice of `array` excluding elements dropped from the beginning.
Elements are dropped until `predicate` returns falsey. The predicate is
@@ -715,7 +726,7 @@ invoked with three arguments: *(value, index, array)*.
3.0.0
#### Arguments
1. `array` *(Array)*: The array to query.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the slice of `array`.
@@ -743,14 +754,14 @@ _.dropWhile(users, ['active', false]);
_.dropWhile(users, 'active');
// => objects for ['barney', 'fred', 'pebbles']
```
-* * *
+---
### `_.fill(array, value, [start=0], [end=array.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6476 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.fill "See the npm package")
+[#](#_fillarray-value-start0-endarraylength) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6680 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.fill "See the npm package") [Ⓣ][1]
Fills elements of `array` with `value` from `start` up to, but not
including, `end`.
@@ -783,14 +794,14 @@ _.fill(Array(3), 2);
_.fill([4, 6, 8, 10], '*', 1, 3);
// => [4, '*', '*', 10]
```
-* * *
+---
### `_.findIndex(array, [predicate=_.identity], [fromIndex=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6524 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findindex "See the npm package")
+[#](#_findindexarray-predicate_identity-fromindex0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6728 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.findindex "See the npm package") [Ⓣ][1]
This method is like `_.find` except that it returns the index of the first
element `predicate` returns truthy for instead of the element itself.
@@ -799,7 +810,7 @@ element `predicate` returns truthy for instead of the element itself.
1.1.0
#### Arguments
1. `array` *(Array)*: The array to search.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
3. `[fromIndex=0]` *(number)*: The index to search from.
#### Returns
@@ -828,14 +839,14 @@ _.findIndex(users, ['active', false]);
_.findIndex(users, 'active');
// => 2
```
-* * *
+---
### `_.findLastIndex(array, [predicate=_.identity], [fromIndex=array.length-1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6572 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastindex "See the npm package")
+[#](#_findlastindexarray-predicate_identity-fromindexarraylength-1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6776 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.findlastindex "See the npm package") [Ⓣ][1]
This method is like `_.findIndex` except that it iterates over elements
of `collection` from right to left.
@@ -844,7 +855,7 @@ of `collection` from right to left.
2.0.0
#### Arguments
1. `array` *(Array)*: The array to search.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
3. `[fromIndex=array.length-1]` *(number)*: The index to search from.
#### Returns
@@ -873,14 +884,14 @@ _.findLastIndex(users, ['active', false]);
_.findLastIndex(users, 'active');
// => 0
```
-* * *
+---
### `_.flatten(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6601 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatten "See the npm package")
+[#](#_flattenarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6805 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flatten "See the npm package") [Ⓣ][1]
Flattens `array` a single level deep.
@@ -897,14 +908,14 @@ Flattens `array` a single level deep.
_.flatten([1, [2, [3, [4]], 5]]);
// => [1, 2, [3, [4]], 5]
```
-* * *
+---
### `_.flattenDeep(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6620 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendeep "See the npm package")
+[#](#_flattendeeparray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6824 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flattendeep "See the npm package") [Ⓣ][1]
Recursively flattens `array`.
@@ -921,14 +932,14 @@ Recursively flattens `array`.
_.flattenDeep([1, [2, [3, [4]], 5]]);
// => [1, 2, 3, 4, 5]
```
-* * *
+---
### `_.flattenDepth(array, [depth=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6645 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendepth "See the npm package")
+[#](#_flattendeptharray-depth1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6849 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flattendepth "See the npm package") [Ⓣ][1]
Recursively flatten `array` up to `depth` times.
@@ -951,14 +962,14 @@ _.flattenDepth(array, 1);
_.flattenDepth(array, 2);
// => [1, 2, 3, [4], 5]
```
-* * *
+---
### `_.fromPairs(pairs)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6669 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.frompairs "See the npm package")
+[#](#_frompairspairs) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6873 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.frompairs "See the npm package") [Ⓣ][1]
The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@@ -973,17 +984,17 @@ from key-value `pairs`.
#### Example
```js
-_.fromPairs([['fred', 30], ['barney', 40]]);
-// => { 'fred': 30, 'barney': 40 }
+_.fromPairs([['a', 1], ['b', 2]]);
+// => { 'a': 1, 'b': 2 }
```
-* * *
+---
### `_.head(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6699 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.head "See the npm package")
+[#](#_headarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6903 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.head "See the npm package") [Ⓣ][1]
Gets the first element of `array`.
@@ -1006,14 +1017,14 @@ _.head([1, 2, 3]);
_.head([]);
// => undefined
```
-* * *
+---
### `_.indexOf(array, value, [fromIndex=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6726 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.indexof "See the npm package")
+[#](#_indexofarray-value-fromindex0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6930 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.indexof "See the npm package") [Ⓣ][1]
Gets the index at which the first occurrence of `value` is found in `array`
using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -1039,14 +1050,14 @@ _.indexOf([1, 2, 1, 2], 2);
_.indexOf([1, 2, 1, 2], 2, 2);
// => 3
```
-* * *
+---
### `_.initial(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6752 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.initial "See the npm package")
+[#](#_initialarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6956 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.initial "See the npm package") [Ⓣ][1]
Gets all but the last element of `array`.
@@ -1063,14 +1074,14 @@ Gets all but the last element of `array`.
_.initial([1, 2, 3]);
// => [1, 2]
```
-* * *
+---
### `_.intersection([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6773 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersection "See the npm package")
+[#](#_intersectionarrays) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L6977 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.intersection "See the npm package") [Ⓣ][1]
Creates an array of unique values that are included in all given arrays
using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -1090,14 +1101,14 @@ order they occur in the first array.
_.intersection([2, 1], [2, 3]);
// => [2]
```
-* * *
+---
### `_.intersectionBy([arrays], [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6803 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersectionby "See the npm package")
+[#](#_intersectionbyarrays-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7006 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.intersectionby "See the npm package") [Ⓣ][1]
This method is like `_.intersection` except that it accepts `iteratee`
which is invoked for each element of each `arrays` to generate the criterion
@@ -1108,7 +1119,7 @@ The iteratee is invoked with one argument: *(value)*.
4.0.0
#### Arguments
1. `[arrays]` *(...Array)*: The arrays to inspect.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(Array)*: Returns the new array of intersecting values.
@@ -1122,14 +1133,14 @@ _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
_.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 1 }]
```
-* * *
+---
### `_.intersectionWith([arrays], [comparator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6838 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersectionwith "See the npm package")
+[#](#_intersectionwitharrays-comparator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7041 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.intersectionwith "See the npm package") [Ⓣ][1]
This method is like `_.intersection` except that it accepts `comparator`
which is invoked to compare elements of `arrays`. Result values are chosen
@@ -1153,14 +1164,14 @@ var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
_.intersectionWith(objects, others, _.isEqual);
// => [{ 'x': 1, 'y': 2 }]
```
-* * *
+---
### `_.join(array, [separator=','])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6867 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.join "See the npm package")
+[#](#_joinarray-separator-) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7070 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.join "See the npm package") [Ⓣ][1]
Converts all elements in `array` into a string separated by `separator`.
@@ -1178,14 +1189,14 @@ Converts all elements in `array` into a string separated by `separator`.
_.join(['a', 'b', 'c'], '~');
// => 'a~b~c'
```
-* * *
+---
### `_.last(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6885 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.last "See the npm package")
+[#](#_lastarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7088 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.last "See the npm package") [Ⓣ][1]
Gets the last element of `array`.
@@ -1202,14 +1213,14 @@ Gets the last element of `array`.
_.last([1, 2, 3]);
// => 3
```
-* * *
+---
### `_.lastIndexOf(array, value, [fromIndex=array.length-1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6911 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lastindexof "See the npm package")
+[#](#_lastindexofarray-value-fromindexarraylength-1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7114 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.lastindexof "See the npm package") [Ⓣ][1]
This method is like `_.indexOf` except that it iterates over elements of
`array` from right to left.
@@ -1233,14 +1244,14 @@ _.lastIndexOf([1, 2, 1, 2], 2);
_.lastIndexOf([1, 2, 1, 2], 2, 2);
// => 1
```
-* * *
+---
### `_.nth(array, [n=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6957 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.nth "See the npm package")
+[#](#_ntharray-n0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7160 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.nth "See the npm package") [Ⓣ][1]
Gets the element at index `n` of `array`. If `n` is negative, the nth
element from the end is returned.
@@ -1264,14 +1275,14 @@ _.nth(array, 1);
_.nth(array, -2);
// => 'c';
```
-* * *
+---
### `_.pull(array, [values])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L6984 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pull "See the npm package")
+[#](#_pullarray-values) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7187 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pull "See the npm package") [Ⓣ][1]
Removes all given values from `array` using
[`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -1298,14 +1309,14 @@ _.pull(array, 'a', 'c');
console.log(array);
// => ['b', 'b']
```
-* * *
+---
### `_.pullAll(array, values)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7006 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullall "See the npm package")
+[#](#_pullallarray-values) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7209 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pullall "See the npm package") [Ⓣ][1]
This method is like `_.pull` except that it accepts an array of values to remove.
@@ -1329,14 +1340,14 @@ _.pullAll(array, ['a', 'c']);
console.log(array);
// => ['b', 'b']
```
-* * *
+---
### `_.pullAllBy(array, values, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7036 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullallby "See the npm package")
+[#](#_pullallbyarray-values-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7239 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pullallby "See the npm package") [Ⓣ][1]
This method is like `_.pullAll` except that it accepts `iteratee` which is
invoked for each element of `array` and `values` to generate the criterion
@@ -1350,7 +1361,7 @@ by which they're compared. The iteratee is invoked with one argument: *(value)*.
#### Arguments
1. `array` *(Array)*: The array to modify.
2. `values` *(Array)*: The values to remove.
-3. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+3. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(Array)*: Returns `array`.
@@ -1363,14 +1374,14 @@ _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
console.log(array);
// => [{ 'x': 2 }]
```
-* * *
+---
### `_.pullAllWith(array, values, [comparator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7065 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullallwith "See the npm package")
+[#](#_pullallwitharray-values-comparator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7268 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pullallwith "See the npm package") [Ⓣ][1]
This method is like `_.pullAll` except that it accepts `comparator` which
is invoked to compare elements of `array` to `values`. The comparator is
@@ -1397,14 +1408,14 @@ _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
console.log(array);
// => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
```
-* * *
+---
### `_.pullAt(array, [indexes])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7095 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullat "See the npm package")
+[#](#_pullatarray-indexes) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7298 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pullat "See the npm package") [Ⓣ][1]
Removes elements from `array` corresponding to `indexes` and returns an
array of removed elements.
@@ -1432,14 +1443,14 @@ console.log(array);
console.log(pulled);
// => ['b', 'd']
```
-* * *
+---
### `_.remove(array, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7137 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.remove "See the npm package")
+[#](#_removearray-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7340 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.remove "See the npm package") [Ⓣ][1]
Removes all elements from `array` that `predicate` returns truthy for
and returns an array of the removed elements. The predicate is invoked
@@ -1453,7 +1464,7 @@ to pull elements from an array by value.
2.0.0
#### Arguments
1. `array` *(Array)*: The array to modify.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new array of removed elements.
@@ -1471,14 +1482,14 @@ console.log(array);
console.log(evens);
// => [2, 4]
```
-* * *
+---
### `_.reverse(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7181 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reverse "See the npm package")
+[#](#_reversearray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7384 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.reverse "See the npm package") [Ⓣ][1]
Reverses `array` so that the first element becomes the last, the second
element becomes the second to last, and so on.
@@ -1505,14 +1516,14 @@ _.reverse(array);
console.log(array);
// => [3, 2, 1]
```
-* * *
+---
### `_.slice(array, [start=0], [end=array.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7201 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.slice "See the npm package")
+[#](#_slicearray-start0-endarraylength) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7404 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.slice "See the npm package") [Ⓣ][1]
Creates a slice of `array` from `start` up to, but not including, `end`.
@@ -1531,14 +1542,14 @@ returned.
#### Returns
*(Array)*: Returns the slice of `array`.
-* * *
+---
### `_.sortedIndex(array, value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7234 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindex "See the npm package")
+[#](#_sortedindexarray-value) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7437 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedindex "See the npm package") [Ⓣ][1]
Uses a binary search to determine the lowest index at which `value`
should be inserted into `array` in order to maintain its sort order.
@@ -1557,14 +1568,14 @@ should be inserted into `array` in order to maintain its sort order.
_.sortedIndex([30, 50], 40);
// => 1
```
-* * *
+---
### `_.sortedIndexBy(array, value, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7264 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexby "See the npm package")
+[#](#_sortedindexbyarray-value-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7467 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexby "See the npm package") [Ⓣ][1]
This method is like `_.sortedIndex` except that it accepts `iteratee`
which is invoked for `value` and each element of `array` to compute their
@@ -1575,7 +1586,7 @@ sort ranking. The iteratee is invoked with one argument: *(value)*.
#### Arguments
1. `array` *(Array)*: The sorted array to inspect.
2. `value` *(*)*: The value to evaluate.
-3. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+3. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(number)*: Returns the index at which `value` should be inserted into `array`.
@@ -1591,14 +1602,14 @@ _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
_.sortedIndexBy(objects, { 'x': 4 }, 'x');
// => 0
```
-* * *
+---
### `_.sortedIndexOf(array, value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7284 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexof "See the npm package")
+[#](#_sortedindexofarray-value) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7487 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexof "See the npm package") [Ⓣ][1]
This method is like `_.indexOf` except that it performs a binary
search on a sorted `array`.
@@ -1617,14 +1628,14 @@ search on a sorted `array`.
_.sortedIndexOf([4, 5, 5, 5, 6], 5);
// => 1
```
-* * *
+---
### `_.sortedLastIndex(array, value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7313 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindex "See the npm package")
+[#](#_sortedlastindexarray-value) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7516 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindex "See the npm package") [Ⓣ][1]
This method is like `_.sortedIndex` except that it returns the highest
index at which `value` should be inserted into `array` in order to
@@ -1644,14 +1655,14 @@ maintain its sort order.
_.sortedLastIndex([4, 5, 5, 5, 6], 5);
// => 4
```
-* * *
+---
### `_.sortedLastIndexBy(array, value, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7343 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexby "See the npm package")
+[#](#_sortedlastindexbyarray-value-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7546 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexby "See the npm package") [Ⓣ][1]
This method is like `_.sortedLastIndex` except that it accepts `iteratee`
which is invoked for `value` and each element of `array` to compute their
@@ -1662,7 +1673,7 @@ sort ranking. The iteratee is invoked with one argument: *(value)*.
#### Arguments
1. `array` *(Array)*: The sorted array to inspect.
2. `value` *(*)*: The value to evaluate.
-3. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+3. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(number)*: Returns the index at which `value` should be inserted into `array`.
@@ -1678,14 +1689,14 @@ _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
_.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
// => 1
```
-* * *
+---
### `_.sortedLastIndexOf(array, value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7363 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexof "See the npm package")
+[#](#_sortedlastindexofarray-value) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7566 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexof "See the npm package") [Ⓣ][1]
This method is like `_.lastIndexOf` except that it performs a binary
search on a sorted `array`.
@@ -1704,14 +1715,14 @@ search on a sorted `array`.
_.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
// => 3
```
-* * *
+---
### `_.sortedUniq(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7389 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniq "See the npm package")
+[#](#_sorteduniqarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7592 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniq "See the npm package") [Ⓣ][1]
This method is like `_.uniq` except that it's designed and optimized
for sorted arrays.
@@ -1729,14 +1740,14 @@ for sorted arrays.
_.sortedUniq([1, 1, 2]);
// => [1, 2]
```
-* * *
+---
### `_.sortedUniqBy(array, [iteratee])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7411 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniqby "See the npm package")
+[#](#_sorteduniqbyarray-iteratee) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7614 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniqby "See the npm package") [Ⓣ][1]
This method is like `_.uniqBy` except that it's designed and optimized
for sorted arrays.
@@ -1755,14 +1766,14 @@ for sorted arrays.
_.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
// => [1.1, 2.3]
```
-* * *
+---
### `_.tail(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7431 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tail "See the npm package")
+[#](#_tailarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7634 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tail "See the npm package") [Ⓣ][1]
Gets all but the first element of `array`.
@@ -1779,14 +1790,14 @@ Gets all but the first element of `array`.
_.tail([1, 2, 3]);
// => [2, 3]
```
-* * *
+---
### `_.take(array, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7460 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.take "See the npm package")
+[#](#_takearray-n1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7663 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.take "See the npm package") [Ⓣ][1]
Creates a slice of `array` with `n` elements taken from the beginning.
@@ -1813,14 +1824,14 @@ _.take([1, 2, 3], 5);
_.take([1, 2, 3], 0);
// => []
```
-* * *
+---
### `_.takeRight(array, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7493 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takeright "See the npm package")
+[#](#_takerightarray-n1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7696 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.takeright "See the npm package") [Ⓣ][1]
Creates a slice of `array` with `n` elements taken from the end.
@@ -1847,14 +1858,14 @@ _.takeRight([1, 2, 3], 5);
_.takeRight([1, 2, 3], 0);
// => []
```
-* * *
+---
### `_.takeRightWhile(array, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7539 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takerightwhile "See the npm package")
+[#](#_takerightwhilearray-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7742 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.takerightwhile "See the npm package") [Ⓣ][1]
Creates a slice of `array` with elements taken from the end. Elements are
taken until `predicate` returns falsey. The predicate is invoked with
@@ -1864,7 +1875,7 @@ three arguments: *(value, index, array)*.
3.0.0
#### Arguments
1. `array` *(Array)*: The array to query.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the slice of `array`.
@@ -1892,14 +1903,14 @@ _.takeRightWhile(users, ['active', false]);
_.takeRightWhile(users, 'active');
// => []
```
-* * *
+---
### `_.takeWhile(array, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7581 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takewhile "See the npm package")
+[#](#_takewhilearray-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7784 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.takewhile "See the npm package") [Ⓣ][1]
Creates a slice of `array` with elements taken from the beginning. Elements
are taken until `predicate` returns falsey. The predicate is invoked with
@@ -1909,7 +1920,7 @@ three arguments: *(value, index, array)*.
3.0.0
#### Arguments
1. `array` *(Array)*: The array to query.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the slice of `array`.
@@ -1937,14 +1948,14 @@ _.takeWhile(users, ['active', false]);
_.takeWhile(users, 'active');
// => []
```
-* * *
+---
### `_.union([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7603 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.union "See the npm package")
+[#](#_unionarrays) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7806 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.union "See the npm package") [Ⓣ][1]
Creates an array of unique values, in order, from all given arrays using
[`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -1963,25 +1974,26 @@ for equality comparisons.
_.union([2], [1, 2]);
// => [2, 1]
```
-* * *
+---
### `_.unionBy([arrays], [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7630 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unionby "See the npm package")
+[#](#_unionbyarrays-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7834 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unionby "See the npm package") [Ⓣ][1]
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:
+which uniqueness is computed. Result values are chosen from the first
+array in which the value occurs. The iteratee is invoked with one argument:
*(value)*.
#### Since
4.0.0
#### Arguments
1. `[arrays]` *(...Array)*: The arrays to inspect.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(Array)*: Returns the new array of combined values.
@@ -1995,17 +2007,18 @@ _.unionBy([2.1], [1.2, 2.3], Math.floor);
_.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 1 }, { 'x': 2 }]
```
-* * *
+---
### `_.unionWith([arrays], [comparator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7658 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unionwith "See the npm package")
+[#](#_unionwitharrays-comparator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7863 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unionwith "See the npm package") [Ⓣ][1]
This method is like `_.union` except that it accepts `comparator` which
-is invoked to compare elements of `arrays`. The comparator is invoked
+is invoked to compare elements of `arrays`. Result values are chosen from
+the first array in which the value occurs. The comparator is invoked
with two arguments: *(arrVal, othVal)*.
#### Since
@@ -2025,14 +2038,14 @@ var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
_.unionWith(objects, others, _.isEqual);
// => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
```
-* * *
+---
### `_.uniq(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7683 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniq "See the npm package")
+[#](#_uniqarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7888 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.uniq "See the npm package") [Ⓣ][1]
Creates a duplicate-free version of an array, using
[`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -2052,14 +2065,14 @@ element is kept.
_.uniq([2, 1, 2]);
// => [2, 1]
```
-* * *
+---
### `_.uniqBy(array, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7711 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqby "See the npm package")
+[#](#_uniqbyarray-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7916 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.uniqby "See the npm package") [Ⓣ][1]
This method is like `_.uniq` except that it accepts `iteratee` which is
invoked for each element in `array` to generate the criterion by which
@@ -2069,7 +2082,7 @@ uniqueness is computed. The iteratee is invoked with one argument: *(value)*.
4.0.0
#### Arguments
1. `array` *(Array)*: The array to inspect.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(Array)*: Returns the new duplicate free array.
@@ -2083,14 +2096,14 @@ _.uniqBy([2.1, 1.2, 2.3], Math.floor);
_.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 1 }, { 'x': 2 }]
```
-* * *
+---
### `_.uniqWith(array, [comparator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7736 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqwith "See the npm package")
+[#](#_uniqwitharray-comparator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7941 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.uniqwith "See the npm package") [Ⓣ][1]
This method is like `_.uniq` except that it accepts `comparator` which
is invoked to compare elements of `array`. The comparator is invoked with
@@ -2112,14 +2125,14 @@ var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
_.uniqWith(objects, _.isEqual);
// => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
```
-* * *
+---
### `_.unzip(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7761 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzip "See the npm package")
+[#](#_unziparray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L7966 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unzip "See the npm package") [Ⓣ][1]
This method is like `_.zip` except that it accepts an array of grouped
elements and creates an array regrouping the elements to their pre-zip
@@ -2135,20 +2148,20 @@ configuration.
#### Example
```js
-var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
-// => [['fred', 30, true], ['barney', 40, false]]
+var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
+// => [['a', 1, true], ['b', 2, false]]
_.unzip(zipped);
-// => [['fred', 'barney'], [30, 40], [true, false]]
+// => [['a', 'b'], [1, 2], [true, false]]
```
-* * *
+---
### `_.unzipWith(array, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7798 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzipwith "See the npm package")
+[#](#_unzipwitharray-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8003 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unzipwith "See the npm package") [Ⓣ][1]
This method is like `_.unzip` except that it accepts `iteratee` to specify
how regrouped values should be combined. The iteratee is invoked with the
@@ -2171,18 +2184,21 @@ var zipped = _.zip([1, 2], [10, 20], [100, 200]);
_.unzipWith(zipped, _.add);
// => [3, 30, 300]
```
-* * *
+---
### `_.without(array, [values])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7829 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.without "See the npm package")
+[#](#_withoutarray-values) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8036 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.without "See the npm package") [Ⓣ][1]
Creates an array excluding all given values using
[`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
for equality comparisons.
+
+
+**Note:** Unlike `_.pull`, this method returns a new array.
#### Since
0.1.0
@@ -2198,14 +2214,14 @@ for equality comparisons.
_.without([2, 1, 2, 3], 1, 2);
// => [3]
```
-* * *
+---
### `_.xor([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7853 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xor "See the npm package")
+[#](#_xorarrays) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8060 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.xor "See the npm package") [Ⓣ][1]
Creates an array of unique values that is the
[symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
@@ -2225,14 +2241,14 @@ they occur in the arrays.
_.xor([2, 1], [2, 3]);
// => [1, 3]
```
-* * *
+---
### `_.xorBy([arrays], [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7880 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xorby "See the npm package")
+[#](#_xorbyarrays-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8087 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.xorby "See the npm package") [Ⓣ][1]
This method is like `_.xor` except that it accepts `iteratee` which is
invoked for each element of each `arrays` to generate the criterion by
@@ -2243,7 +2259,7 @@ which by which they're compared. The iteratee is invoked with one argument:
4.0.0
#### Arguments
1. `[arrays]` *(...Array)*: The arrays to inspect.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(Array)*: Returns the new array of filtered values.
@@ -2257,14 +2273,14 @@ _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
_.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 2 }]
```
-* * *
+---
### `_.xorWith([arrays], [comparator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7908 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xorwith "See the npm package")
+[#](#_xorwitharrays-comparator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8115 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.xorwith "See the npm package") [Ⓣ][1]
This method is like `_.xor` except that it accepts `comparator` which is
invoked to compare elements of `arrays`. The comparator is invoked with
@@ -2287,14 +2303,14 @@ var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
_.xorWith(objects, others, _.isEqual);
// => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
```
-* * *
+---
### `_.zip([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7932 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zip "See the npm package")
+[#](#_ziparrays) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8139 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.zip "See the npm package") [Ⓣ][1]
Creates an array of grouped elements, the first of which contains the
first elements of the given arrays, the second of which contains the
@@ -2310,17 +2326,17 @@ second elements of the given arrays, and so on.
#### Example
```js
-_.zip(['fred', 'barney'], [30, 40], [true, false]);
-// => [['fred', 30, true], ['barney', 40, false]]
+_.zip(['a', 'b'], [1, 2], [true, false]);
+// => [['a', 1, true], ['b', 2, false]]
```
-* * *
+---
### `_.zipObject([props=[]], [values=[]])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7950 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package")
+[#](#_zipobjectprops-values) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8157 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package") [Ⓣ][1]
This method is like `_.fromPairs` except that it accepts two arrays,
one of property identifiers and one of corresponding values.
@@ -2339,14 +2355,14 @@ one of property identifiers and one of corresponding values.
_.zipObject(['a', 'b'], [1, 2]);
// => { 'a': 1, 'b': 2 }
```
-* * *
+---
### `_.zipObjectDeep([props=[]], [values=[]])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7969 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobjectdeep "See the npm package")
+[#](#_zipobjectdeepprops-values) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8176 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.zipobjectdeep "See the npm package") [Ⓣ][1]
This method is like `_.zipObject` except that it supports property paths.
@@ -2364,14 +2380,14 @@ This method is like `_.zipObject` except that it supports property paths.
_.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
// => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
```
-* * *
+---
### `_.zipWith([arrays], [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L7992 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipwith "See the npm package")
+[#](#_zipwitharrays-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8199 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.zipwith "See the npm package") [Ⓣ][1]
This method is like `_.zip` except that it accepts `iteratee` to specify
how grouped values should be combined. The iteratee is invoked with the
@@ -2393,7 +2409,7 @@ _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
});
// => [111, 222]
```
-* * *
+---
@@ -2406,7 +2422,7 @@ _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
### `_.countBy(collection, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8373 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.countby "See the npm package")
+[#](#_countbycollection-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8580 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.countby "See the npm package") [Ⓣ][1]
Creates an object composed of keys generated from the results of running
each element of `collection` thru `iteratee`. The corresponding value of
@@ -2417,7 +2433,7 @@ iteratee is invoked with one argument: *(value)*.
0.5.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee to transform keys.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee to transform keys.
#### Returns
*(Object)*: Returns the composed aggregate object.
@@ -2431,14 +2447,14 @@ _.countBy([6.1, 4.2, 6.3], Math.floor);
_.countBy(['one', 'two', 'three'], 'length');
// => { '3': 2, '5': 1 }
```
-* * *
+---
### `_.every(collection, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8414 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.every "See the npm package")
+[#](#_everycollection-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8621 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.every "See the npm package") [Ⓣ][1]
Checks if `predicate` returns truthy for **all** elements of `collection`.
Iteration is stopped once `predicate` returns falsey. The predicate is
@@ -2448,7 +2464,7 @@ invoked with three arguments: *(value, index|key, collection)*.
0.1.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(boolean)*: Returns `true` if all elements pass the predicate check, else `false`.
@@ -2475,24 +2491,27 @@ _.every(users, ['active', false]);
_.every(users, 'active');
// => false
```
-* * *
+---
### `_.filter(collection, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8458 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.filter "See the npm package")
+[#](#_filtercollection-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8667 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.filter "See the npm package") [Ⓣ][1]
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)*.
+
+
+**Note:** Unlike `_.remove`, this method returns a new array.
#### Since
0.1.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new filtered array.
@@ -2519,14 +2538,14 @@ _.filter(users, ['active', false]);
_.filter(users, 'active');
// => objects for ['barney']
```
-* * *
+---
### `_.find(collection, [predicate=_.identity], [fromIndex=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8500 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.find "See the npm package")
+[#](#_findcollection-predicate_identity-fromindex0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8709 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.find "See the npm package") [Ⓣ][1]
Iterates over elements of `collection`, returning the first element
`predicate` returns truthy for. The predicate is invoked with three
@@ -2536,7 +2555,7 @@ arguments: *(value, index|key, collection)*.
0.1.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to search.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
3. `[fromIndex=0]` *(number)*: The index to search from.
#### Returns
@@ -2565,14 +2584,14 @@ _.find(users, ['active', false]);
_.find(users, 'active');
// => object for 'barney'
```
-* * *
+---
### `_.findLast(collection, [predicate=_.identity], [fromIndex=collection.length-1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8522 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlast "See the npm package")
+[#](#_findlastcollection-predicate_identity-fromindexcollectionlength-1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8731 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.findlast "See the npm package") [Ⓣ][1]
This method is like `_.find` except that it iterates over elements of
`collection` from right to left.
@@ -2581,7 +2600,7 @@ This method is like `_.find` except that it iterates over elements of
2.0.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to search.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
3. `[fromIndex=collection.length-1]` *(number)*: The index to search from.
#### Returns
@@ -2594,14 +2613,14 @@ _.findLast([1, 2, 3, 4], function(n) {
});
// => 3
```
-* * *
+---
### `_.flatMap(collection, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8546 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmap "See the npm package")
+[#](#_flatmapcollection-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8755 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flatmap "See the npm package") [Ⓣ][1]
Creates a flattened array of values by running each element in `collection`
thru `iteratee` and flattening the mapped results. The iteratee is invoked
@@ -2611,7 +2630,7 @@ with three arguments: *(value, index|key, collection)*.
4.0.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new flattened array.
@@ -2625,14 +2644,14 @@ function duplicate(n) {
_.flatMap([1, 2], duplicate);
// => [1, 1, 2, 2]
```
-* * *
+---
### `_.flatMapDeep(collection, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8571 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmapdeep "See the npm package")
+[#](#_flatmapdeepcollection-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8780 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flatmapdeep "See the npm package") [Ⓣ][1]
This method is like `_.flatMap` except that it recursively flattens the
mapped results.
@@ -2641,7 +2660,7 @@ mapped results.
4.7.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new flattened array.
@@ -2655,14 +2674,14 @@ function duplicate(n) {
_.flatMapDeep([1, 2], duplicate);
// => [1, 1, 2, 2]
```
-* * *
+---
### `_.flatMapDepth(collection, [iteratee=_.identity], [depth=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8597 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmapdepth "See the npm package")
+[#](#_flatmapdepthcollection-iteratee_identity-depth1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8806 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flatmapdepth "See the npm package") [Ⓣ][1]
This method is like `_.flatMap` except that it recursively flattens the
mapped results up to `depth` times.
@@ -2671,7 +2690,7 @@ mapped results up to `depth` times.
4.7.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
3. `[depth=1]` *(number)*: The maximum recursion depth.
#### Returns
@@ -2686,14 +2705,14 @@ function duplicate(n) {
_.flatMapDepth([1, 2], duplicate, 2);
// => [[1, 1], [2, 2]]
```
-* * *
+---
### `_.forEach(collection, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8632 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreach "See the npm package")
+[#](#_foreachcollection-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8841 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.foreach "See the npm package") [Ⓣ][1]
Iterates over elements of `collection` and invokes `iteratee` for each element.
The iteratee is invoked with three arguments: *(value, index|key, collection)*.
@@ -2728,14 +2747,14 @@ _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
});
// => Logs 'a' then 'b' (iteration order is not guaranteed).
```
-* * *
+---
### `_.forEachRight(collection, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8657 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreachright "See the npm package")
+[#](#_foreachrightcollection-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8866 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.foreachright "See the npm package") [Ⓣ][1]
This method is like `_.forEach` except that it iterates over elements of
`collection` from right to left.
@@ -2759,14 +2778,14 @@ _.forEachRight([1, 2], function(value) {
});
// => Logs `2` then `1`.
```
-* * *
+---
### `_.groupBy(collection, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8686 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.groupby "See the npm package")
+[#](#_groupbycollection-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8895 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.groupby "See the npm package") [Ⓣ][1]
Creates an object composed of keys generated from the results of running
each element of `collection` thru `iteratee`. The order of grouped values
@@ -2778,7 +2797,7 @@ key. The iteratee is invoked with one argument: *(value)*.
0.1.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee to transform keys.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee to transform keys.
#### Returns
*(Object)*: Returns the composed aggregate object.
@@ -2792,14 +2811,14 @@ _.groupBy([6.1, 4.2, 6.3], Math.floor);
_.groupBy(['one', 'two', 'three'], 'length');
// => { '3': ['one', 'two'], '5': ['three'] }
```
-* * *
+---
### `_.includes(collection, value, [fromIndex=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8724 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.includes "See the npm package")
+[#](#_includescollection-value-fromindex0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8933 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.includes "See the npm package") [Ⓣ][1]
Checks if `value` is in `collection`. If `collection` is a string, it's
checked for a substring of `value`, otherwise
@@ -2825,25 +2844,25 @@ _.includes([1, 2, 3], 1);
_.includes([1, 2, 3], 1, 2);
// => false
-_.includes({ 'user': 'fred', 'age': 40 }, 'fred');
+_.includes({ 'a': 1, 'b': 2 }, 1);
// => true
-_.includes('pebbles', 'eb');
+_.includes('abcd', 'bc');
// => true
```
-* * *
+---
### `_.invokeMap(collection, path, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8760 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invokemap "See the npm package")
+[#](#_invokemapcollection-path-args) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8969 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.invokemap "See the npm package") [Ⓣ][1]
Invokes the method at `path` of each element in `collection`, returning
an array of the results of each invoked method. Any additional arguments
-are provided to each invoked method. If `methodName` is a function, it's
-invoked for and `this` bound to, each element in `collection`.
+are provided to each invoked method. If `path` is a function, it's invoked
+for, and `this` bound to, each element in `collection`.
#### Since
4.0.0
@@ -2863,14 +2882,14 @@ _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
_.invokeMap([123, 456], String.prototype.split, '');
// => [['1', '2', '3'], ['4', '5', '6']]
```
-* * *
+---
### `_.keyBy(collection, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8802 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keyby "See the npm package")
+[#](#_keybycollection-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9011 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.keyby "See the npm package") [Ⓣ][1]
Creates an object composed of keys generated from the results of running
each element of `collection` thru `iteratee`. The corresponding value of
@@ -2881,7 +2900,7 @@ iteratee is invoked with one argument: *(value)*.
4.0.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee to transform keys.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee to transform keys.
#### Returns
*(Object)*: Returns the composed aggregate object.
@@ -2901,14 +2920,14 @@ _.keyBy(array, function(o) {
_.keyBy(array, 'dir');
// => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
```
-* * *
+---
### `_.map(collection, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8849 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.map "See the npm package")
+[#](#_mapcollection-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9057 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.map "See the npm package") [Ⓣ][1]
Creates an array of values by running each element in `collection` thru
`iteratee`. The iteratee is invoked with three arguments:
@@ -2929,7 +2948,7 @@ The guarded methods are:
0.1.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new mapped array.
@@ -2955,14 +2974,14 @@ var users = [
_.map(users, 'user');
// => ['barney', 'fred']
```
-* * *
+---
### `_.orderBy(collection, [iteratees=[_.identity]], [orders])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8883 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.orderby "See the npm package")
+[#](#_orderbycollection-iteratees_identity-orders) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9091 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.orderby "See the npm package") [Ⓣ][1]
This method is like `_.sortBy` except that it allows specifying the sort
orders of the iteratees to sort by. If `orders` is unspecified, all values
@@ -2992,14 +3011,14 @@ var users = [
_.orderBy(users, ['user', 'age'], ['asc', 'desc']);
// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
```
-* * *
+---
### `_.partition(collection, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8934 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partition "See the npm package")
+[#](#_partitioncollection-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9141 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.partition "See the npm package") [Ⓣ][1]
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, the second of which
@@ -3010,7 +3029,7 @@ invoked with one argument: *(value)*.
3.0.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the array of grouped elements.
@@ -3038,14 +3057,14 @@ _.partition(users, ['active', false]);
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
```
-* * *
+---
### `_.reduce(collection, [iteratee=_.identity], [accumulator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8975 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduce "See the npm package")
+[#](#_reducecollection-iteratee_identity-accumulator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9182 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.reduce "See the npm package") [Ⓣ][1]
Reduces `collection` to a value which is the accumulated result of running
each element in `collection` thru `iteratee`, where each successive
@@ -3086,14 +3105,14 @@ _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
}, {});
// => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
```
-* * *
+---
### `_.reduceRight(collection, [iteratee=_.identity], [accumulator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9004 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduceright "See the npm package")
+[#](#_reducerightcollection-iteratee_identity-accumulator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9211 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.reduceright "See the npm package") [Ⓣ][1]
This method is like `_.reduce` except that it iterates over elements of
`collection` from right to left.
@@ -3117,14 +3136,14 @@ _.reduceRight(array, function(flattened, other) {
}, []);
// => [4, 5, 2, 3, 0, 1]
```
-* * *
+---
### `_.reject(collection, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9046 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reject "See the npm package")
+[#](#_rejectcollection-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9252 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.reject "See the npm package") [Ⓣ][1]
The opposite of `_.filter`; this method returns the elements of `collection`
that `predicate` does **not** return truthy for.
@@ -3133,7 +3152,7 @@ that `predicate` does **not** return truthy for.
0.1.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new filtered array.
@@ -3160,14 +3179,14 @@ _.reject(users, ['active', false]);
_.reject(users, 'active');
// => objects for ['barney']
```
-* * *
+---
### `_.sample(collection)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9068 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sample "See the npm package")
+[#](#_samplecollection) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9271 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sample "See the npm package") [Ⓣ][1]
Gets a random element from `collection`.
@@ -3184,14 +3203,14 @@ Gets a random element from `collection`.
_.sample([1, 2, 3, 4]);
// => 2
```
-* * *
+---
### `_.sampleSize(collection, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9095 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.samplesize "See the npm package")
+[#](#_samplesizecollection-n1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9298 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.samplesize "See the npm package") [Ⓣ][1]
Gets `n` random elements at unique keys from `collection` up to the
size of `collection`.
@@ -3213,14 +3232,14 @@ _.sampleSize([1, 2, 3], 2);
_.sampleSize([1, 2, 3], 4);
// => [2, 3, 1]
```
-* * *
+---
### `_.shuffle(collection)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9132 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.shuffle "See the npm package")
+[#](#_shufflecollection) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9335 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.shuffle "See the npm package") [Ⓣ][1]
Creates an array of shuffled values, using a version of the
[Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
@@ -3238,14 +3257,14 @@ Creates an array of shuffled values, using a version of the
_.shuffle([1, 2, 3, 4]);
// => [4, 1, 3, 2]
```
-* * *
+---
### `_.size(collection)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9157 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.size "See the npm package")
+[#](#_sizecollection) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9360 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.size "See the npm package") [Ⓣ][1]
Gets the size of `collection` by returning its length for array-like
values or the number of own enumerable string keyed properties for objects.
@@ -3269,14 +3288,14 @@ _.size({ 'a': 1, 'b': 2 });
_.size('pebbles');
// => 7
```
-* * *
+---
### `_.some(collection, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9211 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.some "See the npm package")
+[#](#_somecollection-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9413 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.some "See the npm package") [Ⓣ][1]
Checks if `predicate` returns truthy for **any** element of `collection`.
Iteration is stopped once `predicate` returns truthy. The predicate is
@@ -3286,7 +3305,7 @@ invoked with three arguments: *(value, index|key, collection)*.
0.1.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(boolean)*: Returns `true` if any element passes the predicate check, else `false`.
@@ -3313,14 +3332,14 @@ _.some(users, ['active', false]);
_.some(users, 'active');
// => true
```
-* * *
+---
### `_.sortBy(collection, [iteratees=[_.identity]])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9253 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortby "See the npm package")
+[#](#_sortbycollection-iteratees_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9455 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sortby "See the npm package") [Ⓣ][1]
Creates an array of elements, sorted in ascending order by the results of
running each element in a collection thru each iteratee. This method
@@ -3331,7 +3350,7 @@ equal elements. The iteratees are invoked with one argument: *(value)*.
0.1.0
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
-2. `[iteratees=[_.identity]]` *(...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[]))*: The iteratees to sort by.
+2. `[iteratees=[_.identity]]` *(...(Function|Function[]))*: The iteratees to sort by.
#### Returns
*(Array)*: Returns the new sorted array.
@@ -3356,7 +3375,7 @@ _.sortBy(users, 'user', function(o) {
});
// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
```
-* * *
+---
@@ -3369,7 +3388,7 @@ _.sortBy(users, 'user', function(o) {
### `_.now()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9288 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.now "See the npm package")
+[#](#_now) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9486 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.now "See the npm package") [Ⓣ][1]
Gets the timestamp of the number of milliseconds that have elapsed since
the Unix epoch *(1 January `1970 00`:00:00 UTC)*.
@@ -3386,7 +3405,7 @@ _.defer(function(stamp) {
}, _.now());
// => Logs the number of milliseconds it took for the deferred invocation.
```
-* * *
+---
@@ -3399,7 +3418,7 @@ _.defer(function(stamp) {
### `_.after(n, func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9318 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.after "See the npm package")
+[#](#_aftern-func) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9516 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.after "See the npm package") [Ⓣ][1]
The opposite of `_.before`; this method creates a function that invokes
`func` once it's called `n` or more times.
@@ -3426,14 +3445,14 @@ _.forEach(saves, function(type) {
});
// => Logs 'done saving!' after the two async saves have completed.
```
-* * *
+---
### `_.ary(func, [n=func.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9347 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ary "See the npm package")
+[#](#_aryfunc-nfunclength) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9545 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ary "See the npm package") [Ⓣ][1]
Creates a function that invokes `func`, with up to `n` arguments,
ignoring any additional arguments.
@@ -3452,14 +3471,14 @@ ignoring any additional arguments.
_.map(['6', '8', '10'], _.ary(parseInt, 1));
// => [6, 8, 10]
```
-* * *
+---
### `_.before(n, func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9370 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.before "See the npm package")
+[#](#_beforen-func) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9568 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.before "See the npm package") [Ⓣ][1]
Creates a function that invokes `func`, with the `this` binding and arguments
of the created function, while it's called less than `n` times. Subsequent
@@ -3477,16 +3496,16 @@ calls to the created function return the result of the last `func` invocation.
#### Example
```js
jQuery(element).on('click', _.before(5, addContactToList));
-// => allows adding up to 4 contacts to the list
+// => Allows adding up to 4 contacts to the list.
```
-* * *
+---
### `_.bind(func, thisArg, [partials])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9422 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bind "See the npm package")
+[#](#_bindfunc-thisarg-partials) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9620 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.bind "See the npm package") [Ⓣ][1]
Creates a function that invokes `func` with the `this` binding of `thisArg`
and `partials` prepended to the arguments it receives.
@@ -3511,9 +3530,9 @@ property of bound functions.
#### Example
```js
-var greet = function(greeting, punctuation) {
+function greet(greeting, punctuation) {
return greeting + ' ' + this.user + punctuation;
-};
+}
var object = { 'user': 'fred' };
@@ -3526,14 +3545,14 @@ var bound = _.bind(greet, object, _, '!');
bound('hi');
// => 'hi fred!'
```
-* * *
+---
### `_.bindKey(object, key, [partials])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9476 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindkey "See the npm package")
+[#](#_bindkeyobject-key-partials) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9674 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.bindkey "See the npm package") [Ⓣ][1]
Creates a function that invokes the method at `object[key]` with `partials`
prepended to the arguments it receives.
@@ -3583,14 +3602,14 @@ var bound = _.bindKey(object, 'greet', _, '!');
bound('hi');
// => 'hiya fred!'
```
-* * *
+---
### `_.curry(func, [arity=func.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9526 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curry "See the npm package")
+[#](#_curryfunc-arityfunclength) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9724 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.curry "See the npm package") [Ⓣ][1]
Creates a function that accepts arguments of `func` and either invokes
`func` returning its result, if at least `arity` number of arguments have
@@ -3635,14 +3654,14 @@ curried(1, 2, 3);
curried(1)(_, 3)(2);
// => [1, 2, 3]
```
-* * *
+---
### `_.curryRight(func, [arity=func.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9571 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curryright "See the npm package")
+[#](#_curryrightfunc-arityfunclength) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9769 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.curryright "See the npm package") [Ⓣ][1]
This method is like `_.curry` except that arguments are applied to `func`
in the manner of `_.partialRight` instead of `_.partial`.
@@ -3684,14 +3703,14 @@ curried(1, 2, 3);
curried(3)(1, _)(2);
// => [1, 2, 3]
```
-* * *
+---
### `_.debounce(func, [wait=0], [options={}], [options.leading=false], [options.maxWait], [options.trailing=true])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9628 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.debounce "See the npm package")
+[#](#_debouncefunc-wait0-options-optionsleadingfalse-optionsmaxwait-optionstrailingtrue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9826 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.debounce "See the npm package") [Ⓣ][1]
Creates a debounced function that delays invoking `func` until after `wait`
milliseconds have elapsed since the last time the debounced function was
@@ -3743,14 +3762,14 @@ jQuery(source).on('message', debounced);
// Cancel the trailing debounced invocation.
jQuery(window).on('popstate', debounced.cancel);
```
-* * *
+---
### `_.defer(func, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9765 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defer "See the npm package")
+[#](#_deferfunc-args) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9966 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.defer "See the npm package") [Ⓣ][1]
Defers invoking the `func` until the current call stack has cleared. Any
additional arguments are provided to `func` when it's invoked.
@@ -3771,14 +3790,14 @@ _.defer(function(text) {
}, 'deferred');
// => Logs 'deferred' after one or more milliseconds.
```
-* * *
+---
### `_.delay(func, wait, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9788 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.delay "See the npm package")
+[#](#_delayfunc-wait-args) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L9989 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.delay "See the npm package") [Ⓣ][1]
Invokes `func` after `wait` milliseconds. Any additional arguments are
provided to `func` when it's invoked.
@@ -3800,14 +3819,14 @@ _.delay(function(text) {
}, 1000, 'later');
// => Logs 'later' after one second.
```
-* * *
+---
### `_.flip(func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9810 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flip "See the npm package")
+[#](#_flipfunc) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10011 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flip "See the npm package") [Ⓣ][1]
Creates a function that invokes `func` with arguments reversed.
@@ -3828,14 +3847,14 @@ var flipped = _.flip(function() {
flipped('a', 'b', 'c', 'd');
// => ['d', 'c', 'b', 'a']
```
-* * *
+---
### `_.memoize(func, [resolver])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9858 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.memoize "See the npm package")
+[#](#_memoizefunc-resolver) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10059 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.memoize "See the npm package") [Ⓣ][1]
Creates a function that memoizes the result of `func`. If `resolver` is
provided, it determines the cache key for storing the result based on the
@@ -3883,14 +3902,14 @@ values(object);
// Replace `_.memoize.Cache`.
_.memoize.Cache = WeakMap;
```
-* * *
+---
### `_.negate(predicate)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9901 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.negate "See the npm package")
+[#](#_negatepredicate) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10102 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.negate "See the npm package") [Ⓣ][1]
Creates a function that negates the result of the predicate `func`. The
`func` predicate is invoked with the `this` binding and arguments of the
@@ -3913,14 +3932,14 @@ function isEven(n) {
_.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
// => [1, 3, 5]
```
-* * *
+---
### `_.once(func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9928 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.once "See the npm package")
+[#](#_oncefunc) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10136 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.once "See the npm package") [Ⓣ][1]
Creates a function that is restricted to invoking `func` once. Repeat calls
to the function return the value of the first invocation. The `func` is
@@ -3939,24 +3958,24 @@ invoked with the `this` binding and arguments of the created function.
var initialize = _.once(createApplication);
initialize();
initialize();
-// `initialize` invokes `createApplication` once
+// => `createApplication` is invoked once
```
-* * *
+---
-### `_.overArgs(func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L9964 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.overargs "See the npm package")
+### `_.overArgs(func, [transforms=[_.identity]])`
+[#](#_overargsfunc-transforms_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10171 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.overargs "See the npm package") [Ⓣ][1]
-Creates a function that invokes `func` with arguments transformed by
-corresponding `transforms`.
+Creates a function that invokes `func` with its arguments transformed.
#### Since
4.0.0
#### Arguments
1. `func` *(Function)*: The function to wrap.
+2. `[transforms=[_.identity]]` *(...(Function|Function[]))*: The argument transforms.
#### Returns
*(Function)*: Returns the new function.
@@ -3981,14 +4000,14 @@ func(9, 3);
func(10, 5);
// => [100, 10]
```
-* * *
+---
### `_.partial(func, [partials])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10014 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partial "See the npm package")
+[#](#_partialfunc-partials) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10221 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.partial "See the npm package") [Ⓣ][1]
Creates a function that invokes `func` with `partials` prepended to the
arguments it receives. This method is like `_.bind` except it does **not**
@@ -4013,9 +4032,9 @@ applied functions.
#### Example
```js
-var greet = function(greeting, name) {
+function greet(greeting, name) {
return greeting + ' ' + name;
-};
+}
var sayHelloTo = _.partial(greet, 'hello');
sayHelloTo('fred');
@@ -4026,14 +4045,14 @@ var greetFred = _.partial(greet, _, 'fred');
greetFred('hi');
// => 'hi fred'
```
-* * *
+---
### `_.partialRight(func, [partials])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10051 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partialright "See the npm package")
+[#](#_partialrightfunc-partials) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10258 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.partialright "See the npm package") [Ⓣ][1]
This method is like `_.partial` except that partially applied arguments
are appended to the arguments it receives.
@@ -4057,9 +4076,9 @@ applied functions.
#### Example
```js
-var greet = function(greeting, name) {
+function greet(greeting, name) {
return greeting + ' ' + name;
-};
+}
var greetFred = _.partialRight(greet, 'fred');
greetFred('hi');
@@ -4070,14 +4089,14 @@ var sayHelloTo = _.partialRight(greet, 'hello', _);
sayHelloTo('fred');
// => 'hello fred'
```
-* * *
+---
### `_.rearg(func, indexes)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10078 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rearg "See the npm package")
+[#](#_reargfunc-indexes) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10285 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.rearg "See the npm package") [Ⓣ][1]
Creates a function that invokes `func` with arguments arranged according
to the specified `indexes` where the argument value at the first index is
@@ -4102,14 +4121,14 @@ var rearged = _.rearg(function(a, b, c) {
rearged('b', 'c', 'a')
// => ['a', 'b', 'c']
```
-* * *
+---
### `_.rest(func, [start=func.length-1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10107 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rest "See the npm package")
+[#](#_restfunc-startfunclength-1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10314 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.rest "See the npm package") [Ⓣ][1]
Creates a function that invokes `func` with the `this` binding of the
created function and arguments from `start` and beyond provided as
@@ -4138,14 +4157,14 @@ var say = _.rest(function(what, names) {
say('hello', 'fred', 'barney', 'pebbles');
// => 'hello fred, barney, & pebbles'
```
-* * *
+---
### `_.spread(func, [start=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10170 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.spread "See the npm package")
+[#](#_spreadfunc-start0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10356 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.spread "See the npm package") [Ⓣ][1]
Creates a function that invokes `func` with the `this` binding of the
create function and an array of arguments much like
@@ -4183,14 +4202,14 @@ numbers.then(_.spread(function(x, y) {
}));
// => a Promise of 76
```
-* * *
+---
### `_.throttle(func, [wait=0], [options={}], [options.leading=true], [options.trailing=true])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10227 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.throttle "See the npm package")
+[#](#_throttlefunc-wait0-options-optionsleadingtrue-optionstrailingtrue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10413 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.throttle "See the npm package") [Ⓣ][1]
Creates a throttled function that only invokes `func` at most once per
every `wait` milliseconds. The throttled function comes with a `cancel`
@@ -4234,14 +4253,14 @@ jQuery(element).on('click', throttled);
// Cancel the trailing throttled invocation.
jQuery(window).on('popstate', throttled.cancel);
```
-* * *
+---
### `_.unary(func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10260 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unary "See the npm package")
+[#](#_unaryfunc) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10446 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unary "See the npm package") [Ⓣ][1]
Creates a function that accepts up to one argument, ignoring any
additional arguments.
@@ -4259,19 +4278,19 @@ additional arguments.
_.map(['6', '8', '10'], _.unary(parseInt));
// => [6, 8, 10]
```
-* * *
+---
### `_.wrap(value, [wrapper=identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10286 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.wrap "See the npm package")
+[#](#_wrapvalue-wrapperidentity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10472 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.wrap "See the npm package") [Ⓣ][1]
-Creates a function that provides `value` to the wrapper function as its
-first argument. Any additional arguments provided to the function are
-appended to those provided to the wrapper function. The wrapper is invoked
-with the `this` binding of the created function.
+Creates a function that provides `value` to `wrapper` as its first
+argument. Any additional arguments provided to the function are appended
+to those provided to the `wrapper`. The wrapper is invoked with the `this`
+binding of the created function.
#### Since
0.1.0
@@ -4291,7 +4310,7 @@ var p = _.wrap(_.escape, function(func, text) {
p('fred, barney, & pebbles');
// => '
fred, barney, & pebbles
'
```
-* * *
+---
@@ -4304,7 +4323,7 @@ p('fred, barney, & pebbles');
### `_.castArray(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10326 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.castarray "See the npm package")
+[#](#_castarrayvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10512 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.castarray "See the npm package") [Ⓣ][1]
Casts `value` as an array if it's not one.
@@ -4340,14 +4359,14 @@ var array = [1, 2, 3];
console.log(_.castArray(array) === array);
// => true
```
-* * *
+---
### `_.clone(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10360 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clone "See the npm package")
+[#](#_clonevalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10546 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.clone "See the npm package") [Ⓣ][1]
Creates a shallow clone of `value`.
@@ -4376,14 +4395,14 @@ var shallow = _.clone(objects);
console.log(shallow[0] === objects[0]);
// => true
```
-* * *
+---
### `_.cloneDeep(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10417 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeep "See the npm package")
+[#](#_clonedeepvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10603 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.clonedeep "See the npm package") [Ⓣ][1]
This method is like `_.clone` except that it recursively clones `value`.
@@ -4403,14 +4422,14 @@ var deep = _.cloneDeep(objects);
console.log(deep[0] === objects[0]);
// => false
```
-* * *
+---
### `_.cloneDeepWith(value, [customizer])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10449 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeepwith "See the npm package")
+[#](#_clonedeepwithvalue-customizer) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10635 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.clonedeepwith "See the npm package") [Ⓣ][1]
This method is like `_.cloneWith` except that it recursively clones `value`.
@@ -4440,14 +4459,14 @@ console.log(el.nodeName);
console.log(el.childNodes.length);
// => 20
```
-* * *
+---
### `_.cloneWith(value, [customizer])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10395 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonewith "See the npm package")
+[#](#_clonewithvalue-customizer) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10581 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.clonewith "See the npm package") [Ⓣ][1]
This method is like `_.clone` except that it accepts `customizer` which
is invoked to produce the cloned value. If `customizer` returns `undefined`,
@@ -4480,14 +4499,46 @@ console.log(el.nodeName);
console.log(el.childNodes.length);
// => 0
```
-* * *
+---
+
+
+
+
+
+### `_.conformsTo(object, source)`
+[#](#_conformstoobject-source) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10661 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.conformsto "See the npm package") [Ⓣ][1]
+
+Checks if `object` conforms to `source` by invoking the predicate properties
+of `source` with the corresponding property values of `object`. This method
+is equivalent to a `_.conforms` function when `source` is partially applied.
+
+#### Since
+4.14.0
+#### Arguments
+1. `object` *(Object)*: The object to inspect.
+2. `source` *(Object)*: The object of property predicates to conform to.
+
+#### Returns
+*(boolean)*: Returns `true` if `object` conforms, else `false`.
+
+#### Example
+```js
+var object = { 'a': 1, 'b': 2 };
+
+_.conformsTo(object, { 'b': function(n) { return n > 1; } });
+// => true
+
+_.conformsTo(object, { 'b': function(n) { return n > 2; } });
+// => false
+```
+---
### `_.eq(value, other)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10485 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.eq "See the npm package")
+[#](#_eqvalue-other) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10697 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.eq "See the npm package") [Ⓣ][1]
Performs a
[`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -4504,8 +4555,8 @@ comparison between two values to determine if they are equivalent.
#### Example
```js
-var object = { 'user': 'fred' };
-var other = { 'user': 'fred' };
+var object = { 'a': 1 };
+var other = { 'a': 1 };
_.eq(object, object);
// => true
@@ -4522,14 +4573,14 @@ _.eq('a', Object('a'));
_.eq(NaN, NaN);
// => true
```
-* * *
+---
### `_.gt(value, other)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10512 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.gt "See the npm package")
+[#](#_gtvalue-other) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10724 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.gt "See the npm package") [Ⓣ][1]
Checks if `value` is greater than `other`.
@@ -4553,14 +4604,14 @@ _.gt(3, 3);
_.gt(1, 3);
// => false
```
-* * *
+---
### `_.gte(value, other)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10537 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.gte "See the npm package")
+[#](#_gtevalue-other) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10749 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.gte "See the npm package") [Ⓣ][1]
Checks if `value` is greater than or equal to `other`.
@@ -4584,14 +4635,14 @@ _.gte(3, 3);
_.gte(1, 3);
// => false
```
-* * *
+---
### `_.isArguments(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10559 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarguments "See the npm package")
+[#](#_isargumentsvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10771 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isarguments "See the npm package") [Ⓣ][1]
Checks if `value` is likely an `arguments` object.
@@ -4601,7 +4652,7 @@ Checks if `value` is likely an `arguments` object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is an `arguments` object, else `false`.
#### Example
```js
@@ -4611,14 +4662,14 @@ _.isArguments(function() { return arguments; }());
_.isArguments([1, 2, 3]);
// => false
```
-* * *
+---
### `_.isArray(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10590 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarray "See the npm package")
+[#](#_isarrayvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10800 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isarray "See the npm package") [Ⓣ][1]
Checks if `value` is classified as an `Array` object.
@@ -4628,7 +4679,7 @@ Checks if `value` is classified as an `Array` object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is an array, else `false`.
#### Example
```js
@@ -4644,14 +4695,14 @@ _.isArray('abc');
_.isArray(_.noop);
// => false
```
-* * *
+---
### `_.isArrayBuffer(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10610 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraybuffer "See the npm package")
+[#](#_isarraybuffervalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10819 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isarraybuffer "See the npm package") [Ⓣ][1]
Checks if `value` is classified as an `ArrayBuffer` object.
@@ -4661,7 +4712,7 @@ Checks if `value` is classified as an `ArrayBuffer` object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is an array buffer, else `false`.
#### Example
```js
@@ -4671,14 +4722,14 @@ _.isArrayBuffer(new ArrayBuffer(2));
_.isArrayBuffer(new Array(2));
// => false
```
-* * *
+---
### `_.isArrayLike(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10639 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraylike "See the npm package")
+[#](#_isarraylikevalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10846 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isarraylike "See the npm package") [Ⓣ][1]
Checks if `value` is array-like. A value is considered array-like if it's
not a function and has a `value.length` that's an integer greater than or
@@ -4706,14 +4757,14 @@ _.isArrayLike('abc');
_.isArrayLike(_.noop);
// => false
```
-* * *
+---
### `_.isArrayLikeObject(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10668 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraylikeobject "See the npm package")
+[#](#_isarraylikeobjectvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10875 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isarraylikeobject "See the npm package") [Ⓣ][1]
This method is like `_.isArrayLike` except that it also checks if `value`
is an object.
@@ -4740,14 +4791,14 @@ _.isArrayLikeObject('abc');
_.isArrayLikeObject(_.noop);
// => false
```
-* * *
+---
### `_.isBoolean(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10690 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isboolean "See the npm package")
+[#](#_isbooleanvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10896 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isboolean "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a boolean primitive or object.
@@ -4757,7 +4808,7 @@ Checks if `value` is classified as a boolean primitive or object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a boolean, else `false`.
#### Example
```js
@@ -4767,14 +4818,14 @@ _.isBoolean(false);
_.isBoolean(null);
// => false
```
-* * *
+---
### `_.isBuffer(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10712 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isbuffer "See the npm package")
+[#](#_isbuffervalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10918 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isbuffer "See the npm package") [Ⓣ][1]
Checks if `value` is a buffer.
@@ -4794,14 +4845,14 @@ _.isBuffer(new Buffer(2));
_.isBuffer(new Uint8Array(2));
// => false
```
-* * *
+---
### `_.isDate(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10734 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isdate "See the npm package")
+[#](#_isdatevalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10937 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isdate "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a `Date` object.
@@ -4811,7 +4862,7 @@ Checks if `value` is classified as a `Date` object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a date object, else `false`.
#### Example
```js
@@ -4821,14 +4872,14 @@ _.isDate(new Date);
_.isDate('Mon April 23 2012');
// => false
```
-* * *
+---
### `_.isElement(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10756 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iselement "See the npm package")
+[#](#_iselementvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10957 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.iselement "See the npm package") [Ⓣ][1]
Checks if `value` is likely a DOM element.
@@ -4848,14 +4899,14 @@ _.isElement(document.body);
_.isElement('');
// => false
```
-* * *
+---
### `_.isEmpty(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10793 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isempty "See the npm package")
+[#](#_isemptyvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L10994 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isempty "See the npm package") [Ⓣ][1]
Checks if `value` is an empty object, collection, map, or set.
@@ -4893,14 +4944,14 @@ _.isEmpty([1, 2, 3]);
_.isEmpty({ 'a': 1 });
// => false
```
-* * *
+---
### `_.isEqual(value, other)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10842 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequal "See the npm package")
+[#](#_isequalvalue-other) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11043 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isequal "See the npm package") [Ⓣ][1]
Performs a deep comparison between two values to determine if they are
equivalent.
@@ -4923,8 +4974,8 @@ nodes are **not** supported.
#### Example
```js
-var object = { 'user': 'fred' };
-var other = { 'user': 'fred' };
+var object = { 'a': 1 };
+var other = { 'a': 1 };
_.isEqual(object, other);
// => true
@@ -4932,14 +4983,14 @@ _.isEqual(object, other);
object === other;
// => false
```
-* * *
+---
### `_.isEqualWith(value, other, [customizer])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10879 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequalwith "See the npm package")
+[#](#_isequalwithvalue-other-customizer) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11080 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isequalwith "See the npm package") [Ⓣ][1]
This method is like `_.isEqual` except that it accepts `customizer` which
is invoked to compare values. If `customizer` returns `undefined`, comparisons
@@ -4974,14 +5025,14 @@ var other = ['hi', 'goodbye'];
_.isEqualWith(array, other, customizer);
// => true
```
-* * *
+---
### `_.isError(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10904 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iserror "See the npm package")
+[#](#_iserrorvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11105 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.iserror "See the npm package") [Ⓣ][1]
Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
`SyntaxError`, `TypeError`, or `URIError` object.
@@ -5002,14 +5053,14 @@ _.isError(new Error);
_.isError(Error);
// => false
```
-* * *
+---
### `_.isFinite(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10939 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfinite "See the npm package")
+[#](#_isfinitevalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11140 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isfinite "See the npm package") [Ⓣ][1]
Checks if `value` is a finite primitive number.
@@ -5039,14 +5090,14 @@ _.isFinite(Infinity);
_.isFinite('3');
// => false
```
-* * *
+---
### `_.isFunction(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10961 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfunction "See the npm package")
+[#](#_isfunctionvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11161 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isfunction "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a `Function` object.
@@ -5056,7 +5107,7 @@ Checks if `value` is classified as a `Function` object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a function, else `false`.
#### Example
```js
@@ -5066,14 +5117,14 @@ _.isFunction(_);
_.isFunction(/abc/);
// => false
```
-* * *
+---
### `_.isInteger(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L10995 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isinteger "See the npm package")
+[#](#_isintegervalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11195 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isinteger "See the npm package") [Ⓣ][1]
Checks if `value` is an integer.
@@ -5103,14 +5154,14 @@ _.isInteger(Infinity);
_.isInteger('3');
// => false
```
-* * *
+---
### `_.isLength(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11026 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.islength "See the npm package")
+[#](#_islengthvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11226 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.islength "See the npm package") [Ⓣ][1]
Checks if `value` is a valid array-like length.
@@ -5140,14 +5191,14 @@ _.isLength(Infinity);
_.isLength('3');
// => false
```
-* * *
+---
### `_.isMap(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11107 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismap "See the npm package")
+[#](#_ismapvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11306 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ismap "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a `Map` object.
@@ -5157,7 +5208,7 @@ Checks if `value` is classified as a `Map` object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a map, else `false`.
#### Example
```js
@@ -5167,14 +5218,14 @@ _.isMap(new Map);
_.isMap(new WeakMap);
// => false
```
-* * *
+---
### `_.isMatch(object, source)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11135 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatch "See the npm package")
+[#](#_ismatchobject-source) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11332 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ismatch "See the npm package") [Ⓣ][1]
Performs a partial deep comparison between `object` and `source` to
determine if `object` contains equivalent property values. This method is
@@ -5194,22 +5245,22 @@ equivalent to a `_.matches` function when `source` is partially applied.
#### Example
```js
-var object = { 'user': 'fred', 'age': 40 };
+var object = { 'a': 1, 'b': 2 };
-_.isMatch(object, { 'age': 40 });
+_.isMatch(object, { 'b': 2 });
// => true
-_.isMatch(object, { 'age': 36 });
+_.isMatch(object, { 'b': 1 });
// => false
```
-* * *
+---
### `_.isMatchWith(object, source, [customizer])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11171 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatchwith "See the npm package")
+[#](#_ismatchwithobject-source-customizer) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11368 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ismatchwith "See the npm package") [Ⓣ][1]
This method is like `_.isMatch` except that it accepts `customizer` which
is invoked to compare values. If `customizer` returns `undefined`, comparisons
@@ -5244,14 +5295,14 @@ var source = { 'greeting': 'hi' };
_.isMatchWith(object, source, customizer);
// => true
```
-* * *
+---
### `_.isNaN(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11204 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnan "See the npm package")
+[#](#_isnanvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11401 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isnan "See the npm package") [Ⓣ][1]
Checks if `value` is `NaN`.
@@ -5283,25 +5334,25 @@ isNaN(undefined);
_.isNaN(undefined);
// => false
```
-* * *
+---
### `_.isNative(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11237 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnative "See the npm package")
+[#](#_isnativevalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11434 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isnative "See the npm package") [Ⓣ][1]
Checks if `value` is a pristine native function.
-**Note:** This method can't reliably detect native functions in the
-presence of the `core-js` package because `core-js` circumvents this kind
-of detection. Despite multiple requests, the `core-js` maintainer has made
-it clear: any attempt to fix the detection will be obstructed. As a result,
-we're left with little choice but to throw an error. Unfortunately, this
-also affects packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
-which rely on `core-js`.
+**Note:** This method can't reliably detect native functions in the presence
+of the core-js package because core-js circumvents this kind of detection.
+Despite multiple requests, the core-js maintainer has made it clear: any
+attempt to fix the detection will be obstructed. As a result, we're left
+with little choice but to throw an error. Unfortunately, this also affects
+packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
+which rely on core-js.
#### Since
3.0.0
@@ -5319,14 +5370,14 @@ _.isNative(Array.prototype.push);
_.isNative(_);
// => false
```
-* * *
+---
### `_.isNil(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11285 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnil "See the npm package")
+[#](#_isnilvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11482 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isnil "See the npm package") [Ⓣ][1]
Checks if `value` is `null` or `undefined`.
@@ -5349,14 +5400,14 @@ _.isNil(void 0);
_.isNil(NaN);
// => false
```
-* * *
+---
### `_.isNull(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11261 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnull "See the npm package")
+[#](#_isnullvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11458 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isnull "See the npm package") [Ⓣ][1]
Checks if `value` is `null`.
@@ -5376,14 +5427,14 @@ _.isNull(null);
_.isNull(void 0);
// => false
```
-* * *
+---
### `_.isNumber(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11316 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnumber "See the npm package")
+[#](#_isnumbervalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11512 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isnumber "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a `Number` primitive or object.
@@ -5397,7 +5448,7 @@ classified as numbers, use the `_.isFinite` method.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a number, else `false`.
#### Example
```js
@@ -5413,14 +5464,14 @@ _.isNumber(Infinity);
_.isNumber('3');
// => false
```
-* * *
+---
### `_.isObject(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11056 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobject "See the npm package")
+[#](#_isobjectvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11256 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isobject "See the npm package") [Ⓣ][1]
Checks if `value` is the
[language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)
@@ -5448,14 +5499,14 @@ _.isObject(_.noop);
_.isObject(null);
// => false
```
-* * *
+---
### `_.isObjectLike(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11085 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobjectlike "See the npm package")
+[#](#_isobjectlikevalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11285 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isobjectlike "See the npm package") [Ⓣ][1]
Checks if `value` is object-like. A value is object-like if it's not `null`
and has a `typeof` result of "object".
@@ -5482,14 +5533,14 @@ _.isObjectLike(_.noop);
_.isObjectLike(null);
// => false
```
-* * *
+---
### `_.isPlainObject(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11350 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isplainobject "See the npm package")
+[#](#_isplainobjectvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11546 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isplainobject "See the npm package") [Ⓣ][1]
Checks if `value` is a plain object, that is, an object created by the
`Object` constructor or one with a `[[Prototype]]` of `null`.
@@ -5520,14 +5571,14 @@ _.isPlainObject({ 'x': 0, 'y': 0 });
_.isPlainObject(Object.create(null));
// => true
```
-* * *
+---
### `_.isRegExp(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11382 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isregexp "See the npm package")
+[#](#_isregexpvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11577 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isregexp "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a `RegExp` object.
@@ -5537,7 +5588,7 @@ Checks if `value` is classified as a `RegExp` object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a regexp, else `false`.
#### Example
```js
@@ -5547,14 +5598,14 @@ _.isRegExp(/abc/);
_.isRegExp('/abc/');
// => false
```
-* * *
+---
### `_.isSafeInteger(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11414 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.issafeinteger "See the npm package")
+[#](#_issafeintegervalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11607 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.issafeinteger "See the npm package") [Ⓣ][1]
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.
@@ -5585,14 +5636,14 @@ _.isSafeInteger(Infinity);
_.isSafeInteger('3');
// => false
```
-* * *
+---
### `_.isSet(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11436 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isset "See the npm package")
+[#](#_issetvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11628 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isset "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a `Set` object.
@@ -5602,7 +5653,7 @@ Checks if `value` is classified as a `Set` object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a set, else `false`.
#### Example
```js
@@ -5612,14 +5663,14 @@ _.isSet(new Set);
_.isSet(new WeakSet);
// => false
```
-* * *
+---
### `_.isString(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11458 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isstring "See the npm package")
+[#](#_isstringvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11647 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isstring "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a `String` primitive or object.
@@ -5629,7 +5680,7 @@ Checks if `value` is classified as a `String` primitive or object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a string, else `false`.
#### Example
```js
@@ -5639,14 +5690,14 @@ _.isString('abc');
_.isString(1);
// => false
```
-* * *
+---
### `_.isSymbol(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11481 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.issymbol "See the npm package")
+[#](#_issymbolvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11669 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.issymbol "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a `Symbol` primitive or object.
@@ -5656,7 +5707,7 @@ Checks if `value` is classified as a `Symbol` primitive or object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a symbol, else `false`.
#### Example
```js
@@ -5666,14 +5717,14 @@ _.isSymbol(Symbol.iterator);
_.isSymbol('abc');
// => false
```
-* * *
+---
### `_.isTypedArray(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11504 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.istypedarray "See the npm package")
+[#](#_istypedarrayvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11691 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.istypedarray "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a typed array.
@@ -5683,7 +5734,7 @@ Checks if `value` is classified as a typed array.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a typed array, else `false`.
#### Example
```js
@@ -5693,14 +5744,14 @@ _.isTypedArray(new Uint8Array);
_.isTypedArray([]);
// => false
```
-* * *
+---
### `_.isUndefined(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11526 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isundefined "See the npm package")
+[#](#_isundefinedvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11710 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isundefined "See the npm package") [Ⓣ][1]
Checks if `value` is `undefined`.
@@ -5720,14 +5771,14 @@ _.isUndefined(void 0);
_.isUndefined(null);
// => false
```
-* * *
+---
### `_.isWeakMap(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11548 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isweakmap "See the npm package")
+[#](#_isweakmapvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11731 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isweakmap "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a `WeakMap` object.
@@ -5737,7 +5788,7 @@ Checks if `value` is classified as a `WeakMap` object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a weak map, else `false`.
#### Example
```js
@@ -5747,14 +5798,14 @@ _.isWeakMap(new WeakMap);
_.isWeakMap(new Map);
// => false
```
-* * *
+---
### `_.isWeakSet(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11570 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isweakset "See the npm package")
+[#](#_isweaksetvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11752 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.isweakset "See the npm package") [Ⓣ][1]
Checks if `value` is classified as a `WeakSet` object.
@@ -5764,7 +5815,7 @@ Checks if `value` is classified as a `WeakSet` object.
1. `value` *(*)*: The value to check.
#### Returns
-*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+*(boolean)*: Returns `true` if `value` is a weak set, else `false`.
#### Example
```js
@@ -5774,14 +5825,14 @@ _.isWeakSet(new WeakSet);
_.isWeakSet(new Set);
// => false
```
-* * *
+---
### `_.lt(value, other)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11597 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lt "See the npm package")
+[#](#_ltvalue-other) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11779 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.lt "See the npm package") [Ⓣ][1]
Checks if `value` is less than `other`.
@@ -5805,14 +5856,14 @@ _.lt(3, 3);
_.lt(3, 1);
// => false
```
-* * *
+---
### `_.lte(value, other)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11622 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lte "See the npm package")
+[#](#_ltevalue-other) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11804 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.lte "See the npm package") [Ⓣ][1]
Checks if `value` is less than or equal to `other`.
@@ -5836,14 +5887,14 @@ _.lte(3, 3);
_.lte(3, 1);
// => false
```
-* * *
+---
### `_.toArray(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11649 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toarray "See the npm package")
+[#](#_toarrayvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11831 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.toarray "See the npm package") [Ⓣ][1]
Converts `value` to an array.
@@ -5869,14 +5920,14 @@ _.toArray(1);
_.toArray(null);
// => []
```
-* * *
+---
### `_.toFinite(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11688 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tofinite "See the npm package")
+[#](#_tofinitevalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11870 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tofinite "See the npm package") [Ⓣ][1]
Converts `value` to a finite number.
@@ -5902,14 +5953,14 @@ _.toFinite(Infinity);
_.toFinite('3.2');
// => 3.2
```
-* * *
+---
### `_.toInteger(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11726 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tointeger "See the npm package")
+[#](#_tointegervalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11908 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tointeger "See the npm package") [Ⓣ][1]
Converts `value` to an integer.
@@ -5939,14 +5990,14 @@ _.toInteger(Infinity);
_.toInteger('3.2');
// => 3
```
-* * *
+---
### `_.toLength(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11760 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tolength "See the npm package")
+[#](#_tolengthvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11942 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tolength "See the npm package") [Ⓣ][1]
Converts `value` to an integer suitable for use as the length of an
array-like object.
@@ -5977,14 +6028,14 @@ _.toLength(Infinity);
_.toLength('3.2');
// => 3
```
-* * *
+---
### `_.toNumber(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11787 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tonumber "See the npm package")
+[#](#_tonumbervalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L11969 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tonumber "See the npm package") [Ⓣ][1]
Converts `value` to a number.
@@ -6010,14 +6061,14 @@ _.toNumber(Infinity);
_.toNumber('3.2');
// => 3.2
```
-* * *
+---
### `_.toPlainObject(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11832 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toplainobject "See the npm package")
+[#](#_toplainobjectvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12014 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.toplainobject "See the npm package") [Ⓣ][1]
Converts `value` to a plain object flattening inherited enumerable string
keyed properties of `value` to own properties of the plain object.
@@ -6044,14 +6095,14 @@ _.assign({ 'a': 1 }, new Foo);
_.assign({ 'a': 1 }, _.toPlainObject(new Foo));
// => { 'a': 1, 'b': 2, 'c': 3 }
```
-* * *
+---
### `_.toSafeInteger(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11860 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tosafeinteger "See the npm package")
+[#](#_tosafeintegervalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12042 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tosafeinteger "See the npm package") [Ⓣ][1]
Converts `value` to a safe integer. A safe integer can be compared and
represented correctly.
@@ -6078,14 +6129,14 @@ _.toSafeInteger(Infinity);
_.toSafeInteger('3.2');
// => 3
```
-* * *
+---
### `_.toString(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11885 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tostring "See the npm package")
+[#](#_tostringvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12067 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tostring "See the npm package") [Ⓣ][1]
Converts `value` to a string. An empty string is returned for `null`
and `undefined` values. The sign of `-0` is preserved.
@@ -6109,7 +6160,7 @@ _.toString(-0);
_.toString([1, 2, 3]);
// => '1,2,3'
```
-* * *
+---
@@ -6122,7 +6173,7 @@ _.toString([1, 2, 3]);
### `_.add(augend, addend)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15481 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.add "See the npm package")
+[#](#_addaugend-addend) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15671 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.add "See the npm package") [Ⓣ][1]
Adds two numbers.
@@ -6140,14 +6191,14 @@ Adds two numbers.
_.add(6, 4);
// => 10
```
-* * *
+---
### `_.ceil(number, [precision=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15506 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ceil "See the npm package")
+[#](#_ceilnumber-precision0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15696 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ceil "See the npm package") [Ⓣ][1]
Computes `number` rounded up to `precision`.
@@ -6171,14 +6222,14 @@ _.ceil(6.004, 2);
_.ceil(6040, -2);
// => 6100
```
-* * *
+---
### `_.divide(dividend, divisor)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15523 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.divide "See the npm package")
+[#](#_dividedividend-divisor) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15713 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.divide "See the npm package") [Ⓣ][1]
Divide two numbers.
@@ -6196,14 +6247,14 @@ Divide two numbers.
_.divide(6, 4);
// => 1.5
```
-* * *
+---
### `_.floor(number, [precision=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15548 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.floor "See the npm package")
+[#](#_floornumber-precision0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15738 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.floor "See the npm package") [Ⓣ][1]
Computes `number` rounded down to `precision`.
@@ -6227,14 +6278,14 @@ _.floor(0.046, 2);
_.floor(4060, -2);
// => 4000
```
-* * *
+---
### `_.max(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15568 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.max "See the npm package")
+[#](#_maxarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15758 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.max "See the npm package") [Ⓣ][1]
Computes the maximum value of `array`. If `array` is empty or falsey,
`undefined` is returned.
@@ -6255,14 +6306,14 @@ _.max([4, 2, 8, 6]);
_.max([]);
// => undefined
```
-* * *
+---
### `_.maxBy(array, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15598 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.maxby "See the npm package")
+[#](#_maxbyarray-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15787 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.maxby "See the npm package") [Ⓣ][1]
This method is like `_.max` except that it accepts `iteratee` which is
invoked for each element in `array` to generate the criterion by which
@@ -6272,7 +6323,7 @@ the value is ranked. The iteratee is invoked with one argument: *(value)*.
4.0.0
#### Arguments
1. `array` *(Array)*: The array to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(*)*: Returns the maximum value.
@@ -6288,14 +6339,14 @@ _.maxBy(objects, function(o) { return o.n; });
_.maxBy(objects, 'n');
// => { 'n': 2 }
```
-* * *
+---
### `_.mean(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15618 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mean "See the npm package")
+[#](#_meanarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15807 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.mean "See the npm package") [Ⓣ][1]
Computes the mean of the values in `array`.
@@ -6312,14 +6363,14 @@ Computes the mean of the values in `array`.
_.mean([4, 2, 8, 6]);
// => 5
```
-* * *
+---
### `_.meanBy(array, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15646 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.meanby "See the npm package")
+[#](#_meanbyarray-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15834 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.meanby "See the npm package") [Ⓣ][1]
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.
@@ -6329,7 +6380,7 @@ The iteratee is invoked with one argument: *(value)*.
4.7.0
#### Arguments
1. `array` *(Array)*: The array to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(number)*: Returns the mean.
@@ -6345,14 +6396,14 @@ _.meanBy(objects, function(o) { return o.n; });
_.meanBy(objects, 'n');
// => 5
```
-* * *
+---
### `_.min(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15668 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.min "See the npm package")
+[#](#_minarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15856 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.min "See the npm package") [Ⓣ][1]
Computes the minimum value of `array`. If `array` is empty or falsey,
`undefined` is returned.
@@ -6373,14 +6424,14 @@ _.min([4, 2, 8, 6]);
_.min([]);
// => undefined
```
-* * *
+---
### `_.minBy(array, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15698 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.minby "See the npm package")
+[#](#_minbyarray-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15885 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.minby "See the npm package") [Ⓣ][1]
This method is like `_.min` except that it accepts `iteratee` which is
invoked for each element in `array` to generate the criterion by which
@@ -6390,7 +6441,7 @@ the value is ranked. The iteratee is invoked with one argument: *(value)*.
4.0.0
#### Arguments
1. `array` *(Array)*: The array to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(*)*: Returns the minimum value.
@@ -6406,14 +6457,14 @@ _.minBy(objects, function(o) { return o.n; });
_.minBy(objects, 'n');
// => { 'n': 1 }
```
-* * *
+---
### `_.multiply(multiplier, multiplicand)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15719 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.multiply "See the npm package")
+[#](#_multiplymultiplier-multiplicand) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15906 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.multiply "See the npm package") [Ⓣ][1]
Multiply two numbers.
@@ -6431,14 +6482,14 @@ Multiply two numbers.
_.multiply(6, 4);
// => 24
```
-* * *
+---
### `_.round(number, [precision=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15744 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.round "See the npm package")
+[#](#_roundnumber-precision0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15931 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.round "See the npm package") [Ⓣ][1]
Computes `number` rounded to `precision`.
@@ -6462,14 +6513,14 @@ _.round(4.006, 2);
_.round(4060, -2);
// => 4100
```
-* * *
+---
### `_.subtract(minuend, subtrahend)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15761 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.subtract "See the npm package")
+[#](#_subtractminuend-subtrahend) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15948 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.subtract "See the npm package") [Ⓣ][1]
Subtract two numbers.
@@ -6487,14 +6538,14 @@ Subtract two numbers.
_.subtract(6, 4);
// => 2
```
-* * *
+---
### `_.sum(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15779 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sum "See the npm package")
+[#](#_sumarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15966 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sum "See the npm package") [Ⓣ][1]
Computes the sum of the values in `array`.
@@ -6511,14 +6562,14 @@ Computes the sum of the values in `array`.
_.sum([4, 2, 8, 6]);
// => 20
```
-* * *
+---
### `_.sumBy(array, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15809 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sumby "See the npm package")
+[#](#_sumbyarray-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15995 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.sumby "See the npm package") [Ⓣ][1]
This method is like `_.sum` except that it accepts `iteratee` which is
invoked for each element in `array` to generate the value to be summed.
@@ -6528,7 +6579,7 @@ The iteratee is invoked with one argument: *(value)*.
4.0.0
#### Arguments
1. `array` *(Array)*: The array to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(number)*: Returns the sum.
@@ -6544,7 +6595,7 @@ _.sumBy(objects, function(o) { return o.n; });
_.sumBy(objects, 'n');
// => 20
```
-* * *
+---
@@ -6557,7 +6608,7 @@ _.sumBy(objects, 'n');
### `_.clamp(number, [lower], upper)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13306 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clamp "See the npm package")
+[#](#_clampnumber-lower-upper) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13470 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.clamp "See the npm package") [Ⓣ][1]
Clamps `number` within the inclusive `lower` and `upper` bounds.
@@ -6579,14 +6630,14 @@ _.clamp(-10, -5, 5);
_.clamp(10, -5, 5);
// => 5
```
-* * *
+---
### `_.inRange(number, [start=0], end)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13360 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.inrange "See the npm package")
+[#](#_inrangenumber-start0-end) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13524 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.inrange "See the npm package") [Ⓣ][1]
Checks if `n` is between `start` and up to, but not including, `end`. If
`end` is not specified, it's set to `start` with `start` then set to `0`.
@@ -6626,14 +6677,14 @@ _.inRange(5.2, 4);
_.inRange(-3, -2, -6);
// => true
```
-* * *
+---
### `_.random([lower=0], [upper=1], [floating])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13403 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.random "See the npm package")
+[#](#_randomlower0-upper1-floating) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13567 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.random "See the npm package") [Ⓣ][1]
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
@@ -6668,7 +6719,7 @@ _.random(5, true);
_.random(1.2, 5.2);
// => a floating-point number between 1.2 and 5.2
```
-* * *
+---
@@ -6681,7 +6732,7 @@ _.random(1.2, 5.2);
### `_.assign(object, [sources])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11923 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assign "See the npm package")
+[#](#_assignobject-sources) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12105 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.assign "See the npm package") [Ⓣ][1]
Assigns own enumerable string keyed properties of source objects to the
destination object. Source objects are applied from left to right.
@@ -6703,27 +6754,27 @@ Subsequent sources overwrite property assignments of previous sources.
#### Example
```js
function Foo() {
- this.c = 3;
+ this.a = 1;
}
function Bar() {
- this.e = 5;
+ this.c = 3;
}
-Foo.prototype.d = 4;
-Bar.prototype.f = 6;
+Foo.prototype.b = 2;
+Bar.prototype.d = 4;
-_.assign({ 'a': 1 }, new Foo, new Bar);
-// => { 'a': 1, 'c': 3, 'e': 5 }
+_.assign({ 'a': 0 }, new Foo, new Bar);
+// => { 'a': 1, 'c': 3 }
```
-* * *
+---
### `_.assignIn(object, [sources])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L11966 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assignin "See the npm package")
+[#](#_assigninobject-sources) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12148 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.assignin "See the npm package") [Ⓣ][1]
This method is like `_.assign` except that it iterates over own and
inherited source properties.
@@ -6746,27 +6797,27 @@ inherited source properties.
#### Example
```js
function Foo() {
- this.b = 2;
+ this.a = 1;
}
function Bar() {
- this.d = 4;
+ this.c = 3;
}
-Foo.prototype.c = 3;
-Bar.prototype.e = 5;
+Foo.prototype.b = 2;
+Bar.prototype.d = 4;
-_.assignIn({ 'a': 1 }, new Foo, new Bar);
-// => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }
+_.assignIn({ 'a': 0 }, new Foo, new Bar);
+// => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
```
-* * *
+---
### `_.assignInWith(object, sources, [customizer])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12005 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assigninwith "See the npm package")
+[#](#_assigninwithobject-sources-customizer) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12187 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.assigninwith "See the npm package") [Ⓣ][1]
This method is like `_.assignIn` except that it accepts `customizer`
which is invoked to produce the assigned values. If `customizer` returns
@@ -6800,14 +6851,14 @@ var defaults = _.partialRight(_.assignInWith, customizer);
defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
// => { 'a': 1, 'b': 2 }
```
-* * *
+---
### `_.assignWith(object, sources, [customizer])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12037 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assignwith "See the npm package")
+[#](#_assignwithobject-sources-customizer) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12219 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.assignwith "See the npm package") [Ⓣ][1]
This method is like `_.assign` except that it accepts `customizer`
which is invoked to produce the assigned values. If `customizer` returns
@@ -6838,14 +6889,14 @@ var defaults = _.partialRight(_.assignWith, customizer);
defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
// => { 'a': 1, 'b': 2 }
```
-* * *
+---
### `_.at(object, [paths])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12058 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.at "See the npm package")
+[#](#_atobject-paths) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12240 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.at "See the npm package") [Ⓣ][1]
Creates an array of values corresponding to `paths` of `object`.
@@ -6865,14 +6916,14 @@ var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
_.at(object, ['a[0].b.c', 'a[1]']);
// => [3, 4]
```
-* * *
+---
### `_.create(prototype, [properties])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12096 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.create "See the npm package")
+[#](#_createprototype-properties) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12278 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.create "See the npm package") [Ⓣ][1]
Creates an object that inherits from the `prototype` object. If a
`properties` object is given, its own enumerable string keyed properties
@@ -6909,14 +6960,14 @@ circle instanceof Circle;
circle instanceof Shape;
// => true
```
-* * *
+---
### `_.defaults(object, [sources])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12122 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaults "See the npm package")
+[#](#_defaultsobject-sources) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12304 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.defaults "See the npm package") [Ⓣ][1]
Assigns own and inherited enumerable string keyed properties of source
objects to the destination object for all destination properties that
@@ -6937,17 +6988,17 @@ Once a property is set, additional values of the same property are ignored.
#### Example
```js
-_.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
-// => { 'user': 'barney', 'age': 36 }
+_.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+// => { 'a': 1, 'b': 2 }
```
-* * *
+---
### `_.defaultsDeep(object, [sources])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12147 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaultsdeep "See the npm package")
+[#](#_defaultsdeepobject-sources) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12328 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.defaultsdeep "See the npm package") [Ⓣ][1]
This method is like `_.defaults` except that it recursively assigns
default properties.
@@ -6966,17 +7017,17 @@ default properties.
#### Example
```js
-_.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
-// => { 'user': { 'name': 'barney', 'age': 36 } }
+_.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
+// => { 'a': { 'b': 2, 'c': 3 } }
```
-* * *
+---
### `_.findKey(object, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12188 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findkey "See the npm package")
+[#](#_findkeyobject-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12368 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.findkey "See the npm package") [Ⓣ][1]
This method is like `_.find` except that it returns the key of the first
element `predicate` returns truthy for instead of the element itself.
@@ -6985,7 +7036,7 @@ element `predicate` returns truthy for instead of the element itself.
1.1.0
#### Arguments
1. `object` *(Object)*: The object to search.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(*)*: Returns the key of the matched element, else `undefined`.
@@ -7013,14 +7064,14 @@ _.findKey(users, ['active', false]);
_.findKey(users, 'active');
// => 'barney'
```
-* * *
+---
### `_.findLastKey(object, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12228 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastkey "See the npm package")
+[#](#_findlastkeyobject-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12407 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.findlastkey "See the npm package") [Ⓣ][1]
This method is like `_.findKey` except that it iterates over elements of
a collection in the opposite order.
@@ -7029,7 +7080,7 @@ a collection in the opposite order.
2.0.0
#### Arguments
1. `object` *(Object)*: The object to search.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(*)*: Returns the key of the matched element, else `undefined`.
@@ -7057,14 +7108,14 @@ _.findLastKey(users, ['active', false]);
_.findLastKey(users, 'active');
// => 'pebbles'
```
-* * *
+---
### `_.forIn(object, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12260 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forin "See the npm package")
+[#](#_forinobject-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12439 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.forin "See the npm package") [Ⓣ][1]
Iterates over own and inherited enumerable string keyed properties of an
object and invokes `iteratee` for each property. The iteratee is invoked
@@ -7094,14 +7145,14 @@ _.forIn(new Foo, function(value, key) {
});
// => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
```
-* * *
+---
### `_.forInRight(object, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12292 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forinright "See the npm package")
+[#](#_forinrightobject-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12471 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.forinright "See the npm package") [Ⓣ][1]
This method is like `_.forIn` except that it iterates over properties of
`object` in the opposite order.
@@ -7129,14 +7180,14 @@ _.forInRight(new Foo, function(value, key) {
});
// => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
```
-* * *
+---
### `_.forOwn(object, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12326 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forown "See the npm package")
+[#](#_forownobject-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12505 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.forown "See the npm package") [Ⓣ][1]
Iterates over own enumerable string keyed properties of an object and
invokes `iteratee` for each property. The iteratee is invoked with three
@@ -7166,14 +7217,14 @@ _.forOwn(new Foo, function(value, key) {
});
// => Logs 'a' then 'b' (iteration order is not guaranteed).
```
-* * *
+---
### `_.forOwnRight(object, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12356 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forownright "See the npm package")
+[#](#_forownrightobject-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12535 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.forownright "See the npm package") [Ⓣ][1]
This method is like `_.forOwn` except that it iterates over properties of
`object` in the opposite order.
@@ -7201,14 +7252,14 @@ _.forOwnRight(new Foo, function(value, key) {
});
// => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
```
-* * *
+---
### `_.functions(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12383 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functions "See the npm package")
+[#](#_functionsobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12562 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.functions "See the npm package") [Ⓣ][1]
Creates an array of function property names from own enumerable properties
of `object`.
@@ -7233,14 +7284,14 @@ Foo.prototype.c = _.constant('c');
_.functions(new Foo);
// => ['a', 'b']
```
-* * *
+---
### `_.functionsIn(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12410 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functionsin "See the npm package")
+[#](#_functionsinobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12589 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.functionsin "See the npm package") [Ⓣ][1]
Creates an array of function property names from own and inherited
enumerable properties of `object`.
@@ -7265,17 +7316,17 @@ Foo.prototype.c = _.constant('c');
_.functionsIn(new Foo);
// => ['a', 'b', 'c']
```
-* * *
+---
### `_.get(object, path, [defaultValue])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12439 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.get "See the npm package")
+[#](#_getobject-path-defaultvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12618 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.get "See the npm package") [Ⓣ][1]
Gets the value at `path` of `object`. If the resolved value is
-`undefined`, the `defaultValue` is used in its place.
+`undefined`, the `defaultValue` is returned in its place.
#### Since
3.7.0
@@ -7300,14 +7351,14 @@ _.get(object, ['a', '0', 'b', 'c']);
_.get(object, 'a.b.c', 'default');
// => 'default'
```
-* * *
+---
### `_.has(object, path)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12471 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.has "See the npm package")
+[#](#_hasobject-path) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12650 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.has "See the npm package") [Ⓣ][1]
Checks if `path` is a direct property of `object`.
@@ -7337,14 +7388,14 @@ _.has(object, ['a', 'b']);
_.has(other, 'a');
// => false
```
-* * *
+---
### `_.hasIn(object, path)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12501 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.hasin "See the npm package")
+[#](#_hasinobject-path) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12680 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.hasin "See the npm package") [Ⓣ][1]
Checks if `path` is a direct or inherited property of `object`.
@@ -7373,14 +7424,14 @@ _.hasIn(object, ['a', 'b']);
_.hasIn(object, 'b');
// => false
```
-* * *
+---
### `_.invert(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12523 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invert "See the npm package")
+[#](#_invertobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12702 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.invert "See the npm package") [Ⓣ][1]
Creates an object composed of the inverted keys and values of `object`.
If `object` contains duplicate values, subsequent values overwrite
@@ -7401,14 +7452,14 @@ var object = { 'a': 1, 'b': 2, 'c': 1 };
_.invert(object);
// => { '1': 'c', '2': 'b' }
```
-* * *
+---
### `_.invertBy(object, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12554 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invertby "See the npm package")
+[#](#_invertbyobject-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12732 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.invertby "See the npm package") [Ⓣ][1]
This method is like `_.invert` except that the inverted object is generated
from the results of running each element of `object` thru `iteratee`. The
@@ -7420,7 +7471,7 @@ with one argument: *(value)*.
4.1.0
#### Arguments
1. `object` *(Object)*: The object to invert.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The iteratee invoked per element.
+2. `[iteratee=_.identity]` *(Function)*: The iteratee invoked per element.
#### Returns
*(Object)*: Returns the new inverted object.
@@ -7437,14 +7488,14 @@ _.invertBy(object, function(value) {
});
// => { 'group1': ['a', 'c'], 'group2': ['b'] }
```
-* * *
+---
### `_.invoke(object, path, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12580 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invoke "See the npm package")
+[#](#_invokeobject-path-args) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12758 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.invoke "See the npm package") [Ⓣ][1]
Invokes the method at `path` of `object`.
@@ -7465,14 +7516,14 @@ var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
_.invoke(object, 'a[0].b.c.slice', 1, 3);
// => [2, 3]
```
-* * *
+---
### `_.keys(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12610 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keys "See the npm package")
+[#](#_keysobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12788 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.keys "See the npm package") [Ⓣ][1]
Creates an array of the own enumerable property names of `object`.
@@ -7504,14 +7555,14 @@ _.keys(new Foo);
_.keys('hi');
// => ['0', '1']
```
-* * *
+---
### `_.keysIn(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12653 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keysin "See the npm package")
+[#](#_keysinobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12831 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.keysin "See the npm package") [Ⓣ][1]
Creates an array of the own and inherited enumerable property names of `object`.
@@ -7538,14 +7589,14 @@ Foo.prototype.c = 3;
_.keysIn(new Foo);
// => ['a', 'b', 'c'] (iteration order is not guaranteed)
```
-* * *
+---
### `_.mapKeys(object, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12695 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapkeys "See the npm package")
+[#](#_mapkeysobject-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12872 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.mapkeys "See the npm package") [Ⓣ][1]
The opposite of `_.mapValues`; this method creates an object with the
same values as `object` and keys generated by running each own enumerable
@@ -7556,7 +7607,7 @@ with three arguments: *(value, key, object)*.
3.8.0
#### Arguments
1. `object` *(Object)*: The object to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Object)*: Returns the new mapped object.
@@ -7568,14 +7619,14 @@ _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
});
// => { 'a1': 1, 'b2': 2 }
```
-* * *
+---
### `_.mapValues(object, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12734 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapvalues "See the npm package")
+[#](#_mapvaluesobject-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12910 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.mapvalues "See the npm package") [Ⓣ][1]
Creates an object with the same keys as `object` and values generated
by running each own enumerable string keyed property of `object` thru
@@ -7586,7 +7637,7 @@ by running each own enumerable string keyed property of `object` thru
2.4.0
#### Arguments
1. `object` *(Object)*: The object to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration.
+2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Object)*: Returns the new mapped object.
@@ -7605,14 +7656,14 @@ _.mapValues(users, function(o) { return o.age; });
_.mapValues(users, 'age');
// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
```
-* * *
+---
### `_.merge(object, [sources])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12775 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.merge "See the npm package")
+[#](#_mergeobject-sources) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12951 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.merge "See the npm package") [Ⓣ][1]
This method is like `_.assign` except that it recursively merges own and
inherited enumerable string keyed properties of source objects into the
@@ -7636,25 +7687,25 @@ sources overwrite property assignments of previous sources.
#### Example
```js
-var users = {
- 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
+var object = {
+ 'a': [{ 'b': 2 }, { 'd': 4 }]
};
-var ages = {
- 'data': [{ 'age': 36 }, { 'age': 40 }]
+var other = {
+ 'a': [{ 'c': 3 }, { 'e': 5 }]
};
-_.merge(users, ages);
-// => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
+_.merge(object, other);
+// => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
```
-* * *
+---
### `_.mergeWith(object, sources, customizer)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12817 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mergewith "See the npm package")
+[#](#_mergewithobject-sources-customizer) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L12986 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.mergewith "See the npm package") [Ⓣ][1]
This method is like `_.merge` except that it accepts `customizer` which
is invoked to produce the merged values of the destination and source
@@ -7683,27 +7734,20 @@ function customizer(objValue, srcValue) {
}
}
-var object = {
- 'fruits': ['apple'],
- 'vegetables': ['beet']
-};
-
-var other = {
- 'fruits': ['banana'],
- 'vegetables': ['carrot']
-};
+var object = { 'a': [1], 'b': [2] };
+var other = { 'a': [3], 'b': [4] };
_.mergeWith(object, other, customizer);
-// => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
+// => { 'a': [1, 3], 'b': [2, 4] }
```
-* * *
+---
### `_.omit(object, [props])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12840 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omit "See the npm package")
+[#](#_omitobject-props) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13009 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.omit "See the npm package") [Ⓣ][1]
The opposite of `_.pick`; this method creates an object composed of the
own and inherited enumerable string keyed properties of `object` that are
@@ -7725,14 +7769,14 @@ var object = { 'a': 1, 'b': '2', 'c': 3 };
_.omit(object, ['a', 'c']);
// => { 'b': '2' }
```
-* * *
+---
### `_.omitBy(object, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12869 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omitby "See the npm package")
+[#](#_omitbyobject-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13037 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.omitby "See the npm package") [Ⓣ][1]
The opposite of `_.pickBy`; this method creates an object composed of
the own and inherited enumerable string keyed properties of `object` that
@@ -7743,7 +7787,7 @@ arguments: *(value, key)*.
4.0.0
#### Arguments
1. `object` *(Object)*: The source object.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per property.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per property.
#### Returns
*(Object)*: Returns the new object.
@@ -7755,14 +7799,14 @@ var object = { 'a': 1, 'b': '2', 'c': 3 };
_.omitBy(object, _.isNumber);
// => { 'b': '2' }
```
-* * *
+---
### `_.pick(object, [props])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12893 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pick "See the npm package")
+[#](#_pickobject-props) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13058 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pick "See the npm package") [Ⓣ][1]
Creates an object composed of the picked `object` properties.
@@ -7782,14 +7826,14 @@ var object = { 'a': 1, 'b': '2', 'c': 3 };
_.pick(object, ['a', 'c']);
// => { 'a': 1, 'c': 3 }
```
-* * *
+---
### `_.pickBy(object, [predicate=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12916 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pickby "See the npm package")
+[#](#_pickbyobject-predicate_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13080 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pickby "See the npm package") [Ⓣ][1]
Creates an object composed of the `object` properties `predicate` returns
truthy for. The predicate is invoked with two arguments: *(value, key)*.
@@ -7798,7 +7842,7 @@ truthy for. The predicate is invoked with two arguments: *(value, key)*.
4.0.0
#### Arguments
1. `object` *(Object)*: The source object.
-2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per property.
+2. `[predicate=_.identity]` *(Function)*: The function invoked per property.
#### Returns
*(Object)*: Returns the new object.
@@ -7810,14 +7854,14 @@ var object = { 'a': 1, 'b': '2', 'c': 3 };
_.pickBy(object, _.isNumber);
// => { 'a': 1, 'c': 3 }
```
-* * *
+---
### `_.result(object, path, [defaultValue])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12949 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.result "See the npm package")
+[#](#_resultobject-path-defaultvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13113 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.result "See the npm package") [Ⓣ][1]
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
@@ -7849,14 +7893,14 @@ _.result(object, 'a[0].b.c3', 'default');
_.result(object, 'a[0].b.c3', _.constant('default'));
// => 'default'
```
-* * *
+---
### `_.set(object, path, value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L12999 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.set "See the npm package")
+[#](#_setobject-path-value) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13163 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.set "See the npm package") [Ⓣ][1]
Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
it's created. Arrays are created for missing index properties while objects
@@ -7888,14 +7932,14 @@ _.set(object, ['x', '0', 'y', 'z'], 5);
console.log(object.x[0].y.z);
// => 5
```
-* * *
+---
### `_.setWith(object, path, value, [customizer])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13027 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.setwith "See the npm package")
+[#](#_setwithobject-path-value-customizer) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13191 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.setwith "See the npm package") [Ⓣ][1]
This method is like `_.set` except that it accepts `customizer` which is
invoked to produce the objects of `path`. If `customizer` returns `undefined`
@@ -7923,14 +7967,14 @@ var object = {};
_.setWith(object, '[0][1]', 'a', Object);
// => { '0': { '1': 'a' } }
```
-* * *
+---
### `_.toPairs(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13056 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topairs "See the npm package")
+[#](#_topairsobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13220 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.topairs "See the npm package") [Ⓣ][1]
Creates an array of own enumerable string keyed-value pairs for `object`
which can be consumed by `_.fromPairs`. If `object` is a map or set, its
@@ -7959,14 +8003,14 @@ Foo.prototype.c = 3;
_.toPairs(new Foo);
// => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
```
-* * *
+---
### `_.toPairsIn(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13082 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topairsin "See the npm package")
+[#](#_topairsinobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13246 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.topairsin "See the npm package") [Ⓣ][1]
Creates an array of own and inherited enumerable string keyed-value pairs
for `object` which can be consumed by `_.fromPairs`. If `object` is a map
@@ -7995,14 +8039,14 @@ Foo.prototype.c = 3;
_.toPairsIn(new Foo);
// => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
```
-* * *
+---
### `_.transform(object, [iteratee=_.identity], [accumulator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13114 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.transform "See the npm package")
+[#](#_transformobject-iteratee_identity-accumulator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13278 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.transform "See the npm package") [Ⓣ][1]
An alternative to `_.reduce`; this method transforms `object` to a new
`accumulator` object which is the result of running each of its own
@@ -8035,14 +8079,14 @@ _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
}, {});
// => { '1': ['a', 'c'], '2': ['b'] }
```
-* * *
+---
### `_.unset(object, path)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13163 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unset "See the npm package")
+[#](#_unsetobject-path) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13327 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unset "See the npm package") [Ⓣ][1]
Removes the property at `path` of `object`.
@@ -8073,14 +8117,14 @@ _.unset(object, ['a', '0', 'b', 'c']);
console.log(object);
// => { 'a': [{ 'b': {} }] };
```
-* * *
+---
### `_.update(object, path, updater)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13194 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.update "See the npm package")
+[#](#_updateobject-path-updater) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13358 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.update "See the npm package") [Ⓣ][1]
This method is like `_.set` except that accepts `updater` to produce the
value to set. Use `_.updateWith` to customize `path` creation. The `updater`
@@ -8111,14 +8155,14 @@ _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
console.log(object.x[0].y.z);
// => 0
```
-* * *
+---
### `_.updateWith(object, path, updater, [customizer])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13222 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.updatewith "See the npm package")
+[#](#_updatewithobject-path-updater-customizer) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13386 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.updatewith "See the npm package") [Ⓣ][1]
This method is like `_.update` except that it accepts `customizer` which is
invoked to produce the objects of `path`. If `customizer` returns `undefined`
@@ -8146,14 +8190,14 @@ var object = {};
_.updateWith(object, '[0][1]', _.constant('a'), Object);
// => { '0': { '1': 'a' } }
```
-* * *
+---
### `_.values(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13253 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.values "See the npm package")
+[#](#_valuesobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13417 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.values "See the npm package") [Ⓣ][1]
Creates an array of the own enumerable string keyed property values of `object`.
@@ -8183,14 +8227,14 @@ _.values(new Foo);
_.values('hi');
// => ['h', 'i']
```
-* * *
+---
### `_.valuesIn(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13281 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.valuesin "See the npm package")
+[#](#_valuesinobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13445 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.valuesin "See the npm package") [Ⓣ][1]
Creates an array of the own and inherited enumerable string keyed property
values of `object`.
@@ -8218,7 +8262,7 @@ Foo.prototype.c = 3;
_.valuesIn(new Foo);
// => [1, 2, 3] (iteration order is not guaranteed)
```
-* * *
+---
@@ -8231,7 +8275,7 @@ _.valuesIn(new Foo);
### `_(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L1464 "View in source") [Ⓣ][1]
+[#](#_value) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L1521 "View in source") [Ⓣ][1]
Creates a `lodash` object which wraps `value` to enable implicit method
chain sequences. Methods that operate on and return arrays, collections,
@@ -8308,16 +8352,16 @@ The chainable wrapper methods are:
The wrapper methods that are **not** chainable by default are:
`add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
-`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`,
+`cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
+`defaultTo`, `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`,
@@ -8360,14 +8404,14 @@ _.isArray(squares);
_.isArray(squares.value());
// => true
```
-* * *
+---
### `_.chain(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8031 "View in source") [Ⓣ][1]
+[#](#_chainvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8238 "View in source") [Ⓣ][1]
Creates a `lodash` wrapper instance that wraps `value` with explicit method
chain sequences enabled. The result of such sequences must be unwrapped
@@ -8399,14 +8443,14 @@ var youngest = _
.value();
// => 'pebbles is 1'
```
-* * *
+---
### `_.tap(value, interceptor)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8060 "View in source") [Ⓣ][1]
+[#](#_tapvalue-interceptor) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8267 "View in source") [Ⓣ][1]
This method invokes `interceptor` and returns `value`. The interceptor
is invoked with one argument; *(value)*. The purpose of this method is to
@@ -8432,14 +8476,14 @@ _([1, 2, 3])
.value();
// => [2, 1]
```
-* * *
+---
### `_.thru(value, interceptor)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8088 "View in source") [Ⓣ][1]
+[#](#_thruvalue-interceptor) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8295 "View in source") [Ⓣ][1]
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
@@ -8465,14 +8509,14 @@ _(' abc ')
.value();
// => ['abc']
```
-* * *
+---
### `_.prototype[Symbol.iterator]()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8244 "View in source") [Ⓣ][1]
+[#](#_prototypesymboliterator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8451 "View in source") [Ⓣ][1]
Enables the wrapper to be iterable.
@@ -8491,14 +8535,14 @@ wrapped[Symbol.iterator]() === wrapped;
Array.from(wrapped);
// => [1, 2]
```
-* * *
+---
### `_.prototype.at([paths])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8108 "View in source") [Ⓣ][1]
+[#](#_prototypeatpaths) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8315 "View in source") [Ⓣ][1]
This method is the wrapper version of `_.at`.
@@ -8517,14 +8561,14 @@ var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
_(object).at(['a[0].b.c', 'a[1]']).value();
// => [3, 4]
```
-* * *
+---
### `_.prototype.chain()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8160 "View in source") [Ⓣ][1]
+[#](#_prototypechain) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8367 "View in source") [Ⓣ][1]
Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
@@ -8552,14 +8596,14 @@ _(users)
.value();
// => { 'user': 'barney' }
```
-* * *
+---
### `_.prototype.commit()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8190 "View in source") [Ⓣ][1]
+[#](#_prototypecommit) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8397 "View in source") [Ⓣ][1]
Executes the chain sequence and returns the wrapped result.
@@ -8586,14 +8630,14 @@ wrapped.last();
console.log(array);
// => [1, 2, 3]
```
-* * *
+---
### `_.prototype.next()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8216 "View in source") [Ⓣ][1]
+[#](#_prototypenext) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8423 "View in source") [Ⓣ][1]
Gets the next value on a wrapped object following the
[iterator protocol](https://mdn.io/iteration_protocols#iterator).
@@ -8616,14 +8660,14 @@ wrapped.next();
wrapped.next();
// => { 'done': true, 'value': undefined }
```
-* * *
+---
### `_.prototype.plant(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8272 "View in source") [Ⓣ][1]
+[#](#_prototypeplantvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8479 "View in source") [Ⓣ][1]
Creates a clone of the chain sequence planting `value` as the wrapped value.
@@ -8650,14 +8694,14 @@ other.value();
wrapped.value();
// => [1, 4]
```
-* * *
+---
### `_.prototype.reverse()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8312 "View in source") [Ⓣ][1]
+[#](#_prototypereverse) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8519 "View in source") [Ⓣ][1]
This method is the wrapper version of `_.reverse`.
@@ -8679,14 +8723,14 @@ _(array).reverse().value()
console.log(array);
// => [3, 2, 1]
```
-* * *
+---
### `_.prototype.value()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L8344 "View in source") [Ⓣ][1]
+[#](#_prototypevalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L8551 "View in source") [Ⓣ][1]
Executes the chain sequence to resolve the unwrapped value.
@@ -8703,7 +8747,7 @@ Executes the chain sequence to resolve the unwrapped value.
_([1, 2, 3]).value();
// => [1, 2, 3]
```
-* * *
+---
@@ -8716,7 +8760,7 @@ _([1, 2, 3]).value();
### `_.camelCase([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13464 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.camelcase "See the npm package")
+[#](#_camelcasestring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13628 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.camelcase "See the npm package") [Ⓣ][1]
Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
@@ -8739,14 +8783,14 @@ _.camelCase('--foo-bar--');
_.camelCase('__FOO_BAR__');
// => 'fooBar'
```
-* * *
+---
### `_.capitalize([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13484 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.capitalize "See the npm package")
+[#](#_capitalizestring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13648 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.capitalize "See the npm package") [Ⓣ][1]
Converts the first character of `string` to upper case and the remaining
to lower case.
@@ -8764,14 +8808,14 @@ to lower case.
_.capitalize('FRED');
// => 'Fred'
```
-* * *
+---
### `_.deburr([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13505 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.deburr "See the npm package")
+[#](#_deburrstring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13669 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.deburr "See the npm package") [Ⓣ][1]
Deburrs `string` by converting
[latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
@@ -8791,14 +8835,14 @@ to basic latin letters and removing
_.deburr('déjà vu');
// => 'deja vu'
```
-* * *
+---
### `_.endsWith([string=''], [target], [position=string.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13533 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.endswith "See the npm package")
+[#](#_endswithstring-target-positionstringlength) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13697 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.endswith "See the npm package") [Ⓣ][1]
Checks if `string` ends with the given target string.
@@ -8823,14 +8867,14 @@ _.endsWith('abc', 'b');
_.endsWith('abc', 'b', 2);
// => true
```
-* * *
+---
### `_.escape([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13580 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escape "See the npm package")
+[#](#_escapestring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13745 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.escape "See the npm package") [Ⓣ][1]
Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to
their corresponding HTML entities.
@@ -8871,14 +8915,14 @@ XSS vectors.
_.escape('fred, barney, & pebbles');
// => 'fred, barney, & pebbles'
```
-* * *
+---
### `_.escapeRegExp([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13602 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escaperegexp "See the npm package")
+[#](#_escaperegexpstring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13767 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.escaperegexp "See the npm package") [Ⓣ][1]
Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
"?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
@@ -8896,14 +8940,14 @@ Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
_.escapeRegExp('[lodash](https://lodash.com/)');
// => '\[lodash\]\(https://lodash\.com/\)'
```
-* * *
+---
### `_.kebabCase([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13630 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.kebabcase "See the npm package")
+[#](#_kebabcasestring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13795 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.kebabcase "See the npm package") [Ⓣ][1]
Converts `string` to
[kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
@@ -8927,14 +8971,14 @@ _.kebabCase('fooBar');
_.kebabCase('__FOO_BAR__');
// => 'foo-bar'
```
-* * *
+---
### `_.lowerCase([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13654 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lowercase "See the npm package")
+[#](#_lowercasestring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13819 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.lowercase "See the npm package") [Ⓣ][1]
Converts `string`, as space separated words, to lower case.
@@ -8957,14 +9001,14 @@ _.lowerCase('fooBar');
_.lowerCase('__FOO_BAR__');
// => 'foo bar'
```
-* * *
+---
### `_.lowerFirst([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13675 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lowerfirst "See the npm package")
+[#](#_lowerfirststring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13840 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.lowerfirst "See the npm package") [Ⓣ][1]
Converts the first character of `string` to lower case.
@@ -8984,14 +9028,14 @@ _.lowerFirst('Fred');
_.lowerFirst('FRED');
// => 'fRED'
```
-* * *
+---
### `_.pad([string=''], [length=0], [chars=' '])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13700 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pad "See the npm package")
+[#](#_padstring-length0-chars) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13865 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.pad "See the npm package") [Ⓣ][1]
Pads `string` on the left and right sides if it's shorter than `length`.
Padding characters are truncated if they can't be evenly divided by `length`.
@@ -9017,14 +9061,14 @@ _.pad('abc', 8, '_-');
_.pad('abc', 3);
// => 'abc'
```
-* * *
+---
### `_.padEnd([string=''], [length=0], [chars=' '])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13739 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padend "See the npm package")
+[#](#_padendstring-length0-chars) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13904 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.padend "See the npm package") [Ⓣ][1]
Pads `string` on the right side if it's shorter than `length`. Padding
characters are truncated if they exceed `length`.
@@ -9050,14 +9094,14 @@ _.padEnd('abc', 6, '_-');
_.padEnd('abc', 3);
// => 'abc'
```
-* * *
+---
### `_.padStart([string=''], [length=0], [chars=' '])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13772 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padstart "See the npm package")
+[#](#_padstartstring-length0-chars) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13937 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.padstart "See the npm package") [Ⓣ][1]
Pads `string` on the left side if it's shorter than `length`. Padding
characters are truncated if they exceed `length`.
@@ -9083,14 +9127,14 @@ _.padStart('abc', 6, '_-');
_.padStart('abc', 3);
// => 'abc'
```
-* * *
+---
### `_.parseInt(string, [radix=10])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13806 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.parseint "See the npm package")
+[#](#_parseintstring-radix10) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L13971 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.parseint "See the npm package") [Ⓣ][1]
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
@@ -9117,14 +9161,14 @@ _.parseInt('08');
_.map(['6', '08', '10'], _.parseInt);
// => [6, 8, 10]
```
-* * *
+---
### `_.repeat([string=''], [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13840 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.repeat "See the npm package")
+[#](#_repeatstring-n1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14005 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.repeat "See the npm package") [Ⓣ][1]
Repeats the given string `n` times.
@@ -9148,14 +9192,14 @@ _.repeat('abc', 2);
_.repeat('abc', 0);
// => ''
```
-* * *
+---
### `_.replace([string=''], pattern, replacement)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13868 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.replace "See the npm package")
+[#](#_replacestring-pattern-replacement) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14033 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.replace "See the npm package") [Ⓣ][1]
Replaces matches for `pattern` in `string` with `replacement`.
@@ -9178,14 +9222,14 @@ Replaces matches for `pattern` in `string` with `replacement`.
_.replace('Hi Fred', 'Fred', 'Barney');
// => 'Hi Barney'
```
-* * *
+---
### `_.snakeCase([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13896 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.snakecase "See the npm package")
+[#](#_snakecasestring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14061 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.snakecase "See the npm package") [Ⓣ][1]
Converts `string` to
[snake case](https://en.wikipedia.org/wiki/Snake_case).
@@ -9209,14 +9253,14 @@ _.snakeCase('fooBar');
_.snakeCase('--FOO-BAR--');
// => 'foo_bar'
```
-* * *
+---
### `_.split([string=''], separator, [limit])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13919 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.split "See the npm package")
+[#](#_splitstring-separator-limit) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14084 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.split "See the npm package") [Ⓣ][1]
Splits `string` by `separator`.
@@ -9239,14 +9283,14 @@ Splits `string` by `separator`.
_.split('a-b-c', '-', 2);
// => ['a', 'b']
```
-* * *
+---
### `_.startCase([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13961 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startcase "See the npm package")
+[#](#_startcasestring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14126 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.startcase "See the npm package") [Ⓣ][1]
Converts `string` to
[start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
@@ -9270,14 +9314,14 @@ _.startCase('fooBar');
_.startCase('__FOO_BAR__');
// => 'FOO BAR'
```
-* * *
+---
### `_.startsWith([string=''], [target], [position=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L13988 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startswith "See the npm package")
+[#](#_startswithstring-target-position0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14153 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.startswith "See the npm package") [Ⓣ][1]
Checks if `string` starts with the given target string.
@@ -9302,14 +9346,14 @@ _.startsWith('abc', 'b');
_.startsWith('abc', 'b', 1);
// => true
```
-* * *
+---
### `_.template([string=''], [options={}], [options.escape=_.templateSettings.escape], [options.evaluate=_.templateSettings.evaluate], [options.imports=_.templateSettings.imports], [options.interpolate=_.templateSettings.interpolate], [options.sourceURL='lodash.templateSources[n]'], [options.variable='obj'])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14097 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.template "See the npm package")
+[#](#_templatestring-options-optionsescape_templatesettingsescape-optionsevaluate_templatesettingsevaluate-optionsimports_templatesettingsimports-optionsinterpolate_templatesettingsinterpolate-optionssourceurllodashtemplatesourcesn-optionsvariableobj) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14263 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.template "See the npm package") [Ⓣ][1]
Creates a compiled template function that can interpolate data properties
in "interpolate" delimiters, HTML-escape interpolated data properties in
@@ -9411,14 +9455,14 @@ fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
};\
');
```
-* * *
+---
### `_.toLower([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14226 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tolower "See the npm package")
+[#](#_tolowerstring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14392 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.tolower "See the npm package") [Ⓣ][1]
Converts `string`, as a whole, to lower case just like
[String#toLowerCase](https://mdn.io/toLowerCase).
@@ -9442,14 +9486,14 @@ _.toLower('fooBar');
_.toLower('__FOO_BAR__');
// => '__foo_bar__'
```
-* * *
+---
### `_.toUpper([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14251 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toupper "See the npm package")
+[#](#_toupperstring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14417 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.toupper "See the npm package") [Ⓣ][1]
Converts `string`, as a whole, to upper case just like
[String#toUpperCase](https://mdn.io/toUpperCase).
@@ -9473,14 +9517,14 @@ _.toUpper('fooBar');
_.toUpper('__foo_bar__');
// => '__FOO_BAR__'
```
-* * *
+---
### `_.trim([string=''], [chars=whitespace])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14277 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trim "See the npm package")
+[#](#_trimstring-charswhitespace) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14443 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.trim "See the npm package") [Ⓣ][1]
Removes leading and trailing whitespace or specified characters from `string`.
@@ -9504,14 +9548,14 @@ _.trim('-_-abc-_-', '_-');
_.map([' foo ', ' bar '], _.trim);
// => ['foo', 'bar']
```
-* * *
+---
### `_.trimEnd([string=''], [chars=whitespace])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14312 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimend "See the npm package")
+[#](#_trimendstring-charswhitespace) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14478 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.trimend "See the npm package") [Ⓣ][1]
Removes trailing whitespace or specified characters from `string`.
@@ -9532,14 +9576,14 @@ _.trimEnd(' abc ');
_.trimEnd('-_-abc-_-', '_-');
// => '-_-abc'
```
-* * *
+---
### `_.trimStart([string=''], [chars=whitespace])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14345 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimstart "See the npm package")
+[#](#_trimstartstring-charswhitespace) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14511 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.trimstart "See the npm package") [Ⓣ][1]
Removes leading whitespace or specified characters from `string`.
@@ -9560,14 +9604,14 @@ _.trimStart(' abc ');
_.trimStart('-_-abc-_-', '_-');
// => 'abc-_-'
```
-* * *
+---
### `_.truncate([string=''], [options={}], [options.length=30], [options.omission='...'], [options.separator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14396 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.truncate "See the npm package")
+[#](#_truncatestring-options-optionslength30-optionsomission-optionsseparator) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14562 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.truncate "See the npm package") [Ⓣ][1]
Truncates `string` if it's longer than the given maximum string length.
The last characters of the truncated string are replaced with the omission
@@ -9607,14 +9651,14 @@ _.truncate('hi-diddly-ho there, neighborino', {
});
// => 'hi-diddly-ho there, neig [...]'
```
-* * *
+---
### `_.unescape([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14471 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unescape "See the npm package")
+[#](#_unescapestring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14637 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.unescape "See the npm package") [Ⓣ][1]
The inverse of `_.escape`; this method converts the HTML entities
`&`, `<`, `>`, `"`, `'`, and ``` in `string` to
@@ -9637,14 +9681,14 @@ HTML entities use a third-party library like [_he_](https://mths.be/he).
_.unescape('fred, barney, & pebbles');
// => 'fred, barney, & pebbles'
```
-* * *
+---
### `_.upperCase([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14498 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uppercase "See the npm package")
+[#](#_uppercasestring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14664 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.uppercase "See the npm package") [Ⓣ][1]
Converts `string`, as space separated words, to upper case.
@@ -9667,14 +9711,14 @@ _.upperCase('fooBar');
_.upperCase('__foo_bar__');
// => 'FOO BAR'
```
-* * *
+---
### `_.upperFirst([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14519 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.upperfirst "See the npm package")
+[#](#_upperfirststring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14685 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.upperfirst "See the npm package") [Ⓣ][1]
Converts the first character of `string` to upper case.
@@ -9694,14 +9738,14 @@ _.upperFirst('fred');
_.upperFirst('FRED');
// => 'FRED'
```
-* * *
+---
### `_.words([string=''], [pattern])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14540 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.words "See the npm package")
+[#](#_wordsstring-pattern) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14706 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.words "See the npm package") [Ⓣ][1]
Splits `string` into an array of its words.
@@ -9722,7 +9766,7 @@ _.words('fred, barney, & pebbles');
_.words('fred, barney, & pebbles', /[^, ]+/g);
// => ['fred', 'barney', '&', 'pebbles']
```
-* * *
+---
@@ -9735,7 +9779,7 @@ _.words('fred, barney, & pebbles', /[^, ]+/g);
### `_.attempt(func, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14574 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.attempt "See the npm package")
+[#](#_attemptfunc-args) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14740 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.attempt "See the npm package") [Ⓣ][1]
Attempts to invoke `func`, returning either the result or the caught error
object. Any additional arguments are provided to `func` when it's invoked.
@@ -9760,14 +9804,14 @@ if (_.isError(elements)) {
elements = [];
}
```
-* * *
+---
### `_.bindAll(object, methodNames)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14608 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindall "See the npm package")
+[#](#_bindallobject-methodnames) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14774 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.bindall "See the npm package") [Ⓣ][1]
Binds methods of an object to the object itself, overwriting the existing
method.
@@ -9788,23 +9832,23 @@ method.
```js
var view = {
'label': 'docs',
- 'onClick': function() {
+ 'click': function() {
console.log('clicked ' + this.label);
}
};
-_.bindAll(view, ['onClick']);
-jQuery(element).on('click', view.onClick);
+_.bindAll(view, ['click']);
+jQuery(element).on('click', view.click);
// => Logs 'clicked docs' when clicked.
```
-* * *
+---
### `_.cond(pairs)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14645 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.cond "See the npm package")
+[#](#_condpairs) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14811 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.cond "See the npm package") [Ⓣ][1]
Creates a function that iterates over `pairs` and invokes the corresponding
function of the first predicate to return truthy. The predicate-function
@@ -9824,7 +9868,7 @@ function.
var func = _.cond([
[_.matches({ 'a': 1 }), _.constant('matches A')],
[_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
- [_.constant(true), _.constant('no match')]
+ [_.stubTrue, _.constant('no match')]
]);
func({ 'a': 1, 'b': 2 });
@@ -9836,14 +9880,14 @@ func({ 'a': 0, 'b': 1 });
func({ 'a': '1', 'b': '2' });
// => 'no match'
```
-* * *
+---
### `_.conforms(source)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14688 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.conforms "See the npm package")
+[#](#_conformssource) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14854 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.conforms "See the npm package") [Ⓣ][1]
Creates a function that invokes the predicate properties of `source` with
the corresponding property values of a given object, returning `true` if
@@ -9859,22 +9903,22 @@ all predicates return truthy, else `false`.
#### Example
```js
-var users = [
- { 'user': 'barney', 'age': 36 },
- { 'user': 'fred', 'age': 40 }
+var objects = [
+ { 'a': 2, 'b': 1 },
+ { 'a': 1, 'b': 2 }
];
-_.filter(users, _.conforms({ 'age': function(n) { return n > 38; } }));
-// => [{ 'user': 'fred', 'age': 40 }]
+_.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
+// => [{ 'a': 1, 'b': 2 }]
```
-* * *
+---
### `_.constant(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14711 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.constant "See the npm package")
+[#](#_constantvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14877 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.constant "See the npm package") [Ⓣ][1]
Creates a function that returns `value`.
@@ -9896,14 +9940,44 @@ console.log(objects);
console.log(objects[0] === objects[1]);
// => true
```
-* * *
+---
+
+
+
+
+
+### `_.defaultTo(value, defaultValue)`
+[#](#_defaulttovalue-defaultvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14903 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.defaultto "See the npm package") [Ⓣ][1]
+
+Checks `value` to determine whether a default value should be returned in
+its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
+or `undefined`.
+
+#### Since
+4.14.0
+#### Arguments
+1. `value` *(*)*: The value to check.
+2. `defaultValue` *(*)*: The default value.
+
+#### Returns
+*(*)*: Returns the resolved value.
+
+#### Example
+```js
+_.defaultTo(1, 10);
+// => 1
+
+_.defaultTo(undefined, 10);
+// => 10
+```
+---
### `_.flow([funcs])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14739 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flow "See the npm package")
+[#](#_flowfuncs) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14929 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flow "See the npm package") [Ⓣ][1]
Creates a function that returns the result of invoking the given functions
with the `this` binding of the created function, where each successive
@@ -9912,7 +9986,7 @@ invocation is supplied the return value of the previous.
#### Since
3.0.0
#### Arguments
-1. `[funcs]` *(...(Function|Function[]))*: Functions to invoke.
+1. `[funcs]` *(...(Function|Function[]))*: The functions to invoke.
#### Returns
*(Function)*: Returns the new composite function.
@@ -9927,14 +10001,14 @@ var addSquare = _.flow([_.add, square]);
addSquare(1, 2);
// => 9
```
-* * *
+---
### `_.flowRight([funcs])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14762 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flowright "See the npm package")
+[#](#_flowrightfuncs) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14952 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.flowright "See the npm package") [Ⓣ][1]
This method is like `_.flow` except that it creates a function that
invokes the given functions from right to left.
@@ -9942,7 +10016,7 @@ invokes the given functions from right to left.
#### Since
3.0.0
#### Arguments
-1. `[funcs]` *(...(Function|Function[]))*: Functions to invoke.
+1. `[funcs]` *(...(Function|Function[]))*: The functions to invoke.
#### Returns
*(Function)*: Returns the new composite function.
@@ -9957,16 +10031,16 @@ var addSquare = _.flowRight([square, _.add]);
addSquare(1, 2);
// => 9
```
-* * *
+---
### `_.identity(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14780 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.identity "See the npm package")
+[#](#_identityvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L14970 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.identity "See the npm package") [Ⓣ][1]
-This method returns the first argument given to it.
+This method returns the first argument it receives.
#### Since
0.1.0
@@ -9978,19 +10052,19 @@ This method returns the first argument given to it.
#### Example
```js
-var object = { 'user': 'fred' };
+var object = { 'a': 1 };
console.log(_.identity(object) === object);
// => true
```
-* * *
+---
### `_.iteratee([func=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14826 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iteratee "See the npm package")
+[#](#_iterateefunc_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15016 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.iteratee "See the npm package") [Ⓣ][1]
Creates a function that invokes `func` with the arguments of the created
function. If `func` is a property name, the created function returns the
@@ -10035,14 +10109,14 @@ _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
_.filter(['abc', 'def'], /ef/);
// => ['def']
```
-* * *
+---
### `_.matches(source)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14854 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matches "See the npm package")
+[#](#_matchessource) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15044 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.matches "See the npm package") [Ⓣ][1]
Creates a function that performs a partial deep comparison between a given
object and `source`, returning `true` if the given object has equivalent
@@ -10062,22 +10136,22 @@ property values, else `false`. The created function is equivalent to
#### Example
```js
-var users = [
- { 'user': 'barney', 'age': 36, 'active': true },
- { 'user': 'fred', 'age': 40, 'active': false }
+var objects = [
+ { 'a': 1, 'b': 2, 'c': 3 },
+ { 'a': 4, 'b': 5, 'c': 6 }
];
-_.filter(users, _.matches({ 'age': 40, 'active': false }));
-// => [{ 'user': 'fred', 'age': 40, 'active': false }]
+_.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
+// => [{ 'a': 4, 'b': 5, 'c': 6 }]
```
-* * *
+---
### `_.matchesProperty(path, srcValue)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14882 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matchesproperty "See the npm package")
+[#](#_matchespropertypath-srcvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15072 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.matchesproperty "See the npm package") [Ⓣ][1]
Creates a function that performs a partial deep comparison between the
value at `path` of a given object to `srcValue`, returning `true` if the
@@ -10097,22 +10171,22 @@ object value is equivalent, else `false`.
#### Example
```js
-var users = [
- { 'user': 'barney' },
- { 'user': 'fred' }
+var objects = [
+ { 'a': 1, 'b': 2, 'c': 3 },
+ { 'a': 4, 'b': 5, 'c': 6 }
];
-_.find(users, _.matchesProperty('user', 'fred'));
-// => { 'user': 'fred' }
+_.find(objects, _.matchesProperty('a', 4));
+// => { 'a': 4, 'b': 5, 'c': 6 }
```
-* * *
+---
### `_.method(path, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14910 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.method "See the npm package")
+[#](#_methodpath-args) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15100 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.method "See the npm package") [Ⓣ][1]
Creates a function that invokes the method at `path` of a given object.
Any additional arguments are provided to the invoked method.
@@ -10139,14 +10213,14 @@ _.map(objects, _.method('a.b'));
_.map(objects, _.method(['a', 'b']));
// => [2, 1]
```
-* * *
+---
### `_.methodOf(object, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14939 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.methodof "See the npm package")
+[#](#_methodofobject-args) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15129 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.methodof "See the npm package") [Ⓣ][1]
The opposite of `_.method`; this method creates a function that invokes
the method at a given path of `object`. Any additional arguments are
@@ -10172,14 +10246,14 @@ _.map(['a[2]', 'c[0]'], _.methodOf(object));
_.map([['a', '2'], ['c', '0']], _.methodOf(object));
// => [2, 0]
```
-* * *
+---
### `_.mixin([object=lodash], source, [options={}], [options.chain=true])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L14981 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mixin "See the npm package")
+[#](#_mixinobjectlodash-source-options-optionschaintrue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15171 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.mixin "See the npm package") [Ⓣ][1]
Adds all own enumerable string keyed function properties of a source
object to the destination object. If `object` is a function, then methods
@@ -10219,14 +10293,14 @@ _.mixin({ 'vowels': vowels }, { 'chain': false });
_('fred').vowels();
// => ['e']
```
-* * *
+---
### `_.noConflict()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15030 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noconflict "See the npm package")
+[#](#_noconflict) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15220 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.noconflict "See the npm package") [Ⓣ][1]
Reverts the `_` variable to its previous value and returns a reference to
the `lodash` function.
@@ -10240,16 +10314,16 @@ the `lodash` function.
```js
var lodash = _.noConflict();
```
-* * *
+---
### `_.noop()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15049 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noop "See the npm package")
+[#](#_noop) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15239 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.noop "See the npm package") [Ⓣ][1]
-A method that returns `undefined`.
+This method returns `undefined`.
#### Since
2.3.0
@@ -10258,14 +10332,14 @@ A method that returns `undefined`.
_.times(2, _.noop);
// => [undefined, undefined]
```
-* * *
+---
### `_.nthArg([n=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15073 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ntharg "See the npm package")
+[#](#_nthargn0) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15263 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.ntharg "See the npm package") [Ⓣ][1]
Creates a function that gets the argument at index `n`. If `n` is negative,
the nth argument from the end is returned.
@@ -10288,14 +10362,14 @@ var func = _.nthArg(-2);
func('a', 'b', 'c', 'd');
// => 'c'
```
-* * *
+---
### `_.over([iteratees=[_.identity]])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15098 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.over "See the npm package")
+[#](#_overiteratees_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15288 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.over "See the npm package") [Ⓣ][1]
Creates a function that invokes `iteratees` with the arguments it receives
and returns their results.
@@ -10303,7 +10377,7 @@ and returns their results.
#### Since
4.0.0
#### Arguments
-1. `[iteratees=[_.identity]]` *(...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[]))*: The iteratees to invoke.
+1. `[iteratees=[_.identity]]` *(...(Function|Function[]))*: The iteratees to invoke.
#### Returns
*(Function)*: Returns the new function.
@@ -10315,14 +10389,14 @@ var func = _.over([Math.max, Math.min]);
func(1, 2, 3, 4);
// => [4, 1]
```
-* * *
+---
### `_.overEvery([predicates=[_.identity]])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15124 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.overevery "See the npm package")
+[#](#_overeverypredicates_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15314 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.overevery "See the npm package") [Ⓣ][1]
Creates a function that checks if **all** of the `predicates` return
truthy when invoked with the arguments it receives.
@@ -10330,7 +10404,7 @@ truthy when invoked with the arguments it receives.
#### Since
4.0.0
#### Arguments
-1. `[predicates=[_.identity]]` *(...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[]))*: The predicates to check.
+1. `[predicates=[_.identity]]` *(...(Function|Function[]))*: The predicates to check.
#### Returns
*(Function)*: Returns the new function.
@@ -10348,14 +10422,14 @@ func(null);
func(NaN);
// => false
```
-* * *
+---
### `_.overSome([predicates=[_.identity]])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15150 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.oversome "See the npm package")
+[#](#_oversomepredicates_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15340 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.oversome "See the npm package") [Ⓣ][1]
Creates a function that checks if **any** of the `predicates` return
truthy when invoked with the arguments it receives.
@@ -10363,7 +10437,7 @@ truthy when invoked with the arguments it receives.
#### Since
4.0.0
#### Arguments
-1. `[predicates=[_.identity]]` *(...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[]))*: The predicates to check.
+1. `[predicates=[_.identity]]` *(...(Function|Function[]))*: The predicates to check.
#### Returns
*(Function)*: Returns the new function.
@@ -10381,14 +10455,14 @@ func(null);
func(NaN);
// => false
```
-* * *
+---
### `_.property(path)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15174 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.property "See the npm package")
+[#](#_propertypath) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15364 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.property "See the npm package") [Ⓣ][1]
Creates a function that returns the value at `path` of a given object.
@@ -10413,14 +10487,14 @@ _.map(objects, _.property('a.b'));
_.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
// => [1, 2]
```
-* * *
+---
### `_.propertyOf(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15199 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.propertyof "See the npm package")
+[#](#_propertyofobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15389 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.propertyof "See the npm package") [Ⓣ][1]
The opposite of `_.property`; this method creates a function that returns
the value at a given path of `object`.
@@ -10444,14 +10518,14 @@ _.map(['a[2]', 'c[0]'], _.propertyOf(object));
_.map([['a', '2'], ['c', '0']], _.propertyOf(object));
// => [2, 0]
```
-* * *
+---
### `_.range([start=0], end, [step=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15246 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.range "See the npm package")
+[#](#_rangestart0-end-step1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15436 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.range "See the npm package") [Ⓣ][1]
Creates an array of numbers *(positive and/or negative)* progressing from
`start` up to, but not including, `end`. A step of `-1` is used if a negative
@@ -10495,14 +10569,14 @@ _.range(1, 4, 0);
_.range(0);
// => []
```
-* * *
+---
### `_.rangeRight([start=0], end, [step=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15284 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rangeright "See the npm package")
+[#](#_rangerightstart0-end-step1) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15474 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.rangeright "See the npm package") [Ⓣ][1]
This method is like `_.range` except that it populates values in
descending order.
@@ -10540,14 +10614,14 @@ _.rangeRight(1, 4, 0);
_.rangeRight(0);
// => []
```
-* * *
+---
### `_.runInContext([context=root])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L1234 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.runincontext "See the npm package")
+[#](#_runincontextcontextroot) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L1279 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.runincontext "See the npm package") [Ⓣ][1]
Create a new pristine `lodash` function using the `context` object.
@@ -10586,16 +10660,16 @@ var stubbed = _.runInContext({
// Create a suped-up `defer` in Node.js.
var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
```
-* * *
+---
### `_.stubArray()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15304 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.stubarray "See the npm package")
+[#](#_stubarray) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15494 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.stubarray "See the npm package") [Ⓣ][1]
-A method that returns a new empty array.
+This method returns a new empty array.
#### Since
4.13.0
@@ -10612,16 +10686,16 @@ console.log(arrays);
console.log(arrays[0] === arrays[1]);
// => false
```
-* * *
+---
### `_.stubFalse()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15321 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.stubfalse "See the npm package")
+[#](#_stubfalse) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15511 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.stubfalse "See the npm package") [Ⓣ][1]
-A method that returns `false`.
+This method returns `false`.
#### Since
4.13.0
@@ -10633,16 +10707,16 @@ A method that returns `false`.
_.times(2, _.stubFalse);
// => [false, false]
```
-* * *
+---
### `_.stubObject()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15343 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.stubobject "See the npm package")
+[#](#_stubobject) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15533 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.stubobject "See the npm package") [Ⓣ][1]
-A method that returns a new empty object.
+This method returns a new empty object.
#### Since
4.13.0
@@ -10659,16 +10733,16 @@ console.log(objects);
console.log(objects[0] === objects[1]);
// => false
```
-* * *
+---
### `_.stubString()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15360 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.stubstring "See the npm package")
+[#](#_stubstring) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15550 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.stubstring "See the npm package") [Ⓣ][1]
-A method that returns an empty string.
+This method returns an empty string.
#### Since
4.13.0
@@ -10680,16 +10754,16 @@ A method that returns an empty string.
_.times(2, _.stubString);
// => ['', '']
```
-* * *
+---
### `_.stubTrue()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15377 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.stubtrue "See the npm package")
+[#](#_stubtrue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15567 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.stubtrue "See the npm package") [Ⓣ][1]
-A method that returns `true`.
+This method returns `true`.
#### Since
4.13.0
@@ -10701,14 +10775,14 @@ A method that returns `true`.
_.times(2, _.stubTrue);
// => [true, true]
```
-* * *
+---
### `_.times(n, [iteratee=_.identity])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15400 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.times "See the npm package")
+[#](#_timesn-iteratee_identity) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15590 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.times "See the npm package") [Ⓣ][1]
Invokes the iteratee `n` times, returning an array of the results of
each invocation. The iteratee is invoked with one argument; *(index)*.
@@ -10730,14 +10804,14 @@ _.times(3, String);
_.times(4, _.constant(0));
// => [0, 0, 0, 0]
```
-* * *
+---
### `_.toPath(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15435 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topath "See the npm package")
+[#](#_topathvalue) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15625 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.topath "See the npm package") [Ⓣ][1]
Converts `value` to a property path array.
@@ -10757,14 +10831,14 @@ _.toPath('a.b.c');
_.toPath('a[0].b.c');
// => ['a', '0', 'b', 'c']
```
-* * *
+---
### `_.uniqueId([prefix=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L15459 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqueid "See the npm package")
+[#](#_uniqueidprefix) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L15649 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.uniqueid "See the npm package") [Ⓣ][1]
Generates a unique ID. If `prefix` is given, the ID is appended to it.
@@ -10784,7 +10858,7 @@ _.uniqueId('contact_');
_.uniqueId();
// => '105'
```
-* * *
+---
@@ -10797,79 +10871,79 @@ _.uniqueId();
### `_.VERSION`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L16152 "View in source") [Ⓣ][1]
+[#](#_version) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L16340 "View in source") [Ⓣ][1]
(string): The semantic version number.
-* * *
+---
### `_.templateSettings`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L1509 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.templatesettings "See the npm package")
+[#](#_templatesettings) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L1566 "View in source") [Ⓝ](https://www.npmjs.com/package/lodash.templatesettings "See the npm package") [Ⓣ][1]
(Object): By default, the template delimiters used by lodash are like those in
embedded Ruby *(ERB)*. Change the following template settings to use
alternative delimiters.
-* * *
+---
### `_.templateSettings.escape`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L1517 "View in source") [Ⓣ][1]
+[#](#_templatesettingsescape) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L1574 "View in source") [Ⓣ][1]
(RegExp): Used to detect `data` property values to be HTML-escaped.
-* * *
+---
### `_.templateSettings.evaluate`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L1525 "View in source") [Ⓣ][1]
+[#](#_templatesettingsevaluate) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L1582 "View in source") [Ⓣ][1]
(RegExp): Used to detect code to be evaluated.
-* * *
+---
### `_.templateSettings.imports`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L1549 "View in source") [Ⓣ][1]
+[#](#_templatesettingsimports) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L1606 "View in source") [Ⓣ][1]
(Object): Used to import variables into the compiled template.
-* * *
+---
### `_.templateSettings.interpolate`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L1533 "View in source") [Ⓣ][1]
+[#](#_templatesettingsinterpolate) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L1590 "View in source") [Ⓣ][1]
(RegExp): Used to detect `data` property values to inject.
-* * *
+---
### `_.templateSettings.variable`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L1541 "View in source") [Ⓣ][1]
+[#](#_templatesettingsvariable) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L1598 "View in source") [Ⓣ][1]
(string): Used to reference the data object in the template text.
-* * *
+---
@@ -10882,11 +10956,11 @@ alternative delimiters.
### `_.templateSettings.imports._`
-# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.1/lodash.js#L1557 "View in source") [Ⓣ][1]
+[#](#_templatesettingsimports_) [Ⓢ](https://github.com/lodash/lodash/blob/4.14.0/lodash.js#L1614 "View in source") [Ⓣ][1]
A reference to the `lodash` function.
-* * *
+---
diff --git a/fp/_baseConvert.js b/fp/_baseConvert.js
index e177cdd031..d294820d8c 100644
--- a/fp/_baseConvert.js
+++ b/fp/_baseConvert.js
@@ -71,11 +71,11 @@ function createCloner(func) {
* @param {Function} cloner The function to clone arguments.
* @returns {Function} Returns the new immutable function.
*/
-function immutWrap(func, cloner) {
+function wrapImmutable(func, cloner) {
return function() {
var length = arguments.length;
if (!length) {
- return result;
+ return;
}
var args = Array(length);
while (length--) {
@@ -209,6 +209,12 @@ function baseConvert(util, name, func, options) {
return func;
};
},
+ 'rearg': function(rearg) {
+ return function(func, indexes) {
+ var n = indexes ? indexes.length : 0;
+ return curry(rearg(func, indexes), n);
+ };
+ },
'runInContext': function(runInContext) {
return function(context) {
return baseConvert(util, runInContext(context), options);
@@ -218,6 +224,77 @@ function baseConvert(util, name, func, options) {
/*--------------------------------------------------------------------------*/
+ /**
+ * Casts `func` to a function with an arity capped iteratee if needed.
+ *
+ * @private
+ * @param {string} name The name of the function to inspect.
+ * @param {Function} func The function to inspect.
+ * @returns {Function} Returns the cast function.
+ */
+ function castCap(name, func) {
+ if (config.cap) {
+ var indexes = mapping.iterateeRearg[name];
+ if (indexes) {
+ return iterateeRearg(func, indexes);
+ }
+ var n = !isLib && mapping.iterateeAry[name];
+ if (n) {
+ return iterateeAry(func, n);
+ }
+ }
+ return func;
+ }
+
+ /**
+ * Casts `func` to a curried function if needed.
+ *
+ * @private
+ * @param {string} name The name of the function to inspect.
+ * @param {Function} func The function to inspect.
+ * @param {number} n The arity of `func`.
+ * @returns {Function} Returns the cast function.
+ */
+ function castCurry(name, func, n) {
+ return (forceCurry || (config.curry && n > 1))
+ ? curry(func, n)
+ : func;
+ }
+
+ /**
+ * Casts `func` to a fixed arity function if needed.
+ *
+ * @private
+ * @param {string} name The name of the function to inspect.
+ * @param {Function} func The function to inspect.
+ * @param {number} n The arity cap.
+ * @returns {Function} Returns the cast function.
+ */
+ function castFixed(name, func, n) {
+ if (config.fixed && (forceFixed || !mapping.skipFixed[name])) {
+ var data = mapping.methodSpread[name],
+ start = data && data.start;
+
+ return start === undefined ? ary(func, n) : spread(func, start);
+ }
+ return func;
+ }
+
+ /**
+ * Casts `func` to an rearged function if needed.
+ *
+ * @private
+ * @param {string} name The name of the function to inspect.
+ * @param {Function} func The function to inspect.
+ * @param {number} n The arity of `func`.
+ * @returns {Function} Returns the cast function.
+ */
+ function castRearg(name, func, n) {
+ return (config.rearg && n > 1 && (forceRearg || !mapping.skipRearg[name]))
+ ? rearg(func, mapping.methodRearg[name] || mapping.aryRearg[n])
+ : func;
+ }
+
/**
* Creates a clone of `object` by `path`.
*
@@ -310,12 +387,11 @@ function baseConvert(util, name, func, options) {
}
/**
- * Creates a function that invokes `func` with its first argument passed
- * thru `transform`.
+ * Creates a function that invokes `func` with its first argument transformed.
*
* @private
* @param {Function} func The function to wrap.
- * @param {...Function} transform The functions to transform the first argument.
+ * @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
@@ -355,42 +431,27 @@ function baseConvert(util, name, func, options) {
}
else if (config.immutable) {
if (mutateMap.array[name]) {
- wrapped = immutWrap(func, cloneArray);
+ wrapped = wrapImmutable(func, cloneArray);
}
else if (mutateMap.object[name]) {
- wrapped = immutWrap(func, createCloner(func));
+ wrapped = wrapImmutable(func, createCloner(func));
}
else if (mutateMap.set[name]) {
- wrapped = immutWrap(func, cloneByPath);
+ wrapped = wrapImmutable(func, cloneByPath);
}
}
each(aryMethodKeys, function(aryKey) {
each(mapping.aryMethod[aryKey], function(otherName) {
if (name == otherName) {
- var aryN = !isLib && mapping.iterateeAry[name],
- reargIndexes = mapping.iterateeRearg[name],
- spreadStart = mapping.methodSpread[name];
-
- result = wrapped;
- if (config.fixed && (forceFixed || !mapping.skipFixed[name])) {
- result = spreadStart === undefined
- ? ary(result, aryKey)
- : spread(result, spreadStart);
- }
- if (config.rearg && aryKey > 1 && (forceRearg || !mapping.skipRearg[name])) {
- result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[aryKey]);
- }
- if (config.cap) {
- if (reargIndexes) {
- result = iterateeRearg(result, reargIndexes);
- } else if (aryN) {
- result = iterateeAry(result, aryN);
- }
- }
- if (forceCurry || (config.curry && aryKey > 1)) {
- forceCurry && console.log(forceCurry, name);
- result = curry(result, aryKey);
- }
+ var spreadData = mapping.methodSpread[name],
+ afterRearg = spreadData && spreadData.afterRearg;
+
+ result = afterRearg
+ ? castFixed(name, castRearg(name, wrapped, aryKey), aryKey)
+ : castRearg(name, castFixed(name, wrapped, aryKey), aryKey);
+
+ result = castCap(name, result);
+ result = castCurry(name, result, aryKey);
return false;
}
});
diff --git a/fp/_mapping.js b/fp/_mapping.js
index a30c5dee41..cb36eedad1 100644
--- a/fp/_mapping.js
+++ b/fp/_mapping.js
@@ -7,11 +7,20 @@ exports.aliasToReal = {
'entries': 'toPairs',
'entriesIn': 'toPairsIn',
'extend': 'assignIn',
+ 'extendAll': 'assignInAll',
+ 'extendAllWith': 'assignInAllWith',
'extendWith': 'assignInWith',
'first': 'head',
+ // Methods that are curried variants of others.
+ 'conforms': 'conformsTo',
+ 'matches': 'isMatch',
+ 'property': 'get',
+
// Ramda aliases.
'__': 'placeholder',
+ 'F': 'stubFalse',
+ 'T': 'stubTrue',
'all': 'every',
'allPass': 'overEvery',
'always': 'constant',
@@ -25,8 +34,11 @@ exports.aliasToReal = {
'contains': 'includes',
'dissoc': 'unset',
'dissocPath': 'unset',
+ 'dropLast': 'dropRight',
+ 'dropLastWhile': 'dropRightWhile',
'equals': 'isEqual',
'identical': 'eq',
+ 'indexBy': 'keyBy',
'init': 'initial',
'invertObj': 'invert',
'juxt': 'over',
@@ -43,36 +55,44 @@ exports.aliasToReal = {
'propEq': 'matchesProperty',
'propOr': 'getOr',
'props': 'at',
+ 'symmetricDifference': 'xor',
+ 'symmetricDifferenceBy': 'xorBy',
+ 'symmetricDifferenceWith': 'xorWith',
+ 'takeLast': 'takeRight',
+ 'takeLastWhile': 'takeRightWhile',
'unapply': 'rest',
'unnest': 'flatten',
'useWith': 'overArgs',
- 'whereEq': 'filter',
+ 'where': 'conformsTo',
+ 'whereEq': 'isMatch',
'zipObj': 'zipObject'
};
/** Used to map ary to method names. */
exports.aryMethod = {
'1': [
- 'attempt', 'castArray', 'ceil', 'create', 'curry', 'curryRight', 'floor',
- 'flow', 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method',
- 'methodOf', 'mixin', 'over', 'overEvery', 'overSome', 'rest', 'reverse',
- 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart',
- 'uniqueId', 'words'
+ 'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create',
+ 'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow',
+ 'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method',
+ 'mergeAll', 'methodOf', 'mixin', 'over', 'overEvery', 'overSome', 'rest',
+ 'reverse', 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd',
+ 'trimStart', 'uniqueId', 'words', 'zipAll'
],
'2': [
- 'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindAll',
- 'bindKey', 'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
- 'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
- 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith',
- 'eq', 'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast',
- 'findLastIndex', 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth',
- 'forEach', 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight',
- 'get', 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf',
- 'intersection', 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch',
- 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues',
- 'matchesProperty', 'maxBy', 'meanBy', 'merge', 'minBy', 'multiply', 'nth',
- 'omit', 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
- 'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',
+ 'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith',
+ 'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith',
+ 'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN',
+ 'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference',
+ 'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq',
+ 'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
+ 'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', 'forEach',
+ 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', 'get',
+ 'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', 'intersection',
+ 'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy',
+ 'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues', 'matchesProperty',
+ 'maxBy', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit',
+ 'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial',
+ 'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
@@ -151,7 +171,9 @@ exports.iterateeRearg = {
/** Used to map method names to rearg configs. */
exports.methodRearg = {
+ 'assignInAllWith': [1, 2, 0],
'assignInWith': [1, 2, 0],
+ 'assignAllWith': [1, 2, 0],
'assignWith': [1, 2, 0],
'differenceBy': [1, 2, 0],
'differenceWith': [1, 2, 0],
@@ -160,6 +182,7 @@ exports.methodRearg = {
'intersectionWith': [1, 2, 0],
'isEqualWith': [1, 2, 0],
'isMatchWith': [2, 1, 0],
+ 'mergeAllWith': [1, 2, 0],
'mergeWith': [1, 2, 0],
'padChars': [2, 1, 0],
'padCharsEnd': [2, 1, 0],
@@ -179,11 +202,20 @@ exports.methodRearg = {
/** Used to map method names to spread configs. */
exports.methodSpread = {
- 'invokeArgs': 2,
- 'invokeArgsMap': 2,
- 'partial': 1,
- 'partialRight': 1,
- 'without': 1
+ 'assignAll': { 'start': 0 },
+ 'assignAllWith': { 'afterRearg': true, 'start': 1 },
+ 'assignInAll': { 'start': 0 },
+ 'assignInAllWith': { 'afterRearg': true, 'start': 1 },
+ 'defaultsAll': { 'start': 0 },
+ 'defaultsDeepAll': { 'start': 0 },
+ 'invokeArgs': { 'start': 2 },
+ 'invokeArgsMap': { 'start': 2 },
+ 'mergeAll': { 'start': 0 },
+ 'mergeAllWith': { 'afterRearg': true, 'start': 1 },
+ 'partial': { 'start': 1 },
+ 'partialRight': { 'start': 1 },
+ 'without': { 'start': 1 },
+ 'zipAll': { 'start': 0 }
};
/** Used to identify methods which mutate arrays or objects. */
@@ -200,13 +232,21 @@ exports.mutate = {
},
'object': {
'assign': true,
+ 'assignAll': true,
+ 'assignAllWith': true,
'assignIn': true,
+ 'assignInAll': true,
+ 'assignInAllWith': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
+ 'defaultsAll': true,
'defaultsDeep': true,
+ 'defaultsDeepAll': true,
'merge': true,
- 'mergeWith': true
+ 'mergeAll': true,
+ 'mergeAllWith': true,
+ 'mergeWith': true,
},
'set': {
'set': true,
@@ -246,8 +286,14 @@ exports.realToAlias = (function() {
/** Used to map method names to other names. */
exports.remap = {
+ 'assignAll': 'assign',
+ 'assignAllWith': 'assignWith',
+ 'assignInAll': 'assignIn',
+ 'assignInAllWith': 'assignInWith',
'curryN': 'curry',
'curryRightN': 'curryRight',
+ 'defaultsAll': 'defaults',
+ 'defaultsDeepAll': 'defaultsDeep',
'findFrom': 'find',
'findIndexFrom': 'findIndex',
'findLastFrom': 'findLast',
@@ -258,14 +304,18 @@ exports.remap = {
'invokeArgs': 'invoke',
'invokeArgsMap': 'invokeMap',
'lastIndexOfFrom': 'lastIndexOf',
+ 'mergeAll': 'merge',
+ 'mergeAllWith': 'mergeWith',
'padChars': 'pad',
'padCharsEnd': 'padEnd',
'padCharsStart': 'padStart',
+ 'propertyOf': 'get',
'restFrom': 'rest',
'spreadFrom': 'spread',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
- 'trimCharsStart': 'trimStart'
+ 'trimCharsStart': 'trimStart',
+ 'zipAll': 'zip'
};
/** Used to track methods that skip fixing their arity. */
@@ -275,6 +325,7 @@ exports.skipFixed = {
'flowRight': true,
'iteratee': true,
'mixin': true,
+ 'rearg': true,
'runInContext': true
};
@@ -300,10 +351,12 @@ exports.skipRearg = {
'overArgs': true,
'partial': true,
'partialRight': true,
+ 'propertyOf': true,
'random': true,
'range': true,
'rangeRight': true,
'subtract': true,
'zip': true,
- 'zipObject': true
+ 'zipObject': true,
+ 'zipObjectDeep': true
};
diff --git a/lib/common/file.js b/lib/common/file.js
index 9f9016fbe2..879e96c669 100644
--- a/lib/common/file.js
+++ b/lib/common/file.js
@@ -23,7 +23,7 @@ function copy(srcPath, destPath) {
}
/**
- * Creates an object of compiled template and base name pairs that match `pattern`.
+ * Creates an object of base name and compiled template pairs that match `pattern`.
*
* @memberOf file
* @param {string} pattern The glob pattern to be match.
diff --git a/lib/common/minify.js b/lib/common/minify.js
index 7a0082d3e2..5e536c2b51 100644
--- a/lib/common/minify.js
+++ b/lib/common/minify.js
@@ -13,8 +13,8 @@ var uglifyOptions = require('./uglify.options');
* invokes `callback` upon completion. The callback is invoked with one argument:
* (error).
*
- * If unspecified, `destPath` is `srcPath` with an extension of `.min.js`. For
- * example, a `srcPath` of `path/to/foo.js` would have a `destPath` of `path/to/foo.min.js`.
+ * If unspecified, `destPath` is `srcPath` with an extension of `.min.js`.
+ * (e.g. the `destPath` of `path/to/foo.js` would be `path/to/foo.min.js`)
*
* @param {string} srcPath The path of the file to minify.
* @param {string} [destPath] The path to write the file to.
diff --git a/lib/common/uglify.options.js b/lib/common/uglify.options.js
index af0ff436ab..64aebf6f53 100644
--- a/lib/common/uglify.options.js
+++ b/lib/common/uglify.options.js
@@ -8,16 +8,14 @@
*/
module.exports = {
'compress': {
+ 'negate_iife': false,
'pure_getters': true,
'unsafe': true,
'warnings': false
},
- 'mangle': {
- 'except': ['define']
- },
'output': {
'ascii_only': true,
- 'comments': /^!|@cc_on|@license|@preserve/i,
+ 'comments': /@license/,
'max_line_len': 500
}
};
diff --git a/lib/common/util.js b/lib/common/util.js
index 64451862d0..b7850ff4ce 100644
--- a/lib/common/util.js
+++ b/lib/common/util.js
@@ -6,10 +6,10 @@ var _ = require('lodash');
/**
* Creates a hash object. If a `properties` object is provided, its own
- * enumerable properties are assigned to the created object.
+ * enumerable properties are assigned to the created hash.
*
* @memberOf util
- * @param {Object} [properties] The properties to assign to the object.
+ * @param {Object} [properties] The properties to assign to the hash.
* @returns {Object} Returns the new hash object.
*/
function Hash(properties) {
@@ -22,6 +22,19 @@ function Hash(properties) {
Hash.prototype = Object.create(null);
+/**
+ * This method throws any error it receives.
+ *
+ * @memberOf util
+ * @param {Object} [error] The error object.
+ */
+function pitch(error) {
+ if (error != null) {
+ throw error;
+ }
+}
+
module.exports = {
- 'Hash': Hash
+ 'Hash': Hash,
+ 'pitch': pitch
};
diff --git a/lib/fp/build-dist.js b/lib/fp/build-dist.js
index bad62d2ebe..6c68c99233 100644
--- a/lib/fp/build-dist.js
+++ b/lib/fp/build-dist.js
@@ -5,7 +5,8 @@ var _ = require('lodash'),
path = require('path'),
webpack = require('webpack');
-var file = require('../common/file');
+var file = require('../common/file'),
+ util = require('../common/util');
var basePath = path.join(__dirname, '..', '..'),
distPath = path.join(basePath, 'dist'),
@@ -38,18 +39,17 @@ var mappingConfig = {
/*----------------------------------------------------------------------------*/
-function onComplete(error) {
- if (error) {
- throw error;
- }
-}
-
+/**
+ * Creates browser builds of the FP converter and mappings at the `target` path.
+ *
+ * @param {string} target The output directory path.
+ */
function build() {
async.series([
_.partial(webpack, mappingConfig),
_.partial(webpack, fpConfig),
file.min(path.join(distPath, filename))
- ], onComplete);
+ ], util.pitch);
}
build();
diff --git a/lib/fp/build-doc.js b/lib/fp/build-doc.js
index 02800bcfd5..ff151ecd85 100644
--- a/lib/fp/build-doc.js
+++ b/lib/fp/build-doc.js
@@ -5,7 +5,8 @@ var _ = require('lodash'),
path = require('path');
var file = require('../common/file'),
- mapping = require('../common/mapping');
+ mapping = require('../common/mapping'),
+ util = require('../common/util');
var templatePath = path.join(__dirname, 'template/doc'),
template = file.globTemplate(path.join(templatePath, '*.jst'));
@@ -18,16 +19,29 @@ var templateData = {
'toFuncList': toFuncList
};
-function toArgOrder(array) {
+/**
+ * Converts arranged argument `indexes` into a named argument string
+ * representation of their order.
+ *
+ * @param {number[]} indexes The arranged argument indexes.
+ * @returns {string} Returns the named argument string.
+ */
+function toArgOrder(indexes) {
var reordered = [];
- _.each(array, function(newIndex, index) {
+ _.each(indexes, function(newIndex, index) {
reordered[newIndex] = argNames[index];
});
return '`(' + reordered.join(', ') + ')`';
}
-function toFuncList(array) {
- var chunks = _.chunk(array.slice().sort(), 5),
+/**
+ * Converts `funcNames` into a chunked list string representation.
+ *
+ * @param {string[]} funcNames The function names.
+ * @returns {string} Returns the function list string.
+ */
+function toFuncList(funcNames) {
+ var chunks = _.chunk(funcNames.slice().sort(), 5),
lastChunk = _.last(chunks),
last = lastChunk ? lastChunk.pop() : undefined;
@@ -51,15 +65,14 @@ function toFuncList(array) {
/*----------------------------------------------------------------------------*/
-function onComplete(error) {
- if (error) {
- throw error;
- }
-}
-
+/**
+ * Creates the FP-Guide wiki at the `target` path.
+ *
+ * @param {string} target The output file path.
+ */
function build(target) {
target = path.resolve(target);
- fs.writeFile(target, template.wiki(templateData), onComplete);
+ fs.writeFile(target, template.wiki(templateData), util.pitch);
}
build(_.last(process.argv));
diff --git a/lib/fp/build-modules.js b/lib/fp/build-modules.js
index 43902e01c6..82b379c5e9 100644
--- a/lib/fp/build-modules.js
+++ b/lib/fp/build-modules.js
@@ -6,7 +6,8 @@ var _ = require('lodash'),
path = require('path');
var file = require('../common/file'),
- mapping = require('../common/mapping');
+ mapping = require('../common/mapping'),
+ util = require('../common/util');
var templatePath = path.join(__dirname, 'template/modules'),
template = file.globTemplate(path.join(templatePath, '*.jst'));
@@ -42,21 +43,47 @@ var ignored = [
'lodash.min.js'
];
-function isAlias(funcName) {
- return _.has(mapping.aliasToReal, funcName);
+/**
+ * Checks if `name` is a method alias.
+ *
+ * @param {string} name The name to check.
+ * @returns {boolean} Returns `true` if `name` is a method alias, else `false`.
+ */
+function isAlias(name) {
+ return _.has(mapping.aliasToReal, name);
}
-function isCategory(funcName) {
- return _.includes(categories, funcName);
+/**
+ * Checks if `name` is a category name.
+ *
+ * @param {string} name The name to check.
+ * @returns {boolean} Returns `true` if `name` is a category name, else `false`.
+ */
+function isCategory(name) {
+ return _.includes(categories, name);
}
-function isThru(funcName) {
- return !_.includes(aryMethods, funcName);
+/**
+ * Checks if `name` belongs to a method that's passed thru and not wrapped.
+ *
+ * @param {string} name The name to check.
+ * @returns {boolean} Returns `true` if `name` is of a pass thru method,
+ * else `false`.
+ */
+function isThru(name) {
+ return !_.includes(aryMethods, name);
}
+/**
+ * Gets metadata for `func`.
+ *
+ * @private
+ * @param {Function} func The function to query.
+ * @returns {*} Returns the metadata for `func`.
+ */
function getTemplate(moduleName) {
var data = {
- 'name': _.result(mapping.aliasToReal, moduleName, moduleName),
+ 'name': _.get(mapping.aliasToReal, moduleName, moduleName),
'mapping': mapping
};
@@ -74,12 +101,11 @@ function getTemplate(moduleName) {
/*----------------------------------------------------------------------------*/
-function onComplete(error) {
- if (error) {
- throw error;
- }
-}
-
+/**
+ * Creates FP modules at the `target` path.
+ *
+ * @param {string} target The output directory path.
+ */
function build(target) {
target = path.resolve(target);
@@ -114,7 +140,7 @@ function build(target) {
actions.push(file.write(path.join(target, 'fp.js'), template.fp()));
actions.push(file.write(path.join(fpPath, 'convert.js'), template.convert()));
- async.series(actions, onComplete);
+ async.series(actions, util.pitch);
}
build(_.last(process.argv));
diff --git a/lib/fp/template/doc/wiki.jst b/lib/fp/template/doc/wiki.jst
index 7a429ab178..fbe51e08be 100644
--- a/lib/fp/template/doc/wiki.jst
+++ b/lib/fp/template/doc/wiki.jst
@@ -14,15 +14,15 @@ In a browser:
```
@@ -51,12 +51,12 @@ Iteratee arguments are capped to avoid gotchas with variadic iteratees.
// The `lodash/map` iteratee receives three arguments:
// (value, index|key, collection)
_.map(['6', '8', '10'], parseInt);
-// → [6, NaN, 2]
+// ➜ [6, NaN, 2]
// The `lodash/fp/map` iteratee is capped at one argument:
// (value)
fp.map(parseInt)(['6', '8', '10']);
-// → [6, 8, 10]
+// ➜ [6, 8, 10]
```
Methods that cap iteratees to one argument:
@@ -73,13 +73,13 @@ Methods have fixed arities to support auto-currying.
```js
// `lodash/padStart` accepts an optional `chars` param.
_.padStart('a', 3, '-')
-// → '--a'
+// ➜ '--a'
// `lodash/fp/padStart` does not.
fp.padStart(3)('a');
-// → ' a'
+// ➜ ' a'
fp.padCharsStart('-')(3)('a');
-// → '--a'
+// ➜ '--a'
```
Methods with a fixed arity of one:
@@ -102,13 +102,13 @@ Method arguments are rearranged to make composition easier.
// (collection, iteratee)
var compact = _.partial(_.filter, _, Boolean);
compact(['a', null, 'c']);
-// → ['a', 'c']
+// ➜ ['a', 'c']
// `lodash/fp/filter` is iteratee-first data-last:
// (iteratee, collection)
var compact = fp.filter(Boolean);
compact(['a', null, 'c']);
-// → ['a', 'c']
+// ➜ ['a', 'c']
```
##### Most methods follow these rules
@@ -124,7 +124,7 @@ A fixed arity of four has an argument order of:
##### Exceptions to the rules
-Methods that accept an array of arguments as their second parameter:
+Methods that accept an array of arguments:
<%= toFuncList(_.keys(mapping.methodSpread)) %>
Methods with unchanged argument orders:
@@ -161,11 +161,11 @@ arguments of the curried returned function.
```js
// The equivalent of `2 > 5`.
_.gt(2)(5);
-// → false
+// ➜ false
// The equivalent of `_.gt(5, 2)` or `5 > 2`.
_.gt(_, 2)(5);
-// → true
+// ➜ true
```
## Chaining
diff --git a/lib/fp/template/modules/module.jst b/lib/fp/template/modules/module.jst
index 289bd2b63c..1fb809cb22 100644
--- a/lib/fp/template/modules/module.jst
+++ b/lib/fp/template/modules/module.jst
@@ -1,5 +1,5 @@
var convert = require('./convert'),
- func = convert('<%= name %>', require('../<%= _.result(mapping.remap, name, name) %>'));
+ func = convert('<%= name %>', require('../<%= _.get(mapping.remap, name, name) %>'));
func.placeholder = require('./placeholder');
module.exports = func;
diff --git a/lib/fp/template/modules/thru.jst b/lib/fp/template/modules/thru.jst
index 5bc1a7b03f..838e8b03a8 100644
--- a/lib/fp/template/modules/thru.jst
+++ b/lib/fp/template/modules/thru.jst
@@ -1,5 +1,5 @@
var convert = require('./convert'),
- func = convert('<%= name %>', require('../<%= _.result(mapping.remap, name, name) %>'), require('./_falseOptions'));
+ func = convert('<%= name %>', require('../<%= _.get(mapping.remap, name, name) %>'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
diff --git a/lib/main/build-dist.js b/lib/main/build-dist.js
index 14b3fd3ce9..b91f1474c2 100644
--- a/lib/main/build-dist.js
+++ b/lib/main/build-dist.js
@@ -3,7 +3,8 @@
var async = require('async'),
path = require('path');
-var file = require('../common/file');
+var file = require('../common/file'),
+ util = require('../common/util');
var basePath = path.join(__dirname, '..', '..'),
distPath = path.join(basePath, 'dist'),
@@ -14,17 +15,16 @@ var baseLodash = path.join(basePath, filename),
/*----------------------------------------------------------------------------*/
-function onComplete(error) {
- if (error) {
- throw error;
- }
-}
-
+/**
+ * Creates browser builds of Lodash at the `target` path.
+ *
+ * @param {string} target The output directory path.
+ */
function build() {
async.series([
file.copy(baseLodash, distLodash),
file.min(distLodash)
- ], onComplete);
+ ], util.pitch);
}
build();
diff --git a/lib/main/build-doc.js b/lib/main/build-doc.js
index 6c5f22b577..95dca8eef3 100644
--- a/lib/main/build-doc.js
+++ b/lib/main/build-doc.js
@@ -5,6 +5,8 @@ var _ = require('lodash'),
fs = require('fs-extra'),
path = require('path');
+var util = require('../common/util');
+
var basePath = path.join(__dirname, '..', '..'),
docPath = path.join(basePath, 'doc'),
readmePath = path.join(docPath, 'README.md');
@@ -16,10 +18,11 @@ var config = {
'base': {
'entryLinks': [
'<% if (name == "templateSettings" || !/^(?:methods|properties|seq)$/i.test(category)) {' +
- 'print("[Ⓝ](https://www.npmjs.com/package/lodash." + name.toLowerCase() + " \\"See the npm package\\")")' +
+ 'print("[npm package](https://www.npmjs.com/package/lodash." + name.toLowerCase() + ")")' +
'} %>'
],
'path': path.join(basePath, 'lodash.js'),
+ 'sourceLink': '[source](${sourceHref})',
'title': 'lodashv' + version + '',
'toc': 'categories',
'url': 'https://github.com/lodash/lodash/blob/' + version + '/lodash.js'
@@ -28,28 +31,33 @@ var config = {
'hash': 'github'
},
'site': {
- 'tocLink': '#docs'
+ 'tocHref': '#docs'
}
};
-function postprocess(string) {
+/**
+ * Post-process `markdown` to make adjustments.
+ *
+ * @param {string} markdown The markdown to process.
+ * @returns {string} Returns the processed markdown.
+ */
+function postprocess(markdown) {
// Wrap symbol property identifiers in brackets.
- return string.replace(/\.(Symbol\.(?:[a-z]+[A-Z]?)+)/g, '[$1]');
+ return markdown.replace(/\.(Symbol\.(?:[a-z]+[A-Z]?)+)/g, '[$1]');
}
/*----------------------------------------------------------------------------*/
-function onComplete(error) {
- if (error) {
- throw error;
- }
-}
-
+/**
+ * Creates the documentation markdown formatted for 'github' or 'site'.
+ *
+ * @param {string} type The format type.
+ */
function build(type) {
var options = _.defaults({}, config.base, config[type]),
markdown = docdown(options);
- fs.writeFile(readmePath, postprocess(markdown), onComplete);
+ fs.writeFile(readmePath, postprocess(markdown), util.pitch);
}
build(_.last(process.argv));
diff --git a/lib/main/build-modules.js b/lib/main/build-modules.js
index 5d89e0dc2e..284b3ae231 100644
--- a/lib/main/build-modules.js
+++ b/lib/main/build-modules.js
@@ -4,7 +4,8 @@ var _ = require('lodash'),
async = require('async'),
path = require('path');
-var file = require('../common/file');
+var file = require('../common/file'),
+ util = require('../common/util');
var basePath = path.join(__dirname, '..', '..'),
distPath = path.join(basePath, 'dist');
@@ -17,18 +18,17 @@ var filePairs = [
/*----------------------------------------------------------------------------*/
-function onComplete(error) {
- if (error) {
- throw error;
- }
-}
-
+/**
+ * Creates supplementary Lodash modules at the `target` path.
+ *
+ * @param {string} target The output directory path.
+ */
function build(target) {
var actions = _.map(filePairs, function(pair) {
return file.copy(pair[0], path.join(target, pair[1]));
});
- async.series(actions, onComplete);
+ async.series(actions, util.pitch);
}
build(_.last(process.argv));
diff --git a/lib/main/build-site.js b/lib/main/build-site.js
new file mode 100644
index 0000000000..70d524bbaf
--- /dev/null
+++ b/lib/main/build-site.js
@@ -0,0 +1,54 @@
+'use strict';
+
+var _ = require('lodash'),
+ fs = require('fs'),
+ marky = require('marky-markdown'),
+ path = require('path'),
+ util = require('../common/util');
+
+var basePath = path.join(__dirname, '..', '..'),
+ docPath = path.join(basePath, 'doc'),
+ readmePath = path.join(docPath, 'README.md');
+
+function build(type) {
+ // Load markdown and uncomment docdown HTML hints.
+ var markdown = fs
+ .readFileSync(readmePath, 'utf8')
+ .replace(/(<)!--\s*|\s*--(>)/g, '$1$2');
+
+ var $ = marky(markdown, { 'sanitize': false }),
+ $header = $('h1').first().remove(),
+ version = _.trim($header.find('span').first().text()).slice(1);
+
+ // Remove docdown horizontal rules.
+ $('hr').remove();
+
+ // Remove table of contents (toc) links.
+ $('a[href="#docs"]').remove();
+
+ // Remove marky-markdown additions.
+ $('[id^="user-content-"]')
+ .attr('class', null)
+ .attr('id', null);
+
+ $(':header > a[href]').each(function() {
+ var $a = $(this);
+ $a.replaceWith($a.html());
+ });
+
+ // Append YAML front matter.
+ var html = [
+ '---',
+ 'id: docs',
+ 'layout: docs',
+ 'title: Lodash Documentation',
+ 'version: ' + (version || null),
+ '---',
+ '',
+ _.trim($.html()),
+ ].join('\n');
+
+ fs.writeFile(path.join(docPath, version + '.html'), html, util.pitch);
+}
+
+build();
diff --git a/lodash.js b/lodash.js
index 5b5c703ba0..8dd4672991 100644
--- a/lodash.js
+++ b/lodash.js
@@ -12,7 +12,7 @@
var undefined;
/** Used as the semantic version number. */
- var VERSION = '4.13.1';
+ var VERSION = '4.14.0';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
@@ -26,7 +26,7 @@
/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
- /** Used to compose bitmasks for wrapper metadata. */
+ /** Used to compose bitmasks for function metadata. */
var BIND_FLAG = 1,
BIND_KEY_FLAG = 2,
CURRY_BOUND_FLAG = 4,
@@ -66,6 +66,19 @@
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
+ /** Used to associate wrap methods with their bit flags. */
+ var wrapFlags = [
+ ['ary', ARY_FLAG],
+ ['bind', BIND_FLAG],
+ ['bindKey', BIND_KEY_FLAG],
+ ['curry', CURRY_FLAG],
+ ['curryRight', CURRY_RIGHT_FLAG],
+ ['flip', FLIP_FLAG],
+ ['partial', PARTIAL_FLAG],
+ ['partialRight', PARTIAL_RIGHT_FLAG],
+ ['rearg', REARG_FLAG]
+ ];
+
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
@@ -130,6 +143,11 @@
reTrimStart = /^\s+/,
reTrimEnd = /\s+$/;
+ /** Used to match wrap detail comments. */
+ var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
+ reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
+ reSplitDetails = /,? & /;
+
/** Used to match non-compound words composed of alphanumeric characters. */
var reBasicWord = /[a-zA-Z0-9]+/g;
@@ -249,7 +267,7 @@
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError',
'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
- '_', 'isFinite', 'parseInt', 'setTimeout'
+ '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
];
/** Used to make template sourceURLs easier to identify. */
@@ -342,8 +360,17 @@
var freeParseFloat = parseFloat,
freeParseInt = parseInt;
+ /** Detect free variable `global` from Node.js. */
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
+
+ /** Detect free variable `self`. */
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
+
+ /** Used as a reference to the global object. */
+ var root = freeGlobal || freeSelf || Function('return this')();
+
/** Detect free variable `exports`. */
- var freeExports = typeof exports == 'object' && exports;
+ var freeExports = freeGlobal && typeof exports == 'object' && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module;
@@ -351,17 +378,23 @@
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = checkGlobal(typeof global == 'object' && global);
+ /** Detect free variable `process` from Node.js. */
+ var freeProcess = moduleExports && freeGlobal.process;
- /** Detect free variable `self`. */
- var freeSelf = checkGlobal(typeof self == 'object' && self);
+ /** Used to access faster Node.js helpers. */
+ var nodeUtil = (function() {
+ try {
+ return freeProcess && freeProcess.binding('util');
+ } catch (e) {}
+ }());
- /** Detect `this` as the global object. */
- var thisGlobal = checkGlobal(typeof this == 'object' && this);
-
- /** Used as a reference to the global object. */
- var root = freeGlobal || freeSelf || thisGlobal || Function('return this')();
+ /* Node.js helper references. */
+ var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
+ nodeIsDate = nodeUtil && nodeUtil.isDate,
+ nodeIsMap = nodeUtil && nodeUtil.isMap,
+ nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
+ nodeIsSet = nodeUtil && nodeUtil.isSet,
+ nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/*--------------------------------------------------------------------------*/
@@ -374,7 +407,7 @@
* @returns {Object} Returns `map`.
*/
function addMapEntry(map, pair) {
- // Don't return `Map#set` because it doesn't return the map instance in IE 11.
+ // Don't return `map.set` because it's not chainable in IE 11.
map.set(pair[0], pair[1]);
return map;
}
@@ -388,6 +421,7 @@
* @returns {Object} Returns `set`.
*/
function addSetEntry(set, value) {
+ // Don't return `set.add` because it's not chainable in IE 11.
set.add(value);
return set;
}
@@ -403,8 +437,7 @@
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
- var length = args.length;
- switch (length) {
+ switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
@@ -721,7 +754,7 @@
*/
function baseIndexOf(array, value, fromIndex) {
if (value !== value) {
- return indexOfNaN(array, fromIndex);
+ return baseFindIndex(array, baseIsNaN, fromIndex);
}
var index = fromIndex - 1,
length = array.length;
@@ -756,6 +789,17 @@
return -1;
}
+ /**
+ * The base implementation of `_.isNaN` without support for number objects.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
+ */
+ function baseIsNaN(value) {
+ return value !== value;
+ }
+
/**
* The base implementation of `_.mean` and `_.meanBy` without support for
* iteratee shorthands.
@@ -770,6 +814,32 @@
return length ? (baseSum(array, iteratee) / length) : NAN;
}
+ /**
+ * The base implementation of `_.property` without support for deep paths.
+ *
+ * @private
+ * @param {string} key The key of the property to get.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function baseProperty(key) {
+ return function(object) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
+ /**
+ * The base implementation of `_.propertyOf` without support for deep paths.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Function} Returns the new accessor function.
+ */
+ function basePropertyOf(object) {
+ return function(key) {
+ return object == null ? undefined : object[key];
+ };
+ }
+
/**
* The base implementation of `_.reduce` and `_.reduceRight`, without support
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
@@ -870,7 +940,7 @@
}
/**
- * The base implementation of `_.unary` without support for storing wrapper metadata.
+ * The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
@@ -943,17 +1013,6 @@
return index;
}
- /**
- * Checks if `value` is a global object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {null|Object} Returns `value` if it's a global object, else `null`.
- */
- function checkGlobal(value) {
- return (value && value.Object === Object) ? value : null;
- }
-
/**
* Gets the number of `placeholder` occurrences in `array`.
*
@@ -981,9 +1040,7 @@
* @param {string} letter The matched letter to deburr.
* @returns {string} Returns the deburred letter.
*/
- function deburrLetter(letter) {
- return deburredLetters[letter];
- }
+ var deburrLetter = basePropertyOf(deburredLetters);
/**
* Used by `_.escape` to convert characters to HTML entities.
@@ -992,9 +1049,7 @@
* @param {string} chr The matched character to escape.
* @returns {string} Returns the escaped character.
*/
- function escapeHtmlChar(chr) {
- return htmlEscapes[chr];
- }
+ var escapeHtmlChar = basePropertyOf(htmlEscapes);
/**
* Used by `_.template` to escape characters for inclusion in compiled string literals.
@@ -1019,28 +1074,6 @@
return object == null ? undefined : object[key];
}
- /**
- * Gets the index at which the first occurrence of `NaN` is found in `array`.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched `NaN`, else `-1`.
- */
- function indexOfNaN(array, fromIndex, fromRight) {
- var length = array.length,
- index = fromIndex + (fromRight ? 1 : -1);
-
- while ((fromRight ? index-- : ++index < length)) {
- var other = array[index];
- if (other !== other) {
- return index;
- }
- }
- return -1;
- }
-
/**
* Checks if `value` is a host object in IE < 9.
*
@@ -1094,6 +1127,20 @@
return result;
}
+ /**
+ * Creates a function that invokes `func` with its first argument transformed.
+ *
+ * @private
+ * @param {Function} func The function to wrap.
+ * @param {Function} transform The argument transform.
+ * @returns {Function} Returns the new function.
+ */
+ function overArg(func, transform) {
+ return function(arg) {
+ return func(transform(arg));
+ };
+ }
+
/**
* Replaces all `placeholder` elements in `array` with an internal placeholder
* and returns an array of their indexes.
@@ -1189,9 +1236,7 @@
* @param {string} chr The matched character to unescape.
* @returns {string} Returns the unescaped character.
*/
- function unescapeHtmlChar(chr) {
- return htmlUnescapes[chr];
- }
+ var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
/*--------------------------------------------------------------------------*/
@@ -1235,7 +1280,8 @@
context = context ? _.defaults({}, context, _.pick(root, contextProps)) : root;
/** Built-in constructor references. */
- var Date = context.Date,
+ var Array = context.Array,
+ Date = context.Date,
Error = context.Error,
Math = context.Math,
RegExp = context.RegExp,
@@ -1289,19 +1335,22 @@
Symbol = context.Symbol,
Uint8Array = context.Uint8Array,
enumerate = Reflect ? Reflect.enumerate : undefined,
- getOwnPropertySymbols = Object.getOwnPropertySymbols,
- iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined,
- objectCreate = Object.create,
+ iteratorSymbol = Symbol ? Symbol.iterator : undefined,
+ objectCreate = context.Object.create,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
- splice = arrayProto.splice;
+ splice = arrayProto.splice,
+ spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
/** Built-in method references that are mockable. */
- var setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); };
+ var clearTimeout = function(id) { return context.clearTimeout.call(root, id); },
+ setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); };
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil,
nativeFloor = Math.floor,
nativeGetPrototype = Object.getPrototypeOf,
+ nativeGetSymbols = Object.getOwnPropertySymbols,
+ nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeIsFinite = context.isFinite,
nativeJoin = arrayProto.join,
nativeKeys = Object.keys,
@@ -1319,7 +1368,15 @@
Promise = getNative(context, 'Promise'),
Set = getNative(context, 'Set'),
WeakMap = getNative(context, 'WeakMap'),
- nativeCreate = getNative(Object, 'create');
+ nativeCreate = getNative(context.Object, 'create');
+
+ /* Used to set `toString` methods. */
+ var defineProperty = (function() {
+ var func = getNative(context.Object, 'defineProperty'),
+ name = getNative.name;
+
+ return (name && name.length > 2) ? func : undefined;
+ }());
/** Used to store function metadata. */
var metaMap = WeakMap && new WeakMap;
@@ -1410,16 +1467,16 @@
*
* The wrapper methods that are **not** chainable by default are:
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
- * `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`,
+ * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
+ * `defaultTo`, `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`,
@@ -2122,8 +2179,13 @@
*/
function stackSet(key, value) {
var cache = this.__data__;
- if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) {
- cache = this.__data__ = new MapCache(cache.__data__);
+ if (cache instanceof ListCache) {
+ var pairs = cache.__data__;
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
+ pairs.push([key, value]);
+ return this;
+ }
+ cache = this.__data__ = new MapCache(pairs);
}
cache.set(key, value);
return this;
@@ -2260,7 +2322,7 @@
}
/**
- * The base implementation of `_.clamp` which doesn't coerce arguments to numbers.
+ * The base implementation of `_.clamp` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to clamp.
@@ -2344,14 +2406,17 @@
if (!isArr) {
var props = isFull ? getAllKeys(value) : keys(value);
}
- // Recursively populate clone (susceptible to call stack limits).
arrayEach(props || value, function(subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
+ // Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
});
+ if (!isFull) {
+ stack['delete'](value);
+ }
return result;
}
@@ -2363,26 +2428,37 @@
* @returns {Function} Returns the new spec function.
*/
function baseConforms(source) {
- var props = keys(source),
- length = props.length;
-
+ var props = keys(source);
return function(object) {
- if (object == null) {
- return !length;
- }
- var index = length;
- while (index--) {
- var key = props[index],
- predicate = source[key],
- value = object[key];
+ return baseConformsTo(object, source, props);
+ };
+ }
- if ((value === undefined &&
- !(key in Object(object))) || !predicate(value)) {
- return false;
- }
+ /**
+ * The base implementation of `_.conformsTo` which accepts `props` to check.
+ *
+ * @private
+ * @param {Object} object The object to inspect.
+ * @param {Object} source The object of property predicates to conform to.
+ * @returns {boolean} Returns `true` if `object` conforms, else `false`.
+ */
+ function baseConformsTo(object, source, props) {
+ var length = props.length;
+ if (object == null) {
+ return !length;
+ }
+ var index = length;
+ while (index--) {
+ var key = props[index],
+ predicate = source[key],
+ value = object[key];
+
+ if ((value === undefined &&
+ !(key in Object(object))) || !predicate(value)) {
+ return false;
}
- return true;
- };
+ }
+ return true;
}
/**
@@ -2398,13 +2474,13 @@
}
/**
- * The base implementation of `_.delay` and `_.defer` which accepts an array
- * of `func` arguments.
+ * The base implementation of `_.delay` and `_.defer` which accepts `args`
+ * to provide to `func`.
*
* @private
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
- * @param {Object} args The arguments to provide to `func`.
+ * @param {Array} args The arguments to provide to `func`.
* @returns {number} Returns the timer id.
*/
function baseDelay(func, wait, args) {
@@ -2718,7 +2794,18 @@
}
/**
- * The base implementation of `_.gt` which doesn't coerce arguments to numbers.
+ * The base implementation of `getTag`.
+ *
+ * @private
+ * @param {*} value The value to query.
+ * @returns {string} Returns the `toStringTag`.
+ */
+ function baseGetTag(value) {
+ return objectToString.call(value);
+ }
+
+ /**
+ * The base implementation of `_.gt` which doesn't coerce arguments.
*
* @private
* @param {*} value The value to compare.
@@ -2760,7 +2847,7 @@
}
/**
- * The base implementation of `_.inRange` which doesn't coerce arguments to numbers.
+ * The base implementation of `_.inRange` which doesn't coerce arguments.
*
* @private
* @param {number} number The number to check.
@@ -2873,6 +2960,28 @@
return func == null ? undefined : apply(func, object, args);
}
+ /**
+ * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
+ */
+ function baseIsArrayBuffer(value) {
+ return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
+ }
+
+ /**
+ * The base implementation of `_.isDate` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
+ */
+ function baseIsDate(value) {
+ return isObjectLike(value) && objectToString.call(value) == dateTag;
+ }
+
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
@@ -2956,6 +3065,17 @@
return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
}
+ /**
+ * The base implementation of `_.isMap` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a map, else `false`.
+ */
+ function baseIsMap(value) {
+ return isObjectLike(value) && getTag(value) == mapTag;
+ }
+
/**
* The base implementation of `_.isMatch` without support for iteratee shorthands.
*
@@ -3026,6 +3146,40 @@
return pattern.test(toSource(value));
}
+ /**
+ * The base implementation of `_.isRegExp` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
+ */
+ function baseIsRegExp(value) {
+ return isObject(value) && objectToString.call(value) == regexpTag;
+ }
+
+ /**
+ * The base implementation of `_.isSet` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a set, else `false`.
+ */
+ function baseIsSet(value) {
+ return isObjectLike(value) && getTag(value) == setTag;
+ }
+
+ /**
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
+ */
+ function baseIsTypedArray(value) {
+ return isObjectLike(value) &&
+ isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
+ }
+
/**
* The base implementation of `_.iteratee`.
*
@@ -3058,9 +3212,7 @@
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
- function baseKeys(object) {
- return nativeKeys(Object(object));
- }
+ var baseKeys = overArg(nativeKeys, Object);
/**
* The base implementation of `_.keysIn` which doesn't skip the constructor
@@ -3088,7 +3240,7 @@
}
/**
- * The base implementation of `_.lt` which doesn't coerce arguments to numbers.
+ * The base implementation of `_.lt` which doesn't coerce arguments.
*
* @private
* @param {*} value The value to compare.
@@ -3255,18 +3407,17 @@
isCommon = false;
}
}
- stack.set(srcValue, newValue);
-
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
+ stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
+ stack['delete'](srcValue);
}
- stack['delete'](srcValue);
assignMergeValue(object, key, newValue);
}
/**
- * The base implementation of `_.nth` which doesn't coerce `n` to an integer.
+ * The base implementation of `_.nth` which doesn't coerce arguments.
*
* @private
* @param {Array} array The array to query.
@@ -3318,12 +3469,9 @@
*/
function basePick(object, props) {
object = Object(object);
- return arrayReduce(props, function(result, key) {
- if (key in object) {
- result[key] = object[key];
- }
- return result;
- }, {});
+ return basePickBy(object, props, function(value, key) {
+ return key in object;
+ });
}
/**
@@ -3331,12 +3479,12 @@
*
* @private
* @param {Object} object The source object.
+ * @param {string[]} props The property identifiers to pick from.
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
- function basePickBy(object, predicate) {
+ function basePickBy(object, props, predicate) {
var index = -1,
- props = getAllKeysIn(object),
length = props.length,
result = {};
@@ -3351,19 +3499,6 @@
return result;
}
- /**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new accessor function.
- */
- function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
- }
-
/**
* A specialized version of `baseProperty` which supports deep paths.
*
@@ -3466,7 +3601,7 @@
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
- * coerce arguments to numbers.
+ * coerce arguments.
*
* @private
* @param {number} start The start of the range.
@@ -3515,6 +3650,35 @@
return result;
}
+ /**
+ * The base implementation of `_.rest` which doesn't validate or coerce arguments.
+ *
+ * @private
+ * @param {Function} func The function to apply a rest parameter to.
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
+ * @returns {Function} Returns the new function.
+ */
+ function baseRest(func, start) {
+ start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
+ return function() {
+ var args = arguments,
+ index = -1,
+ length = nativeMax(args.length - start, 0),
+ array = Array(length);
+
+ while (++index < length) {
+ array[index] = args[start + index];
+ }
+ index = -1;
+ var otherArgs = Array(start + 1);
+ while (++index < start) {
+ otherArgs[index] = args[index];
+ }
+ otherArgs[start] = array;
+ return apply(func, this, otherArgs);
+ };
+ }
+
/**
* The base implementation of `_.set`.
*
@@ -4294,9 +4458,9 @@
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
- : source[key];
+ : undefined;
- assignValue(object, key, newValue);
+ assignValue(object, key, newValue === undefined ? source[key] : newValue);
}
return object;
}
@@ -4326,7 +4490,7 @@
var func = isArray(collection) ? arrayAggregator : baseAggregator,
accumulator = initializer ? initializer() : {};
- return func(collection, setter, getIteratee(iteratee), accumulator);
+ return func(collection, setter, getIteratee(iteratee, 2), accumulator);
};
}
@@ -4338,7 +4502,7 @@
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
- return rest(function(object, sources) {
+ return baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,
@@ -4422,14 +4586,13 @@
*
* @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 flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createBaseWrapper(func, bitmask, thisArg) {
+ function createBind(func, bitmask, thisArg) {
var isBind = bitmask & BIND_FLAG,
- Ctor = createCtorWrapper(func);
+ Ctor = createCtor(func);
function wrapper() {
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
@@ -4486,7 +4649,7 @@
* @param {Function} Ctor The constructor to wrap.
* @returns {Function} Returns the new wrapped function.
*/
- function createCtorWrapper(Ctor) {
+ function createCtor(Ctor) {
return function() {
// Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
@@ -4516,13 +4679,12 @@
*
* @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 flags. See `createWrap` for more details.
* @param {number} arity The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createCurryWrapper(func, bitmask, arity) {
- var Ctor = createCtorWrapper(func);
+ function createCurry(func, bitmask, arity) {
+ var Ctor = createCtor(func);
function wrapper() {
var length = arguments.length,
@@ -4539,8 +4701,8 @@
length -= holders.length;
if (length < arity) {
- return createRecurryWrapper(
- func, bitmask, createHybridWrapper, wrapper.placeholder, undefined,
+ return createRecurry(
+ func, bitmask, createHybrid, wrapper.placeholder, undefined,
args, holders, undefined, undefined, arity - length);
}
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
@@ -4559,18 +4721,13 @@
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object(collection);
- predicate = getIteratee(predicate, 3);
if (!isArrayLike(collection)) {
- var props = keys(collection);
+ var iteratee = getIteratee(predicate, 3);
+ collection = keys(collection);
+ predicate = function(key) { return iteratee(iterable[key], key, iterable); };
}
- var index = findIndexFunc(props || collection, function(value, key) {
- if (props) {
- key = value;
- value = iterable[key];
- }
- return predicate(value, key, iterable);
- }, fromIndex);
- return index > -1 ? collection[props ? props[index] : index] : undefined;
+ var index = findIndexFunc(collection, predicate, fromIndex);
+ return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
};
}
@@ -4582,7 +4739,7 @@
* @returns {Function} Returns the new flow function.
*/
function createFlow(fromRight) {
- return rest(function(funcs) {
+ return baseRest(function(funcs) {
funcs = baseFlatten(funcs, 1);
var length = funcs.length,
@@ -4644,8 +4801,7 @@
*
* @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 flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
@@ -4658,13 +4814,13 @@
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
+ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & ARY_FLAG,
isBind = bitmask & BIND_FLAG,
isBindKey = bitmask & BIND_KEY_FLAG,
isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG),
isFlip = bitmask & FLIP_FLAG,
- Ctor = isBindKey ? undefined : createCtorWrapper(func);
+ Ctor = isBindKey ? undefined : createCtor(func);
function wrapper() {
var length = arguments.length,
@@ -4687,8 +4843,8 @@
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
- return createRecurryWrapper(
- func, bitmask, createHybridWrapper, wrapper.placeholder, thisArg,
+ return createRecurry(
+ func, bitmask, createHybrid, wrapper.placeholder, thisArg,
args, newHolders, argPos, ary, arity - length
);
}
@@ -4705,7 +4861,7 @@
args.length = ary;
}
if (this && this !== root && this instanceof wrapper) {
- fn = Ctor || createCtorWrapper(fn);
+ fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
}
@@ -4731,13 +4887,14 @@
*
* @private
* @param {Function} operator The function to perform the operation.
+ * @param {number} [defaultValue] The value used for `undefined` arguments.
* @returns {Function} Returns the new mathematical operation function.
*/
- function createMathOperation(operator) {
+ function createMathOperation(operator, defaultValue) {
return function(value, other) {
var result;
if (value === undefined && other === undefined) {
- return 0;
+ return defaultValue;
}
if (value !== undefined) {
result = value;
@@ -4767,12 +4924,12 @@
* @returns {Function} Returns the new over function.
*/
function createOver(arrayFunc) {
- return rest(function(iteratees) {
+ return baseRest(function(iteratees) {
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
? arrayMap(iteratees[0], baseUnary(getIteratee()))
- : arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseUnary(getIteratee()));
+ : arrayMap(baseFlatten(iteratees, 1), baseUnary(getIteratee()));
- return rest(function(args) {
+ return baseRest(function(args) {
var thisArg = this;
return arrayFunc(iteratees, function(iteratee) {
return apply(iteratee, thisArg, args);
@@ -4809,16 +4966,15 @@
*
* @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 flags. See `createWrap` for more details.
* @param {*} thisArg The `this` binding of `func`.
* @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) {
+ function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & BIND_FLAG,
- Ctor = createCtorWrapper(func);
+ Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1,
@@ -4887,8 +5043,7 @@
*
* @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 flags. See `createWrap` 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`.
@@ -4900,7 +5055,7 @@
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
+ function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
var isCurry = bitmask & CURRY_FLAG,
newHolders = isCurry ? holders : undefined,
newHoldersRight = isCurry ? undefined : holders,
@@ -4923,7 +5078,7 @@
setData(result, newData);
}
result.placeholder = placeholder;
- return result;
+ return setWrapToString(result, func, bitmask);
}
/**
@@ -4952,7 +5107,7 @@
}
/**
- * Creates a set of `values`.
+ * Creates a set object of `values`.
*
* @private
* @param {Array} values The values to add to the set.
@@ -4988,7 +5143,7 @@
*
* @private
* @param {Function|string} func The function or method name to wrap.
- * @param {number} bitmask The bitmask of wrapper flags.
+ * @param {number} bitmask The bitmask flags.
* The bitmask may be composed of the following flags:
* 1 - `_.bind`
* 2 - `_.bindKey`
@@ -5008,7 +5163,7 @@
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
- function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
+ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
var isBindKey = bitmask & BIND_KEY_FLAG;
if (!isBindKey && typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
@@ -5051,16 +5206,16 @@
bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG);
}
if (!bitmask || bitmask == BIND_FLAG) {
- var result = createBaseWrapper(func, bitmask, thisArg);
+ var result = createBind(func, bitmask, thisArg);
} else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) {
- result = createCurryWrapper(func, bitmask, arity);
+ result = createCurry(func, bitmask, arity);
} else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) {
- result = createPartialWrapper(func, bitmask, thisArg, partials);
+ result = createPartial(func, bitmask, thisArg, partials);
} else {
- result = createHybridWrapper.apply(undefined, newData);
+ result = createHybrid.apply(undefined, newData);
}
var setter = data ? baseSetData : setData;
- return setter(result, newData);
+ return setWrapToString(setter(result, newData), func, bitmask);
}
/**
@@ -5087,7 +5242,7 @@
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
- if (stacked) {
+ if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
@@ -5095,6 +5250,7 @@
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
stack.set(array, other);
+ stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
@@ -5173,18 +5329,14 @@
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.
- return +object == +other;
+ case numberTag:
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
+ // Invalid dates are coerced to `NaN`.
+ return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
- case numberTag:
- // Treat `NaN` vs. `NaN` as equal.
- return (object != +object) ? other != +other : object == +other;
-
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
@@ -5208,10 +5360,12 @@
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, stack);
+ stack.set(object, other);
+ var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
+ stack['delete'](object);
+ return result;
case symbolTag:
if (symbolValueOf) {
@@ -5254,11 +5408,12 @@
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
- if (stacked) {
+ if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
+ stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
@@ -5450,9 +5605,7 @@
* @param {*} value The value to query.
* @returns {null|Object} Returns the `[[Prototype]]`.
*/
- function getPrototype(value) {
- return nativeGetPrototype(Object(value));
- }
+ var getPrototype = overArg(nativeGetPrototype, Object);
/**
* Creates an array of the own enumerable symbol properties of `object`.
@@ -5461,16 +5614,7 @@
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
- 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 = stubArray;
- }
+ var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
/**
* Creates an array of the own and inherited enumerable symbol properties
@@ -5480,7 +5624,7 @@
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
- var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) {
+ var getSymbolsIn = !nativeGetSymbols ? getSymbols : function(object) {
var result = [];
while (object) {
arrayPush(result, getSymbols(object));
@@ -5496,9 +5640,7 @@
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
- function getTag(value) {
- return objectToString.call(value);
- }
+ var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11,
// for data views in Edge, and promises in Node.js.
@@ -5553,6 +5695,18 @@
return { 'start': start, 'end': end };
}
+ /**
+ * Extracts wrapper details from the `source` body comment.
+ *
+ * @private
+ * @param {string} source The source to inspect.
+ * @returns {Array} Returns the wrapper details.
+ */
+ function getWrapDetails(source) {
+ var match = source.match(reWrapDetails);
+ return match ? match[1].split(reSplitDetails) : [];
+ }
+
/**
* Checks if `path` exists on `object`.
*
@@ -5683,26 +5837,32 @@
}
/**
- * Checks if `value` is a flattenable `arguments` object or array.
+ * Inserts wrapper `details` in a comment at the top of the `source` body.
*
* @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
+ * @param {string} source The source to modify.
+ * @returns {Array} details The details to insert.
+ * @returns {string} Returns the modified source.
*/
- function isFlattenable(value) {
- return isArray(value) || isArguments(value);
+ function insertWrapDetails(source, details) {
+ var length = details.length,
+ lastIndex = length - 1;
+
+ details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
+ details = details.join(length > 2 ? ', ' : ' ');
+ return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
}
/**
- * Checks if `value` is a flattenable array and not a `_.matchesProperty`
- * iteratee shorthand.
+ * Checks if `value` is a flattenable `arguments` object or array.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
- function isFlattenableIteratee(value) {
- return isArray(value) && !(value.length == 2 && !isFunction(value[0]));
+ function isFlattenable(value) {
+ return isArray(value) || isArguments(value) ||
+ !!(spreadableSymbol && value && value[spreadableSymbol])
}
/**
@@ -5952,7 +6112,10 @@
*/
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) {
- baseMerge(objValue, srcValue, undefined, mergeDefaults, stack.set(srcValue, objValue));
+ // Recursively merge objects and arrays (susceptible to call stack limits).
+ stack.set(srcValue, objValue);
+ baseMerge(objValue, srcValue, undefined, mergeDefaults, stack);
+ stack['delete'](srcValue);
}
return objValue;
}
@@ -6025,6 +6188,25 @@
};
}());
+ /**
+ * Sets the `toString` method of `wrapper` to mimic the source of `reference`
+ * with wrapper details in a comment at the top of the source body.
+ *
+ * @private
+ * @param {Function} wrapper The function to modify.
+ * @param {Function} reference The reference function.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @returns {Function} Returns `wrapper`.
+ */
+ var setWrapToString = !defineProperty ? identity : function(wrapper, reference, bitmask) {
+ var source = (reference + '');
+ return defineProperty(wrapper, 'toString', {
+ 'configurable': true,
+ 'enumerable': false,
+ 'value': constant(insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)))
+ });
+ };
+
/**
* Converts `string` to a property path array.
*
@@ -6074,6 +6256,24 @@
return '';
}
+ /**
+ * Updates wrapper `details` based on `bitmask` flags.
+ *
+ * @private
+ * @returns {Array} details The details to modify.
+ * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
+ * @returns {Array} Returns `details`.
+ */
+ function updateWrapDetails(details, bitmask) {
+ arrayEach(wrapFlags, function(pair) {
+ var value = '_.' + pair[0];
+ if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
+ details.push(value);
+ }
+ });
+ return details.sort();
+ }
+
/**
* Creates a clone of `wrapper`.
*
@@ -6202,11 +6402,13 @@
}
/**
- * 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 `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.
*
+ * **Note:** Unlike `_.pullAll`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 0.1.0
@@ -6220,7 +6422,7 @@
* _.difference([2, 1], [2, 3]);
* // => [1]
*/
- var difference = rest(function(array, values) {
+ var difference = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
: [];
@@ -6232,14 +6434,15 @@
* by which they're compared. Result values are chosen from the first array.
* The iteratee is invoked with one argument: (value).
*
+ * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The values to exclude.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
*
@@ -6250,13 +6453,13 @@
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
* // => [{ 'x': 2 }]
*/
- var differenceBy = rest(function(array, values) {
+ var differenceBy = baseRest(function(array, values) {
var iteratee = last(values);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
return isArrayLikeObject(array)
- ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee))
+ ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
: [];
});
@@ -6266,6 +6469,8 @@
* are chosen from the first array. The comparator is invoked with two arguments:
* (arrVal, othVal).
*
+ * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 4.0.0
@@ -6281,7 +6486,7 @@
* _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
* // => [{ 'x': 2, 'y': 1 }]
*/
- var differenceWith = rest(function(array, values) {
+ var differenceWith = baseRest(function(array, values) {
var comparator = last(values);
if (isArrayLikeObject(comparator)) {
comparator = undefined;
@@ -6370,8 +6575,7 @@
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
@@ -6412,7 +6616,7 @@
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
@@ -6494,7 +6698,7 @@
* @since 1.1.0
* @category Array
* @param {Array} array The array to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
@@ -6542,7 +6746,7 @@
* @since 2.0.0
* @category Array
* @param {Array} array The array to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=array.length-1] The index to search from.
* @returns {number} Returns the index of the found element, else `-1`.
@@ -6663,8 +6867,8 @@
* @returns {Object} Returns the new object.
* @example
*
- * _.fromPairs([['fred', 30], ['barney', 40]]);
- * // => { 'fred': 30, 'barney': 40 }
+ * _.fromPairs([['a', 1], ['b', 2]]);
+ * // => { 'a': 1, 'b': 2 }
*/
function fromPairs(pairs) {
var index = -1,
@@ -6770,7 +6974,7 @@
* _.intersection([2, 1], [2, 3]);
* // => [2]
*/
- var intersection = rest(function(arrays) {
+ var intersection = baseRest(function(arrays) {
var mapped = arrayMap(arrays, castArrayLikeObject);
return (mapped.length && mapped[0] === arrays[0])
? baseIntersection(mapped)
@@ -6788,8 +6992,7 @@
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of intersecting values.
* @example
*
@@ -6800,7 +7003,7 @@
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 1 }]
*/
- var intersectionBy = rest(function(arrays) {
+ var intersectionBy = baseRest(function(arrays) {
var iteratee = last(arrays),
mapped = arrayMap(arrays, castArrayLikeObject);
@@ -6810,7 +7013,7 @@
mapped.pop();
}
return (mapped.length && mapped[0] === arrays[0])
- ? baseIntersection(mapped, getIteratee(iteratee))
+ ? baseIntersection(mapped, getIteratee(iteratee, 2))
: [];
});
@@ -6835,7 +7038,7 @@
* _.intersectionWith(objects, others, _.isEqual);
* // => [{ 'x': 1, 'y': 2 }]
*/
- var intersectionWith = rest(function(arrays) {
+ var intersectionWith = baseRest(function(arrays) {
var comparator = last(arrays),
mapped = arrayMap(arrays, castArrayLikeObject);
@@ -6923,7 +7126,7 @@
) + 1;
}
if (value !== value) {
- return indexOfNaN(array, index - 1, true);
+ return baseFindIndex(array, baseIsNaN, index - 1, true);
}
while (index--) {
if (array[index] === value) {
@@ -6981,7 +7184,7 @@
* console.log(array);
* // => ['b', 'b']
*/
- var pull = rest(pullAll);
+ var pull = baseRest(pullAll);
/**
* This method is like `_.pull` except that it accepts an array of values to remove.
@@ -7022,7 +7225,7 @@
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {Array} Returns `array`.
* @example
@@ -7035,7 +7238,7 @@
*/
function pullAllBy(array, values, iteratee) {
return (array && array.length && values && values.length)
- ? basePullAll(array, values, getIteratee(iteratee))
+ ? basePullAll(array, values, getIteratee(iteratee, 2))
: array;
}
@@ -7092,7 +7295,7 @@
* console.log(pulled);
* // => ['b', 'd']
*/
- var pullAt = rest(function(array, indexes) {
+ var pullAt = baseRest(function(array, indexes) {
indexes = baseFlatten(indexes, 1);
var length = array ? array.length : 0,
@@ -7118,7 +7321,7 @@
* @since 2.0.0
* @category Array
* @param {Array} array The array to modify.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the new array of removed elements.
* @example
@@ -7246,7 +7449,7 @@
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
@@ -7262,7 +7465,7 @@
* // => 0
*/
function sortedIndexBy(array, value, iteratee) {
- return baseSortedIndexBy(array, value, getIteratee(iteratee));
+ return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
}
/**
@@ -7325,7 +7528,7 @@
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
@@ -7341,7 +7544,7 @@
* // => 1
*/
function sortedLastIndexBy(array, value, iteratee) {
- return baseSortedIndexBy(array, value, getIteratee(iteratee), true);
+ return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
}
/**
@@ -7410,7 +7613,7 @@
*/
function sortedUniqBy(array, iteratee) {
return (array && array.length)
- ? baseSortedUniq(array, getIteratee(iteratee))
+ ? baseSortedUniq(array, getIteratee(iteratee, 2))
: [];
}
@@ -7510,7 +7713,7 @@
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
@@ -7552,7 +7755,7 @@
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
@@ -7600,14 +7803,15 @@
* _.union([2], [1, 2]);
* // => [2, 1]
*/
- var union = rest(function(arrays) {
+ var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
/**
* 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:
+ * which uniqueness is computed. Result values are chosen from the first
+ * array in which the value occurs. The iteratee is invoked with one argument:
* (value).
*
* @static
@@ -7615,7 +7819,7 @@
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {Array} Returns the new array of combined values.
* @example
@@ -7627,17 +7831,18 @@
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 1 }, { 'x': 2 }]
*/
- var unionBy = rest(function(arrays) {
+ var unionBy = baseRest(function(arrays) {
var iteratee = last(arrays);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
- return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee));
+ return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
});
/**
* This method is like `_.union` except that it accepts `comparator` which
- * is invoked to compare elements of `arrays`. The comparator is invoked
+ * is invoked to compare elements of `arrays`. Result values are chosen from
+ * the first array in which the value occurs. The comparator is invoked
* with two arguments: (arrVal, othVal).
*
* @static
@@ -7655,7 +7860,7 @@
* _.unionWith(objects, others, _.isEqual);
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
*/
- var unionWith = rest(function(arrays) {
+ var unionWith = baseRest(function(arrays) {
var comparator = last(arrays);
if (isArrayLikeObject(comparator)) {
comparator = undefined;
@@ -7696,7 +7901,7 @@
* @since 4.0.0
* @category Array
* @param {Array} array The array to inspect.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {Array} Returns the new duplicate free array.
* @example
@@ -7710,7 +7915,7 @@
*/
function uniqBy(array, iteratee) {
return (array && array.length)
- ? baseUniq(array, getIteratee(iteratee))
+ ? baseUniq(array, getIteratee(iteratee, 2))
: [];
}
@@ -7752,11 +7957,11 @@
* @returns {Array} Returns the new array of regrouped elements.
* @example
*
- * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
- * // => [['fred', 30, true], ['barney', 40, false]]
+ * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
+ * // => [['a', 1, true], ['b', 2, false]]
*
* _.unzip(zipped);
- * // => [['fred', 'barney'], [30, 40], [true, false]]
+ * // => [['a', 'b'], [1, 2], [true, false]]
*/
function unzip(array) {
if (!(array && array.length)) {
@@ -7813,6 +8018,8 @@
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* for equality comparisons.
*
+ * **Note:** Unlike `_.pull`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 0.1.0
@@ -7826,7 +8033,7 @@
* _.without([2, 1, 2, 3], 1, 2);
* // => [3]
*/
- var without = rest(function(array, values) {
+ var without = baseRest(function(array, values) {
return isArrayLikeObject(array)
? baseDifference(array, values)
: [];
@@ -7850,7 +8057,7 @@
* _.xor([2, 1], [2, 3]);
* // => [1, 3]
*/
- var xor = rest(function(arrays) {
+ var xor = baseRest(function(arrays) {
return baseXor(arrayFilter(arrays, isArrayLikeObject));
});
@@ -7865,7 +8072,7 @@
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee invoked per element.
* @returns {Array} Returns the new array of filtered values.
* @example
@@ -7877,12 +8084,12 @@
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 2 }]
*/
- var xorBy = rest(function(arrays) {
+ var xorBy = baseRest(function(arrays) {
var iteratee = last(arrays);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
- return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee));
+ return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
});
/**
@@ -7905,7 +8112,7 @@
* _.xorWith(objects, others, _.isEqual);
* // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
*/
- var xorWith = rest(function(arrays) {
+ var xorWith = baseRest(function(arrays) {
var comparator = last(arrays);
if (isArrayLikeObject(comparator)) {
comparator = undefined;
@@ -7926,10 +8133,10 @@
* @returns {Array} Returns the new array of grouped elements.
* @example
*
- * _.zip(['fred', 'barney'], [30, 40], [true, false]);
- * // => [['fred', 30, true], ['barney', 40, false]]
+ * _.zip(['a', 'b'], [1, 2], [true, false]);
+ * // => [['a', 1, true], ['b', 2, false]]
*/
- var zip = rest(unzip);
+ var zip = baseRest(unzip);
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
@@ -7989,7 +8196,7 @@
* });
* // => [111, 222]
*/
- var zipWith = rest(function(arrays) {
+ var zipWith = baseRest(function(arrays) {
var length = arrays.length,
iteratee = length > 1 ? arrays[length - 1] : undefined;
@@ -8105,7 +8312,7 @@
* _(object).at(['a[0].b.c', 'a[1]']).value();
* // => [3, 4]
*/
- var wrapperAt = rest(function(paths) {
+ var wrapperAt = baseRest(function(paths) {
paths = baseFlatten(paths, 1);
var length = paths.length,
start = length ? paths[0] : 0,
@@ -8358,7 +8565,7 @@
* @since 0.5.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
@@ -8384,7 +8591,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [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,
@@ -8424,12 +8631,14 @@
* `predicate` returns truthy for. The predicate is invoked with three
* arguments: (value, index|key, collection).
*
+ * **Note:** Unlike `_.remove`, this method returns a new array.
+ *
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.reject
@@ -8470,7 +8679,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=0] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
@@ -8508,7 +8717,7 @@
* @since 2.0.0
* @category Collection
* @param {Array|Object} collection The collection to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
+ * @param {Function} [predicate=_.identity]
* The function invoked per iteration.
* @param {number} [fromIndex=collection.length-1] The index to search from.
* @returns {*} Returns the matched element, else `undefined`.
@@ -8531,7 +8740,7 @@
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
@@ -8556,7 +8765,7 @@
* @since 4.7.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The function invoked per iteration.
* @returns {Array} Returns the new flattened array.
* @example
@@ -8581,7 +8790,7 @@
* @since 4.7.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The function invoked per iteration.
* @param {number} [depth=1] The maximum recursion depth.
* @returns {Array} Returns the new flattened array.
@@ -8671,7 +8880,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
@@ -8715,10 +8924,10 @@
* _.includes([1, 2, 3], 1, 2);
* // => false
*
- * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
+ * _.includes({ 'a': 1, 'b': 2 }, 1);
* // => true
*
- * _.includes('pebbles', 'eb');
+ * _.includes('abcd', 'bc');
* // => true
*/
function includes(collection, value, fromIndex, guard) {
@@ -8737,8 +8946,8 @@
/**
* Invokes the method at `path` of each element in `collection`, returning
* an array of the results of each invoked method. Any additional arguments
- * are provided to each invoked method. If `methodName` is a function, it's
- * invoked for and `this` bound to, each element in `collection`.
+ * are provided to each invoked method. If `path` is a function, it's invoked
+ * for, and `this` bound to, each element in `collection`.
*
* @static
* @memberOf _
@@ -8757,7 +8966,7 @@
* _.invokeMap([123, 456], String.prototype.split, '');
* // => [['1', '2', '3'], ['4', '5', '6']]
*/
- var invokeMap = rest(function(collection, path, args) {
+ var invokeMap = baseRest(function(collection, path, args) {
var index = -1,
isFunc = typeof path == 'function',
isProp = isKey(path),
@@ -8781,7 +8990,7 @@
* @since 4.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * @param {Function} [iteratee=_.identity]
* The iteratee to transform keys.
* @returns {Object} Returns the composed aggregate object.
* @example
@@ -8822,8 +9031,7 @@
* @since 0.1.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 {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
* @example
*
@@ -8905,8 +9113,7 @@
* @since 3.0.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the array of grouped elements.
* @example
*
@@ -9017,8 +9224,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
* @see _.filter
* @example
@@ -9045,10 +9251,7 @@
*/
function reject(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
- predicate = getIteratee(predicate, 3);
- return func(collection, function(value, index, collection) {
- return !predicate(value, index, collection);
- });
+ return func(collection, negate(getIteratee(predicate, 3)));
}
/**
@@ -9181,8 +9384,7 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [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`.
@@ -9227,8 +9429,8 @@
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [iteratees=[_.identity]] The iteratees to sort by.
+ * @param {...(Function|Function[])} [iteratees=[_.identity]]
+ * The iteratees to sort by.
* @returns {Array} Returns the new sorted array.
* @example
*
@@ -9250,7 +9452,7 @@
* });
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*/
- var sortBy = rest(function(collection, iteratees) {
+ var sortBy = baseRest(function(collection, iteratees) {
if (collection == null) {
return [];
}
@@ -9260,11 +9462,7 @@
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
iteratees = [iteratees[0]];
}
- iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
- ? iteratees[0]
- : baseFlatten(iteratees, 1, isFlattenableIteratee);
-
- return baseOrderBy(collection, iteratees, []);
+ return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
});
/*------------------------------------------------------------------------*/
@@ -9347,7 +9545,7 @@
function ary(func, n, guard) {
n = guard ? undefined : n;
n = (func && n == null) ? func.length : n;
- return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
+ return createWrap(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);
}
/**
@@ -9365,7 +9563,7 @@
* @example
*
* jQuery(element).on('click', _.before(5, addContactToList));
- * // => allows adding up to 4 contacts to the list
+ * // => Allows adding up to 4 contacts to the list.
*/
function before(n, func) {
var result;
@@ -9404,9 +9602,9 @@
* @returns {Function} Returns the new bound function.
* @example
*
- * var greet = function(greeting, punctuation) {
+ * function greet(greeting, punctuation) {
* return greeting + ' ' + this.user + punctuation;
- * };
+ * }
*
* var object = { 'user': 'fred' };
*
@@ -9419,13 +9617,13 @@
* bound('hi');
* // => 'hi fred!'
*/
- var bind = rest(function(func, thisArg, partials) {
+ var bind = baseRest(function(func, thisArg, partials) {
var bitmask = BIND_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bind));
bitmask |= PARTIAL_FLAG;
}
- return createWrapper(func, bitmask, thisArg, partials, holders);
+ return createWrap(func, bitmask, thisArg, partials, holders);
});
/**
@@ -9473,13 +9671,13 @@
* bound('hi');
* // => 'hiya fred!'
*/
- var bindKey = rest(function(object, key, partials) {
+ var bindKey = baseRest(function(object, key, partials) {
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= PARTIAL_FLAG;
}
- return createWrapper(key, bitmask, object, partials, holders);
+ return createWrap(key, bitmask, object, partials, holders);
});
/**
@@ -9525,7 +9723,7 @@
*/
function curry(func, arity, guard) {
arity = guard ? undefined : arity;
- var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
+ var result = createWrap(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curry.placeholder;
return result;
}
@@ -9570,7 +9768,7 @@
*/
function curryRight(func, arity, guard) {
arity = guard ? undefined : arity;
- var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
+ var result = createWrap(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curryRight.placeholder;
return result;
}
@@ -9708,6 +9906,9 @@
}
function cancel() {
+ if (timerId !== undefined) {
+ clearTimeout(timerId);
+ }
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined;
}
@@ -9762,7 +9963,7 @@
* }, 'deferred');
* // => Logs 'deferred' after one or more milliseconds.
*/
- var defer = rest(function(func, args) {
+ var defer = baseRest(function(func, args) {
return baseDelay(func, 1, args);
});
@@ -9785,7 +9986,7 @@
* }, 1000, 'later');
* // => Logs 'later' after one second.
*/
- var delay = rest(function(func, wait, args) {
+ var delay = baseRest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
});
@@ -9808,7 +10009,7 @@
* // => ['d', 'c', 'b', 'a']
*/
function flip(func) {
- return createWrapper(func, FLIP_FLAG);
+ return createWrap(func, FLIP_FLAG);
}
/**
@@ -9903,7 +10104,14 @@
throw new TypeError(FUNC_ERROR_TEXT);
}
return function() {
- return !predicate.apply(this, arguments);
+ var args = arguments;
+ switch (args.length) {
+ case 0: return !predicate.call(this);
+ case 1: return !predicate.call(this, args[0]);
+ case 2: return !predicate.call(this, args[0], args[1]);
+ case 3: return !predicate.call(this, args[0], args[1], args[2]);
+ }
+ return !predicate.apply(this, args);
};
}
@@ -9923,23 +10131,22 @@
* var initialize = _.once(createApplication);
* initialize();
* initialize();
- * // `initialize` invokes `createApplication` once
+ * // => `createApplication` is invoked once
*/
function once(func) {
return before(2, func);
}
/**
- * Creates a function that invokes `func` with arguments transformed by
- * corresponding `transforms`.
+ * Creates a function that invokes `func` with its arguments transformed.
*
* @static
* @since 4.0.0
* @memberOf _
* @category Function
* @param {Function} func The function to wrap.
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [transforms[_.identity]] The functions to transform.
+ * @param {...(Function|Function[])} [transforms=[_.identity]]
+ * The argument transforms.
* @returns {Function} Returns the new function.
* @example
*
@@ -9961,13 +10168,13 @@
* func(10, 5);
* // => [100, 10]
*/
- var overArgs = rest(function(func, transforms) {
+ var overArgs = baseRest(function(func, transforms) {
transforms = (transforms.length == 1 && isArray(transforms[0]))
? arrayMap(transforms[0], baseUnary(getIteratee()))
- : arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseUnary(getIteratee()));
+ : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
var funcsLength = transforms.length;
- return rest(function(args) {
+ return baseRest(function(args) {
var index = -1,
length = nativeMin(args.length, funcsLength);
@@ -9998,9 +10205,9 @@
* @returns {Function} Returns the new partially applied function.
* @example
*
- * var greet = function(greeting, name) {
+ * function greet(greeting, name) {
* return greeting + ' ' + name;
- * };
+ * }
*
* var sayHelloTo = _.partial(greet, 'hello');
* sayHelloTo('fred');
@@ -10011,9 +10218,9 @@
* greetFred('hi');
* // => 'hi fred'
*/
- var partial = rest(function(func, partials) {
+ var partial = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partial));
- return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);
+ return createWrap(func, PARTIAL_FLAG, undefined, partials, holders);
});
/**
@@ -10035,9 +10242,9 @@
* @returns {Function} Returns the new partially applied function.
* @example
*
- * var greet = function(greeting, name) {
+ * function greet(greeting, name) {
* return greeting + ' ' + name;
- * };
+ * }
*
* var greetFred = _.partialRight(greet, 'fred');
* greetFred('hi');
@@ -10048,9 +10255,9 @@
* sayHelloTo('fred');
* // => 'hello fred'
*/
- var partialRight = rest(function(func, partials) {
+ var partialRight = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partialRight));
- return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
+ return createWrap(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
});
/**
@@ -10075,8 +10282,8 @@
* rearged('b', 'c', 'a')
* // => ['a', 'b', 'c']
*/
- var rearg = rest(function(func, indexes) {
- return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1));
+ var rearg = baseRest(function(func, indexes) {
+ return createWrap(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes, 1));
});
/**
@@ -10108,29 +10315,8 @@
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
- start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);
- return function() {
- var args = arguments,
- index = -1,
- length = nativeMax(args.length - start, 0),
- array = Array(length);
-
- while (++index < length) {
- array[index] = args[start + index];
- }
- switch (start) {
- case 0: return func.call(this, array);
- case 1: return func.call(this, args[0], array);
- case 2: return func.call(this, args[0], args[1], array);
- }
- var otherArgs = Array(start + 1);
- index = -1;
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = array;
- return apply(func, this, otherArgs);
- };
+ start = start === undefined ? start : toInteger(start);
+ return baseRest(func, start);
}
/**
@@ -10172,7 +10358,7 @@
throw new TypeError(FUNC_ERROR_TEXT);
}
start = start === undefined ? 0 : nativeMax(toInteger(start), 0);
- return rest(function(args) {
+ return baseRest(function(args) {
var array = args[start],
otherArgs = castSlice(args, 0, start);
@@ -10262,10 +10448,10 @@
}
/**
- * Creates a function that provides `value` to the wrapper function as its
- * first argument. Any additional arguments provided to the function are
- * appended to those provided to the wrapper function. The wrapper is invoked
- * with the `this` binding of the created function.
+ * Creates a function that provides `value` to `wrapper` as its first
+ * argument. Any additional arguments provided to the function are appended
+ * to those provided to the `wrapper`. The wrapper is invoked with the `this`
+ * binding of the created function.
*
* @static
* @memberOf _
@@ -10450,6 +10636,32 @@
return baseClone(value, true, true, customizer);
}
+ /**
+ * Checks if `object` conforms to `source` by invoking the predicate properties
+ * of `source` with the corresponding property values of `object`. This method
+ * is equivalent to a `_.conforms` function when `source` is partially applied.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.14.0
+ * @category Lang
+ * @param {Object} object The object to inspect.
+ * @param {Object} source The object of property predicates to conform to.
+ * @returns {boolean} Returns `true` if `object` conforms, else `false`.
+ * @example
+ *
+ * var object = { 'a': 1, 'b': 2 };
+ *
+ * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
+ * // => true
+ *
+ * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
+ * // => false
+ */
+ function conformsTo(object, source) {
+ return source == null || baseConformsTo(object, source, keys(source));
+ }
+
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -10464,8 +10676,8 @@
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
- * var object = { 'user': 'fred' };
- * var other = { 'user': 'fred' };
+ * var object = { 'a': 1 };
+ * var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
@@ -10546,7 +10758,7 @@
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified,
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
@@ -10568,11 +10780,9 @@
* @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 an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
@@ -10597,8 +10807,7 @@
* @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 an array buffer, else `false`.
* @example
*
* _.isArrayBuffer(new ArrayBuffer(2));
@@ -10607,9 +10816,7 @@
* _.isArrayBuffer(new Array(2));
* // => false
*/
- function isArrayBuffer(value) {
- return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
- }
+ var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
@@ -10677,8 +10884,7 @@
* @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 a boolean, else `false`.
* @example
*
* _.isBoolean(false);
@@ -10709,9 +10915,7 @@
* _.isBuffer(new Uint8Array(2));
* // => false
*/
- var isBuffer = !Buffer ? stubFalse : function(value) {
- return value instanceof Buffer;
- };
+ var isBuffer = nativeIsBuffer || stubFalse;
/**
* Checks if `value` is classified as a `Date` object.
@@ -10721,8 +10925,7 @@
* @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 a date object, else `false`.
* @example
*
* _.isDate(new Date);
@@ -10731,9 +10934,7 @@
* _.isDate('Mon April 23 2012');
* // => false
*/
- function isDate(value) {
- return isObjectLike(value) && objectToString.call(value) == dateTag;
- }
+ var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
/**
* Checks if `value` is likely a DOM element.
@@ -10830,8 +11031,8 @@
* else `false`.
* @example
*
- * var object = { 'user': 'fred' };
- * var other = { 'user': 'fred' };
+ * var object = { 'a': 1 };
+ * var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
@@ -10948,8 +11149,7 @@
* @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 a function, else `false`.
* @example
*
* _.isFunction(_);
@@ -11094,8 +11294,7 @@
* @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 a map, else `false`.
* @example
*
* _.isMap(new Map);
@@ -11104,9 +11303,7 @@
* _.isMap(new WeakMap);
* // => false
*/
- function isMap(value) {
- return isObjectLike(value) && getTag(value) == mapTag;
- }
+ var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
/**
* Performs a partial deep comparison between `object` and `source` to
@@ -11124,12 +11321,12 @@
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
* @example
*
- * var object = { 'user': 'fred', 'age': 40 };
+ * var object = { 'a': 1, 'b': 2 };
*
- * _.isMatch(object, { 'age': 40 });
+ * _.isMatch(object, { 'b': 2 });
* // => true
*
- * _.isMatch(object, { 'age': 36 });
+ * _.isMatch(object, { 'b': 1 });
* // => false
*/
function isMatch(object, source) {
@@ -11211,13 +11408,13 @@
/**
* Checks if `value` is a pristine native function.
*
- * **Note:** This method can't reliably detect native functions in the
- * presence of the `core-js` package because `core-js` circumvents this kind
- * of detection. Despite multiple requests, the `core-js` maintainer has made
- * it clear: any attempt to fix the detection will be obstructed. As a result,
- * we're left with little choice but to throw an error. Unfortunately, this
- * also affects packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
- * which rely on `core-js`.
+ * **Note:** This method can't reliably detect native functions in the presence
+ * of the core-js package because core-js circumvents this kind of detection.
+ * Despite multiple requests, the core-js maintainer has made it clear: any
+ * attempt to fix the detection will be obstructed. As a result, we're left
+ * with little choice but to throw an error. Unfortunately, this also affects
+ * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
+ * which rely on core-js.
*
* @static
* @memberOf _
@@ -11236,7 +11433,7 @@
*/
function isNative(value) {
if (isMaskable(value)) {
- throw new Error('This method is not supported with `core-js`. Try https://github.com/es-shims.');
+ throw new Error('This method is not supported with core-js. Try https://github.com/es-shims.');
}
return baseIsNative(value);
}
@@ -11297,8 +11494,7 @@
* @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 a number, else `false`.
* @example
*
* _.isNumber(3);
@@ -11369,8 +11565,7 @@
* @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 a regexp, else `false`.
* @example
*
* _.isRegExp(/abc/);
@@ -11379,9 +11574,7 @@
* _.isRegExp('/abc/');
* // => false
*/
- function isRegExp(value) {
- return isObject(value) && objectToString.call(value) == regexpTag;
- }
+ var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
/**
* Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
@@ -11423,8 +11616,7 @@
* @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 a set, else `false`.
* @example
*
* _.isSet(new Set);
@@ -11433,9 +11625,7 @@
* _.isSet(new WeakSet);
* // => false
*/
- function isSet(value) {
- return isObjectLike(value) && getTag(value) == setTag;
- }
+ var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
/**
* Checks if `value` is classified as a `String` primitive or object.
@@ -11445,8 +11635,7 @@
* @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 a string, else `false`.
* @example
*
* _.isString('abc');
@@ -11468,8 +11657,7 @@
* @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 a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
@@ -11491,8 +11679,7 @@
* @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 a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
@@ -11501,10 +11688,7 @@
* _.isTypedArray([]);
* // => false
*/
- function isTypedArray(value) {
- return isObjectLike(value) &&
- isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
- }
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
/**
* Checks if `value` is `undefined`.
@@ -11535,8 +11719,7 @@
* @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 a weak map, else `false`.
* @example
*
* _.isWeakMap(new WeakMap);
@@ -11557,8 +11740,7 @@
* @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 a weak set, else `false`.
* @example
*
* _.isWeakSet(new WeakSet);
@@ -11907,18 +12089,18 @@
* @example
*
* function Foo() {
- * this.c = 3;
+ * this.a = 1;
* }
*
* function Bar() {
- * this.e = 5;
+ * this.c = 3;
* }
*
- * Foo.prototype.d = 4;
- * Bar.prototype.f = 6;
+ * Foo.prototype.b = 2;
+ * Bar.prototype.d = 4;
*
- * _.assign({ 'a': 1 }, new Foo, new Bar);
- * // => { 'a': 1, 'c': 3, 'e': 5 }
+ * _.assign({ 'a': 0 }, new Foo, new Bar);
+ * // => { 'a': 1, 'c': 3 }
*/
var assign = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
@@ -11950,18 +12132,18 @@
* @example
*
* function Foo() {
- * this.b = 2;
+ * this.a = 1;
* }
*
* function Bar() {
- * this.d = 4;
+ * this.c = 3;
* }
*
- * Foo.prototype.c = 3;
- * Bar.prototype.e = 5;
+ * Foo.prototype.b = 2;
+ * Bar.prototype.d = 4;
*
- * _.assignIn({ 'a': 1 }, new Foo, new Bar);
- * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }
+ * _.assignIn({ 'a': 0 }, new Foo, new Bar);
+ * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/
var assignIn = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
@@ -12055,7 +12237,7 @@
* _.at(object, ['a[0].b.c', 'a[1]']);
* // => [3, 4]
*/
- var at = rest(function(object, paths) {
+ var at = baseRest(function(object, paths) {
return baseAt(object, baseFlatten(paths, 1));
});
@@ -12116,10 +12298,10 @@
* @see _.defaultsDeep
* @example
*
- * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
- * // => { 'user': 'barney', 'age': 36 }
+ * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+ * // => { 'a': 1, 'b': 2 }
*/
- var defaults = rest(function(args) {
+ var defaults = baseRest(function(args) {
args.push(undefined, assignInDefaults);
return apply(assignInWith, undefined, args);
});
@@ -12140,11 +12322,10 @@
* @see _.defaults
* @example
*
- * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });
- * // => { 'user': { 'name': 'barney', 'age': 36 } }
- *
+ * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
+ * // => { 'a': { 'b': 2, 'c': 3 } }
*/
- var defaultsDeep = rest(function(args) {
+ var defaultsDeep = baseRest(function(args) {
args.push(undefined, mergeDefaults);
return apply(mergeWith, undefined, args);
});
@@ -12158,8 +12339,7 @@
* @since 1.1.0
* @category Object
* @param {Object} object The object to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {string|undefined} Returns the key of the matched element,
* else `undefined`.
* @example
@@ -12198,8 +12378,7 @@
* @since 2.0.0
* @category Object
* @param {Object} object The object to search.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {string|undefined} Returns the key of the matched element,
* else `undefined`.
* @example
@@ -12413,7 +12592,7 @@
/**
* Gets the value at `path` of `object`. If the resolved value is
- * `undefined`, the `defaultValue` is used in its place.
+ * `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
@@ -12536,8 +12715,7 @@
* @since 4.1.0
* @category Object
* @param {Object} object The object to invert.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Object} Returns the new inverted object.
* @example
*
@@ -12577,7 +12755,7 @@
* _.invoke(object, 'a[0].b.c.slice', 1, 3);
* // => [2, 3]
*/
- var invoke = rest(baseInvoke);
+ var invoke = baseRest(baseInvoke);
/**
* Creates an array of the own enumerable property names of `object`.
@@ -12681,8 +12859,7 @@
* @since 3.8.0
* @category Object
* @param {Object} object The object to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @see _.mapValues
* @example
@@ -12713,8 +12890,7 @@
* @since 2.4.0
* @category Object
* @param {Object} object The object to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The function invoked per iteration.
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns the new mapped object.
* @see _.mapKeys
* @example
@@ -12761,16 +12937,16 @@
* @returns {Object} Returns `object`.
* @example
*
- * var users = {
- * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
+ * var object = {
+ * 'a': [{ 'b': 2 }, { 'd': 4 }]
* };
*
- * var ages = {
- * 'data': [{ 'age': 36 }, { 'age': 40 }]
+ * var other = {
+ * 'a': [{ 'c': 3 }, { 'e': 5 }]
* };
*
- * _.merge(users, ages);
- * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
+ * _.merge(object, other);
+ * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
*/
var merge = createAssigner(function(object, source, srcIndex) {
baseMerge(object, source, srcIndex);
@@ -12801,18 +12977,11 @@
* }
* }
*
- * var object = {
- * 'fruits': ['apple'],
- * 'vegetables': ['beet']
- * };
- *
- * var other = {
- * 'fruits': ['banana'],
- * 'vegetables': ['carrot']
- * };
+ * var object = { 'a': [1], 'b': [2] };
+ * var other = { 'a': [3], 'b': [4] };
*
* _.mergeWith(object, other, customizer);
- * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
+ * // => { 'a': [1, 3], 'b': [2, 4] }
*/
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
@@ -12837,7 +13006,7 @@
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
- var omit = rest(function(object, props) {
+ var omit = baseRest(function(object, props) {
if (object == null) {
return {};
}
@@ -12856,8 +13025,7 @@
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per property.
+ * @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
@@ -12867,10 +13035,7 @@
* // => { 'b': '2' }
*/
function omitBy(object, predicate) {
- predicate = getIteratee(predicate);
- return basePickBy(object, function(value, key) {
- return !predicate(value, key);
- });
+ return pickBy(object, negate(getIteratee(predicate)));
}
/**
@@ -12890,7 +13055,7 @@
* _.pick(object, ['a', 'c']);
* // => { 'a': 1, 'c': 3 }
*/
- var pick = rest(function(object, props) {
+ var pick = baseRest(function(object, props) {
return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey));
});
@@ -12903,8 +13068,7 @@
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
- * @param {Array|Function|Object|string} [predicate=_.identity]
- * The function invoked per property.
+ * @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
@@ -12914,7 +13078,7 @@
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
- return object == null ? {} : basePickBy(object, getIteratee(predicate));
+ return object == null ? {} : basePickBy(object, getAllKeysIn(object), getIteratee(predicate));
}
/**
@@ -13539,8 +13703,9 @@
? length
: baseClamp(toInteger(position), 0, length);
+ var end = position;
position -= target.length;
- return position >= 0 && string.indexOf(target, position) == position;
+ return position >= 0 && string.slice(position, end) == target;
}
/**
@@ -13988,7 +14153,8 @@
function startsWith(string, target, position) {
string = toString(string);
position = baseClamp(toInteger(position), 0, string.length);
- return string.lastIndexOf(baseToString(target), position) == position;
+ target = baseToString(target);
+ return string.slice(position, position + target.length) == target;
}
/**
@@ -14571,7 +14737,7 @@
* elements = [];
* }
*/
- var attempt = rest(function(func, args) {
+ var attempt = baseRest(function(func, args) {
try {
return apply(func, undefined, args);
} catch (e) {
@@ -14596,16 +14762,16 @@
*
* var view = {
* 'label': 'docs',
- * 'onClick': function() {
+ * 'click': function() {
* console.log('clicked ' + this.label);
* }
* };
*
- * _.bindAll(view, ['onClick']);
- * jQuery(element).on('click', view.onClick);
+ * _.bindAll(view, ['click']);
+ * jQuery(element).on('click', view.click);
* // => Logs 'clicked docs' when clicked.
*/
- var bindAll = rest(function(object, methodNames) {
+ var bindAll = baseRest(function(object, methodNames) {
arrayEach(baseFlatten(methodNames, 1), function(key) {
key = toKey(key);
object[key] = bind(object[key], object);
@@ -14630,7 +14796,7 @@
* var func = _.cond([
* [_.matches({ 'a': 1 }), _.constant('matches A')],
* [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
- * [_.constant(true), _.constant('no match')]
+ * [_.stubTrue, _.constant('no match')]
* ]);
*
* func({ 'a': 1, 'b': 2 });
@@ -14653,7 +14819,7 @@
return [toIteratee(pair[0]), pair[1]];
});
- return rest(function(args) {
+ return baseRest(function(args) {
var index = -1;
while (++index < length) {
var pair = pairs[index];
@@ -14677,13 +14843,13 @@
* @returns {Function} Returns the new spec function.
* @example
*
- * var users = [
- * { 'user': 'barney', 'age': 36 },
- * { 'user': 'fred', 'age': 40 }
+ * var objects = [
+ * { 'a': 2, 'b': 1 },
+ * { 'a': 1, 'b': 2 }
* ];
*
- * _.filter(users, _.conforms({ 'age': function(n) { return n > 38; } }));
- * // => [{ 'user': 'fred', 'age': 40 }]
+ * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
+ * // => [{ 'a': 1, 'b': 2 }]
*/
function conforms(source) {
return baseConforms(baseClone(source, true));
@@ -14714,6 +14880,30 @@
};
}
+ /**
+ * Checks `value` to determine whether a default value should be returned in
+ * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
+ * or `undefined`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.14.0
+ * @category Util
+ * @param {*} value The value to check.
+ * @param {*} defaultValue The default value.
+ * @returns {*} Returns the resolved value.
+ * @example
+ *
+ * _.defaultTo(1, 10);
+ * // => 1
+ *
+ * _.defaultTo(undefined, 10);
+ * // => 10
+ */
+ function defaultTo(value, defaultValue) {
+ return (value == null || value !== value) ? defaultValue : value;
+ }
+
/**
* Creates a function that returns the result of invoking the given functions
* with the `this` binding of the created function, where each successive
@@ -14723,7 +14913,7 @@
* @memberOf _
* @since 3.0.0
* @category Util
- * @param {...(Function|Function[])} [funcs] Functions to invoke.
+ * @param {...(Function|Function[])} [funcs] The functions to invoke.
* @returns {Function} Returns the new composite function.
* @see _.flowRight
* @example
@@ -14746,7 +14936,7 @@
* @since 3.0.0
* @memberOf _
* @category Util
- * @param {...(Function|Function[])} [funcs] Functions to invoke.
+ * @param {...(Function|Function[])} [funcs] The functions to invoke.
* @returns {Function} Returns the new composite function.
* @see _.flow
* @example
@@ -14762,7 +14952,7 @@
var flowRight = createFlow(true);
/**
- * This method returns the first argument given to it.
+ * This method returns the first argument it receives.
*
* @static
* @since 0.1.0
@@ -14772,7 +14962,7 @@
* @returns {*} Returns `value`.
* @example
*
- * var object = { 'user': 'fred' };
+ * var object = { 'a': 1 };
*
* console.log(_.identity(object) === object);
* // => true
@@ -14843,13 +15033,13 @@
* @returns {Function} Returns the new spec function.
* @example
*
- * var users = [
- * { 'user': 'barney', 'age': 36, 'active': true },
- * { 'user': 'fred', 'age': 40, 'active': false }
+ * var objects = [
+ * { 'a': 1, 'b': 2, 'c': 3 },
+ * { 'a': 4, 'b': 5, 'c': 6 }
* ];
*
- * _.filter(users, _.matches({ 'age': 40, 'active': false }));
- * // => [{ 'user': 'fred', 'age': 40, 'active': false }]
+ * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
+ * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
*/
function matches(source) {
return baseMatches(baseClone(source, true));
@@ -14871,13 +15061,13 @@
* @returns {Function} Returns the new spec function.
* @example
*
- * var users = [
- * { 'user': 'barney' },
- * { 'user': 'fred' }
+ * var objects = [
+ * { 'a': 1, 'b': 2, 'c': 3 },
+ * { 'a': 4, 'b': 5, 'c': 6 }
* ];
*
- * _.find(users, _.matchesProperty('user', 'fred'));
- * // => { 'user': 'fred' }
+ * _.find(objects, _.matchesProperty('a', 4));
+ * // => { 'a': 4, 'b': 5, 'c': 6 }
*/
function matchesProperty(path, srcValue) {
return baseMatchesProperty(path, baseClone(srcValue, true));
@@ -14907,7 +15097,7 @@
* _.map(objects, _.method(['a', 'b']));
* // => [2, 1]
*/
- var method = rest(function(path, args) {
+ var method = baseRest(function(path, args) {
return function(object) {
return baseInvoke(object, path, args);
};
@@ -14936,7 +15126,7 @@
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
* // => [2, 0]
*/
- var methodOf = rest(function(object, args) {
+ var methodOf = baseRest(function(object, args) {
return function(path) {
return baseInvoke(object, path, args);
};
@@ -15035,7 +15225,7 @@
}
/**
- * A method that returns `undefined`.
+ * This method returns `undefined`.
*
* @static
* @memberOf _
@@ -15072,7 +15262,7 @@
*/
function nthArg(n) {
n = toInteger(n);
- return rest(function(args) {
+ return baseRest(function(args) {
return baseNth(args, n);
});
}
@@ -15085,8 +15275,8 @@
* @memberOf _
* @since 4.0.0
* @category Util
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [iteratees=[_.identity]] The iteratees to invoke.
+ * @param {...(Function|Function[])} [iteratees=[_.identity]]
+ * The iteratees to invoke.
* @returns {Function} Returns the new function.
* @example
*
@@ -15105,8 +15295,8 @@
* @memberOf _
* @since 4.0.0
* @category Util
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [predicates=[_.identity]] The predicates to check.
+ * @param {...(Function|Function[])} [predicates=[_.identity]]
+ * The predicates to check.
* @returns {Function} Returns the new function.
* @example
*
@@ -15131,8 +15321,8 @@
* @memberOf _
* @since 4.0.0
* @category Util
- * @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
- * [predicates=[_.identity]] The predicates to check.
+ * @param {...(Function|Function[])} [predicates=[_.identity]]
+ * The predicates to check.
* @returns {Function} Returns the new function.
* @example
*
@@ -15284,7 +15474,7 @@
var rangeRight = createRange(true);
/**
- * A method that returns a new empty array.
+ * This method returns a new empty array.
*
* @static
* @memberOf _
@@ -15306,7 +15496,7 @@
}
/**
- * A method that returns `false`.
+ * This method returns `false`.
*
* @static
* @memberOf _
@@ -15323,7 +15513,7 @@
}
/**
- * A method that returns a new empty object.
+ * This method returns a new empty object.
*
* @static
* @memberOf _
@@ -15345,7 +15535,7 @@
}
/**
- * A method that returns an empty string.
+ * This method returns an empty string.
*
* @static
* @memberOf _
@@ -15362,7 +15552,7 @@
}
/**
- * A method that returns `true`.
+ * This method returns `true`.
*
* @static
* @memberOf _
@@ -15480,7 +15670,7 @@
*/
var add = createMathOperation(function(augend, addend) {
return augend + addend;
- });
+ }, 0);
/**
* Computes `number` rounded up to `precision`.
@@ -15522,7 +15712,7 @@
*/
var divide = createMathOperation(function(dividend, divisor) {
return dividend / divisor;
- });
+ }, 1);
/**
* Computes `number` rounded down to `precision`.
@@ -15581,8 +15771,7 @@
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {*} Returns the maximum value.
* @example
*
@@ -15597,7 +15786,7 @@
*/
function maxBy(array, iteratee) {
return (array && array.length)
- ? baseExtremum(array, getIteratee(iteratee), baseGt)
+ ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
: undefined;
}
@@ -15629,8 +15818,7 @@
* @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.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the mean.
* @example
*
@@ -15644,7 +15832,7 @@
* // => 5
*/
function meanBy(array, iteratee) {
- return baseMean(array, getIteratee(iteratee));
+ return baseMean(array, getIteratee(iteratee, 2));
}
/**
@@ -15681,8 +15869,7 @@
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {*} Returns the minimum value.
* @example
*
@@ -15697,7 +15884,7 @@
*/
function minBy(array, iteratee) {
return (array && array.length)
- ? baseExtremum(array, getIteratee(iteratee), baseLt)
+ ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
: undefined;
}
@@ -15718,7 +15905,7 @@
*/
var multiply = createMathOperation(function(multiplier, multiplicand) {
return multiplier * multiplicand;
- });
+ }, 1);
/**
* Computes `number` rounded to `precision`.
@@ -15760,7 +15947,7 @@
*/
var subtract = createMathOperation(function(minuend, subtrahend) {
return minuend - subtrahend;
- });
+ }, 0);
/**
* Computes the sum of the values in `array`.
@@ -15792,8 +15979,7 @@
* @since 4.0.0
* @category Math
* @param {Array} array The array to iterate over.
- * @param {Array|Function|Object|string} [iteratee=_.identity]
- * The iteratee invoked per element.
+ * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {number} Returns the sum.
* @example
*
@@ -15808,7 +15994,7 @@
*/
function sumBy(array, iteratee) {
return (array && array.length)
- ? baseSum(array, getIteratee(iteratee))
+ ? baseSum(array, getIteratee(iteratee, 2))
: 0;
}
@@ -15987,7 +16173,9 @@
lodash.cloneDeep = cloneDeep;
lodash.cloneDeepWith = cloneDeepWith;
lodash.cloneWith = cloneWith;
+ lodash.conformsTo = conformsTo;
lodash.deburr = deburr;
+ lodash.defaultTo = defaultTo;
lodash.divide = divide;
lodash.endsWith = endsWith;
lodash.eq = eq;
@@ -16228,7 +16416,7 @@
return this.reverse().find(predicate);
};
- LazyWrapper.prototype.invokeMap = rest(function(path, args) {
+ LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
if (typeof path == 'function') {
return new LazyWrapper(this);
}
@@ -16238,10 +16426,7 @@
});
LazyWrapper.prototype.reject = function(predicate) {
- predicate = getIteratee(predicate, 3);
- return this.filter(function(value) {
- return !predicate(value);
- });
+ return this.filter(negate(getIteratee(predicate)));
};
LazyWrapper.prototype.slice = function(start, end) {
@@ -16345,7 +16530,7 @@
}
});
- realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{
+ realNames[createHybrid(undefined, BIND_KEY_FLAG).name] = [{
'name': 'wrapper',
'func': undefined
}];
@@ -16364,6 +16549,9 @@
lodash.prototype.reverse = wrapperReverse;
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
+ // Add lazy aliases.
+ lodash.prototype.first = lodash.prototype.head;
+
if (iteratorSymbol) {
lodash.prototype[iteratorSymbol] = wrapperToIterator;
}
@@ -16375,22 +16563,21 @@
// Export lodash.
var _ = runInContext();
- // Expose Lodash on the free variable `window` or `self` when available so it's
- // globally accessible, even when bundled with Browserify, Webpack, etc. This
- // also prevents errors in cases where Lodash is loaded by a script tag in the
- // presence of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch
- // for more details. Use `_.noConflict` to remove Lodash from the global object.
- (freeSelf || {})._ = _;
-
- // Some AMD build optimizers like r.js check for condition patterns like the following:
+ // Some AMD build optimizers, like r.js, check for condition patterns like:
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+ // Expose Lodash on the global object to prevent errors when Lodash is
+ // loaded by a script tag in the presence of an AMD loader.
+ // See http://requirejs.org/docs/errors.html#mismatch for more details.
+ // Use `_.noConflict` to remove Lodash from the global object.
+ root._ = _;
+
// Define as an anonymous module so, through path mapping, it can be
// referenced as the "underscore" module.
define(function() {
return _;
});
}
- // Check for `exports` after `define` in case a build optimizer adds an `exports` object.
+ // Check for `exports` after `define` in case a build optimizer adds it.
else if (freeModule) {
// Export for Node.js.
(freeModule.exports = _)._ = _;
diff --git a/package.json b/package.json
index 5650070b48..3a8208e767 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash",
- "version": "4.13.1",
+ "version": "4.14.0",
"license": "MIT",
"private": true,
"main": "lodash.js",
@@ -13,6 +13,7 @@
"doc": "node lib/main/build-doc github && npm run test:doc",
"doc:fp": "node lib/fp/build-doc",
"doc:site": "node lib/main/build-doc site",
+ "doc:sitehtml": "optional-dev-dependency marky-markdown@^7.0.2 && npm run doc:site && node lib/main/build-site",
"prepublish": "npm run build",
"pretest": "npm run build",
"style": "npm run style:main && npm run style:fp && npm run style:perf && npm run style:test",
@@ -27,29 +28,30 @@
"validate": "npm run style && npm run test"
},
"devDependencies": {
- "async": "^1.5.2",
- "benchmark": "^2.1.0",
+ "async": "^2.0.1",
+ "benchmark": "^2.1.1",
"chalk": "^1.1.3",
"codecov.io": "~0.1.6",
- "coveralls": "^2.11.9",
+ "coveralls": "^2.11.11",
"curl-amd": "~0.8.12",
- "docdown": "~0.5.1",
- "dojo": "^1.11.1",
+ "docdown": "~0.6.1",
+ "dojo": "^1.11.2",
"ecstatic": "^1.4.1",
"fs-extra": "~0.30.0",
- "glob": "^7.0.3",
- "istanbul": "0.4.3",
- "jquery": "^2.2.4",
- "jscs": "^3.0.1",
- "lodash": "4.11.2",
- "markdown-doctest": "^0.6.0",
+ "glob": "^7.0.5",
+ "istanbul": "0.4.4",
+ "jquery": "^3.1.0",
+ "jscs": "^3.0.7",
+ "lodash": "4.13.1",
+ "markdown-doctest": "^0.8.1",
+ "optional-dev-dependency": "^1.3.0",
"platform": "^1.3.1",
- "qunit-extras": "^2.0.0",
- "qunitjs": "~1.23.1",
- "request": "^2.69.0",
+ "qunit-extras": "^2.1.0",
+ "qunitjs": "^2.0.0",
+ "request": "^2.74.0",
"requirejs": "^2.2.0",
- "sauce-tunnel": "^2.4.0",
- "uglify-js": "2.6.2",
+ "sauce-tunnel": "^2.5.0",
+ "uglify-js": "2.7.0",
"webpack": "^1.13.1"
}
}
diff --git a/perf/asset/perf-ui.js b/perf/asset/perf-ui.js
index e3ed64b243..f368c6c6d2 100644
--- a/perf/asset/perf-ui.js
+++ b/perf/asset/perf-ui.js
@@ -15,27 +15,8 @@
/*--------------------------------------------------------------------------*/
- /**
- * Registers an event listener on an element.
- *
- * @private
- * @param {Element} element The element.
- * @param {string} eventName The name of the event.
- * @param {Function} handler The event handler.
- * @returns {Element} The element.
- */
- function addListener(element, eventName, handler) {
- if (typeof element.addEventListener != 'undefined') {
- element.addEventListener(eventName, handler, false);
- } else if (typeof element.attachEvent != 'undefined') {
- element.attachEvent('on' + eventName, handler);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
// Initialize controls.
- addListener(window, 'load', function() {
+ addEventListener('load', function() {
function eventHandler(event) {
var buildIndex = buildList.selectedIndex,
otherIndex = otherList.selectedIndex,
@@ -96,8 +77,8 @@
return -1;
}());
- addListener(buildList, 'change', eventHandler);
- addListener(otherList, 'change', eventHandler);
+ buildList.addEventListener('change', eventHandler);
+ otherList.addEventListener('change', eventHandler);
});
// The lodash build file path.
diff --git a/perf/index.html b/perf/index.html
index 16d41bf36a..305cdce705 100644
--- a/perf/index.html
+++ b/perf/index.html
@@ -10,16 +10,27 @@
height: 100%;
}
#FirebugUI {
- top: 2em;
+ top: 2.5em;
}
#perf-toolbar {
background-color: #EEE;
color: #5E740B;
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
font-size: small;
- padding: 0.5em 0 0.5em 2em;
+ padding: 0.5em 1em 0.5em 1em;
overflow: hidden;
}
+ #perf-toolbar label {
+ display: inline-block;
+ margin-right: 0.5em;
+ }
+ #perf-toolbar span {
+ display: inline-block;
+ float: right;
+ line-height: 2.1em;
+ margin-left: 1em;
+ margin-top: 0;
+ }
diff --git a/perf/perf.js b/perf/perf.js
index baee142b92..3588c7dc3a 100644
--- a/perf/perf.js
+++ b/perf/perf.js
@@ -1,4 +1,5 @@
;(function() {
+ 'use strict';
/** Used to access the Firebug Lite panel (set by `run`). */
var fbPanel;
diff --git a/test/asset/test-ui.js b/test/asset/test-ui.js
index 24f087a480..968f0f8ec8 100644
--- a/test/asset/test-ui.js
+++ b/test/asset/test-ui.js
@@ -15,27 +15,8 @@
/*--------------------------------------------------------------------------*/
- /**
- * Registers an event listener on an element.
- *
- * @private
- * @param {Element} element The element.
- * @param {string} eventName The name of the event.
- * @param {Function} handler The event handler.
- * @returns {Element} The element.
- */
- function addListener(element, eventName, handler) {
- if (typeof element.addEventListener != 'undefined') {
- element.addEventListener(eventName, handler, false);
- } else if (typeof element.attachEvent != 'undefined') {
- element.attachEvent('on' + eventName, handler);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
// Initialize controls.
- addListener(window, 'load', function() {
+ addEventListener('load', function() {
function eventHandler(event) {
var buildIndex = buildList.selectedIndex,
loaderIndex = loaderList.selectedIndex,
@@ -59,8 +40,8 @@
setTimeout(init, 15);
return;
}
- toolbar.appendChild(span1);
- toolbar.appendChild(span2);
+ toolbar.insertBefore(span2, toolbar.lastChild);
+ toolbar.insertBefore(span1, span2);
buildList.selectedIndex = (function() {
switch (build) {
@@ -84,12 +65,11 @@
return -1;
}());
- addListener(buildList, 'change', eventHandler);
- addListener(loaderList, 'change', eventHandler);
+ buildList.addEventListener('change', eventHandler);
+ loaderList.addEventListener('change', eventHandler);
}
var span1 = document.createElement('span');
- span1.style.cssText = 'float:right';
span1.innerHTML =
'' +
'';
var span2 = document.createElement('span');
- span2.style.cssText = 'float:right';
span2.innerHTML =
'' +
'';
+ span1.style.cssText =
+ span2.style.cssText = 'display:inline-block;float:right;line-height:2.1em;margin-left:1em;margin-top:0;';
+
+ span1.firstChild.style.cssText =
+ span2.firstChild.style.cssText = 'display:inline-block;margin-right:.5em;';
+
var buildList = span1.lastChild,
loaderList = span2.lastChild;
diff --git a/test/asset/worker.js b/test/asset/worker.js
index 8ccffa873c..95e3ab8a8e 100644
--- a/test/asset/worker.js
+++ b/test/asset/worker.js
@@ -1,3 +1,5 @@
+'use strict';
+
self.console || (self.console = { 'log': function() {} });
addEventListener('message', function(e) {
diff --git a/test/saucelabs.js b/test/saucelabs.js
index f8a7554ff3..38c8bb7b3c 100644
--- a/test/saucelabs.js
+++ b/test/saucelabs.js
@@ -104,10 +104,10 @@ var browserNameMap = {
/** List of platforms to load the runner on. */
var platforms = [
['Linux', 'android', '5.1'],
+ ['Windows 10', 'chrome', '51'],
['Windows 10', 'chrome', '50'],
- ['Windows 10', 'chrome', '49'],
+ ['Windows 10', 'firefox', '47'],
['Windows 10', 'firefox', '46'],
- ['Windows 10', 'firefox', '45'],
['Windows 10', 'microsoftedge', '13'],
['Windows 10', 'internet explorer', '11'],
['Windows 8', 'internet explorer', '10'],
@@ -294,7 +294,7 @@ function optionToArray(name, string) {
function optionToValue(name, string) {
var result = string.match(RegExp('^' + name + '(?:=([\\s\\S]+))?$'));
if (result) {
- result = _.result(result, 1);
+ result = _.get(result, 1);
result = result ? _.trim(result) : true;
}
if (result === 'false') {
@@ -366,8 +366,8 @@ function onJobStart(error, res, body) {
if (this.stopping) {
return;
}
- var statusCode = _.result(res, 'statusCode'),
- taskId = _.first(_.result(body, 'js tests'));
+ var statusCode = _.get(res, 'statusCode'),
+ taskId = _.first(_.get(body, 'js tests'));
if (error || !taskId || statusCode != 200) {
if (this.attempts < this.retries) {
@@ -408,19 +408,19 @@ function onJobStatus(error, res, body) {
if (!this.running || this.stopping) {
return;
}
- var completed = _.result(body, 'completed', false),
- data = _.first(_.result(body, 'js tests')),
+ var completed = _.get(body, 'completed', false),
+ data = _.first(_.get(body, 'js tests')),
elapsed = (_.now() - this.timestamp) / 1000,
- jobId = _.result(data, 'job_id', null),
- jobResult = _.result(data, 'result', null),
- jobStatus = _.result(data, 'status', ''),
- jobUrl = _.result(data, 'url', null),
+ jobId = _.get(data, 'job_id', null),
+ jobResult = _.get(data, 'result', null),
+ jobStatus = _.get(data, 'status', ''),
+ jobUrl = _.get(data, 'url', null),
expired = (elapsed >= queueTimeout && !_.includes(jobStatus, 'in progress')),
options = this.options,
platform = options.platforms[0];
if (_.isObject(jobResult)) {
- var message = _.result(jobResult, 'message');
+ var message = _.get(jobResult, 'message');
} else {
if (typeof jobResult == 'string') {
message = jobResult;
@@ -442,7 +442,7 @@ function onJobStatus(error, res, body) {
}
var description = browserName(platform[1]) + ' ' + platform[2] + ' on ' + _.startCase(platform[0]),
errored = !jobResult || !jobResult.passed || reError.test(message) || reError.test(jobStatus),
- failures = _.result(jobResult, 'failed'),
+ failures = _.get(jobResult, 'failed'),
label = options.name + ':',
tunnel = this.tunnel;
@@ -463,7 +463,7 @@ function onJobStatus(error, res, body) {
return;
}
else {
- if (typeof message == 'undefined') {
+ if (message === undefined) {
message = 'Results are unavailable. ' + details;
}
console.error(label, description, chalk.red('failed') + ';', message);
diff --git a/test/test-fp.js b/test/test-fp.js
index 1fd668753e..ce1f56f523 100644
--- a/test/test-fp.js
+++ b/test/test-fp.js
@@ -1,4 +1,5 @@
;(function() {
+ 'use strict';
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
@@ -22,6 +23,7 @@
/** Math helpers. */
var add = function(x, y) { return x + y; },
isEven = function(n) { return n % 2 == 0; },
+ isEvenIndex = function(n, index) { return isEven(index); },
square = function(n) { return n * n; };
// Leak to avoid sporadic `noglobals` fails on Edge in Sauce Labs.
@@ -140,11 +142,8 @@
if (!document) {
var array = [1, 2, 3, 4],
- lodash = convert({ 'remove': _.remove }, allFalseOptions);
-
- var actual = lodash.remove(array, function(n, index) {
- return isEven(index);
- });
+ lodash = convert({ 'remove': _.remove }, allFalseOptions),
+ actual = lodash.remove(array, isEvenIndex);
assert.deepEqual(array, [2, 4]);
assert.deepEqual(actual, [1, 3]);
@@ -159,11 +158,8 @@
assert.expect(3);
var array = [1, 2, 3, 4],
- lodash = convert(_.runInContext(), allFalseOptions);
-
- var actual = lodash.remove(array, function(n, index) {
- return isEven(index);
- });
+ lodash = convert(_.runInContext(), allFalseOptions),
+ actual = lodash.remove(array, isEvenIndex);
assert.deepEqual(array, [2, 4]);
assert.deepEqual(actual, [1, 3]);
@@ -175,11 +171,8 @@
var array = [1, 2, 3, 4],
runInContext = convert('runInContext', _.runInContext, allFalseOptions),
- lodash = runInContext();
-
- var actual = lodash.remove(array, function(n, index) {
- return isEven(index);
- });
+ lodash = runInContext(),
+ actual = lodash.remove(array, isEvenIndex);
assert.deepEqual(array, [2, 4]);
assert.deepEqual(actual, [1, 3]);
@@ -192,7 +185,7 @@
var array = [1, 2, 3, 4],
value = _.clone(array),
remove = convert('remove', _.remove, { 'cap': false }),
- actual = remove(function(n, index) { return isEven(index); })(value);
+ actual = remove(isEvenIndex)(value);
assert.deepEqual(value, [1, 2, 3, 4]);
assert.deepEqual(actual, [2, 4]);
@@ -295,11 +288,8 @@
var array = [1, 2, 3, 4],
lodash = func(allFalseOptions),
- remove = isFp ? lodash.remove : lodash;
-
- var actual = remove(array, function(n, index) {
- return isEven(index);
- });
+ remove = isFp ? lodash.remove : lodash,
+ actual = remove(array, isEvenIndex);
assert.deepEqual(array, [2, 4]);
assert.deepEqual(actual, [1, 3]);
@@ -311,11 +301,8 @@
var array = [1, 2, 3, 4],
lodash = func({ 'cap': false }),
- remove = (isFp ? lodash.remove : lodash).convert({ 'rearg': false });
-
- var actual = remove(array)(function(n, index) {
- return isEven(index);
- });
+ remove = (isFp ? lodash.remove : lodash).convert({ 'rearg': false }),
+ actual = remove(array)(isEvenIndex);
assert.deepEqual(array, [1, 2, 3, 4]);
assert.deepEqual(actual, [2, 4]);
@@ -344,7 +331,7 @@
var aryCap = index + 1;
var methodNames = _.filter(mapping.aryMethod[aryCap], function(methodName) {
- var key = _.result(mapping.remap, methodName, methodName),
+ var key = _.get(mapping.remap, methodName, methodName),
arity = _[key].length;
return arity != 0 && arity < aryCap;
@@ -413,7 +400,7 @@
'wrap'
];
- var exceptions = _.difference(funcMethods.concat('matchesProperty'), ['cloneDeepWith', 'cloneWith', 'delay']),
+ var exceptions = _.without(funcMethods.concat('matchesProperty'), 'delay'),
expected = _.map(mapping.aryMethod[2], _.constant(true));
var actual = _.map(mapping.aryMethod[2], function(methodName) {
@@ -727,6 +714,20 @@
});
});
+ _.each(['assignAll', 'assignInAll', 'defaultsAll', 'defaultsDeepAll', 'mergeAll'], function(methodName) {
+ var func = fp[methodName];
+
+ QUnit.test('`fp.' + methodName + '` should not mutate values', function(assert) {
+ assert.expect(2);
+
+ var objects = [{ 'a': 1 }, { 'b': 2 }],
+ actual = func(objects);
+
+ assert.deepEqual(objects[0], { 'a': 1 });
+ assert.deepEqual(actual, { 'a': 1, 'b': 2 });
+ });
+ });
+
/*--------------------------------------------------------------------------*/
QUnit.module('assignWith methods');
@@ -749,13 +750,36 @@
QUnit.test('`fp.' + methodName + '` should not mutate values', function(assert) {
assert.expect(2);
- var object = { 'a': 1 };
+ var objects = [{ 'a': 1 }, { 'b': 2 }],
+ actual = func(_.nthArg(1))(objects[0])(objects[1]);
- var actual = func(function(objValue, srcValue) {
- return srcValue;
- })(object)({ 'b': 2 });
+ assert.deepEqual(objects[0], { 'a': 1 });
+ assert.deepEqual(actual, { 'a': 1, 'b': 2 });
+ });
+ });
- assert.deepEqual(object, { 'a': 1 });
+ _.each(['assignAllWith', 'assignInAllWith', 'extendAllWith'], function(methodName) {
+ var func = fp[methodName];
+
+ QUnit.test('`fp.' + methodName + '` should provide the correct `customizer` arguments', function(assert) {
+ assert.expect(1);
+
+ var args;
+
+ func(function() {
+ args || (args = _.map(arguments, _.cloneDeep));
+ })([{ 'a': 1 }, { 'b': 2 }]);
+
+ assert.deepEqual(args, [undefined, 2, 'b', { 'a': 1 }, { 'b': 2 }]);
+ });
+
+ QUnit.test('`fp.' + methodName + '` should not mutate values', function(assert) {
+ assert.expect(2);
+
+ var objects = [{ 'a': 1 }, { 'b': 2 }],
+ actual = func(_.nthArg(1))(objects);
+
+ assert.deepEqual(objects[0], { 'a': 1 });
assert.deepEqual(actual, { 'a': 1, 'b': 2 });
});
});
@@ -833,6 +857,19 @@
/*--------------------------------------------------------------------------*/
+ QUnit.module('fp.defaultTo');
+
+ (function() {
+ QUnit.test('should have an argument order of `defaultValue` then `value`', function(assert) {
+ assert.expect(2);
+
+ assert.strictEqual(fp.defaultTo(1)(0), 0);
+ assert.strictEqual(fp.defaultTo(1)(undefined), 1);
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
QUnit.module('fp.difference');
(function() {
@@ -910,10 +947,9 @@
var object = { 'a': 1 },
extend = convert('extend', _.extend),
- value = _.clone(object),
- actual = extend(value)(new Foo);
+ actual = extend(object)(new Foo);
- assert.deepEqual(value, object);
+ assert.deepEqual(object, { 'a': 1 });
assert.deepEqual(actual, { 'a': 1, 'b': 2 });
});
}());
@@ -1012,8 +1048,8 @@
var array = [1, 2, 3, 1, 2, 3];
- assert.deepEqual(func(resolve(1))(2)(array), 3);
- assert.deepEqual(func(resolve(2))(-3)(array), 4);
+ assert.strictEqual(func(resolve(1))(2)(array), 3);
+ assert.strictEqual(func(resolve(2))(-3)(array), 4);
});
});
@@ -1030,8 +1066,8 @@
var array = [1, 2, 3, 1, 2, 3];
- assert.deepEqual(func(resolve(2))(3)(array), 1);
- assert.deepEqual(func(resolve(3))(-3)(array), 2);
+ assert.strictEqual(func(resolve(2))(3)(array), 1);
+ assert.strictEqual(func(resolve(3))(-3)(array), 2);
});
});
@@ -1273,7 +1309,7 @@
var args,
iteration = 0,
objects = [{ 'a': 1 }, { 'a': 2 }],
- stack = { '__data__': { '__data__': [objects] } },
+ stack = { '__data__': { '__data__': [objects, objects.slice().reverse()] } },
expected = [1, 2, 'a', objects[0], objects[1], stack];
fp.isEqualWith(function() {
@@ -1409,11 +1445,11 @@
var args,
stack = { '__data__': { '__data__': [] } },
- expected = [[1], [2, 3], 'a', { 'a': [1] }, { 'a': [2, 3] }, stack];
+ expected = [[1, 2], [3], 'a', { 'a': [1, 2] }, { 'a': [3] }, stack];
fp.mergeWith(function() {
args || (args = _.map(arguments, _.cloneDeep));
- })({ 'a': [1] })({ 'a': [2, 3] });
+ })({ 'a': [1, 2] })({ 'a': [3] });
args[5] = _.omitBy(args[5], _.isFunction);
args[5].__data__ = _.omitBy(args[5].__data__, _.isFunction);
@@ -1424,17 +1460,44 @@
QUnit.test('should not mutate values', function(assert) {
assert.expect(2);
- var object = { 'a': { 'b': 2, 'c': 3 } };
- object.a.b = [1];
+ var objects = [{ 'a': [1, 2] }, { 'a': [3] }],
+ actual = fp.mergeWith(_.noop, objects[0], objects[1]);
- var actual = fp.mergeWith(function(objValue, srcValue) {
- if (_.isArray(objValue)) {
- return objValue.concat(srcValue);
- }
- }, object, { 'a': { 'b': [2, 3] } });
+ assert.deepEqual(objects[0], { 'a': [1, 2] });
+ assert.deepEqual(actual, { 'a': [3, 2] });
+ });
+ }());
- assert.deepEqual(object, { 'a': { 'b': [1], 'c': 3 } });
- assert.deepEqual(actual, { 'a': { 'b': [1, 2, 3], 'c': 3 } });
+ /*--------------------------------------------------------------------------*/
+
+ QUnit.module('fp.mergeAllWith');
+
+ (function() {
+ QUnit.test('should provide the correct `customizer` arguments', function(assert) {
+ assert.expect(1);
+
+ var args,
+ stack = { '__data__': { '__data__': [] } },
+ expected = [[1, 2], [3], 'a', { 'a': [1, 2] }, { 'a': [3] }, stack];
+
+ fp.mergeAllWith(function() {
+ args || (args = _.map(arguments, _.cloneDeep));
+ })([{ 'a': [1, 2] }, { 'a': [3] }]);
+
+ args[5] = _.omitBy(args[5], _.isFunction);
+ args[5].__data__ = _.omitBy(args[5].__data__, _.isFunction);
+
+ assert.deepEqual(args, expected);
+ });
+
+ QUnit.test('should not mutate values', function(assert) {
+ assert.expect(2);
+
+ var objects = [{ 'a': [1, 2] }, { 'a': [3] }],
+ actual = fp.mergeAllWith(_.noop, objects);
+
+ assert.deepEqual(objects[0], { 'a': [1, 2] });
+ assert.deepEqual(actual, { 'a': [3, 2] });
});
}());
@@ -1515,11 +1578,11 @@
Foo.mixin = object.mixin;
Foo.mixin(source);
- assert.strictEqual(typeof Foo.a, 'function');
+ assert.ok('a' in Foo);
assert.notOk('a' in Foo.prototype);
object.mixin(source);
- assert.strictEqual(typeof object.a, 'function');
+ assert.ok('a' in object);
});
}());
@@ -1621,6 +1684,21 @@
/*--------------------------------------------------------------------------*/
+ QUnit.module('fp.propertyOf');
+
+ (function() {
+ QUnit.test('should be curried', function(assert) {
+ assert.expect(2);
+
+ var object = { 'a': 1 };
+
+ assert.strictEqual(fp.propertyOf(object, 'a'), 1);
+ assert.strictEqual(fp.propertyOf(object)('a'), 1);
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
QUnit.module('fp.pull');
(function() {
@@ -1701,6 +1779,30 @@
/*--------------------------------------------------------------------------*/
+ QUnit.module('fp.rearg');
+
+ (function() {
+ function fn(a, b, c) {
+ return [a, b, c];
+ }
+
+ QUnit.test('should be curried', function(assert) {
+ assert.expect(1);
+
+ var rearged = fp.rearg([1, 2, 0])(fn);
+ assert.deepEqual(rearged('c', 'a', 'b'), ['a', 'b', 'c']);
+ });
+
+ QUnit.test('should curry the rearged function', function(assert) {
+ assert.expect(1);
+
+ var rearged = fp.rearg([1, 2, 0], fn);
+ assert.deepEqual(rearged('c')('a')('b'), ['a', 'b', 'c']);
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
QUnit.module('reduce methods');
_.each(['reduce', 'reduceRight'], function(methodName) {
@@ -1951,11 +2053,8 @@
QUnit.test('should work with an `iteratee` argument', function(assert) {
assert.expect(1);
- var expected = objects.slice(0, 3);
-
- var actual = fp.uniqBy(function(object) {
- return object.a;
- })(objects);
+ var expected = objects.slice(0, 3),
+ actual = fp.uniqBy(_.property('a'))(objects);
assert.deepEqual(actual, expected);
});
@@ -2135,6 +2234,18 @@
/*--------------------------------------------------------------------------*/
+ QUnit.module('fp.zipAll');
+
+ (function() {
+ QUnit.test('should zip together an array of arrays', function(assert) {
+ assert.expect(1);
+
+ assert.deepEqual(fp.zipAll([[1, 2], [3, 4], [5, 6]]), [[1, 3, 5], [2, 4, 6]]);
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
QUnit.module('fp.zipObject');
(function() {
@@ -2169,5 +2280,6 @@
if (!document) {
QUnit.config.noglobals = true;
QUnit.load();
+ QUnit.start();
}
}.call(this));
diff --git a/test/test.js b/test/test.js
index b979b622e0..5157954722 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1022,22 +1022,25 @@
return [key, keys[lastIndex - index]];
});
- var largeStack = new mapCaches.Stack(pairs);
+ function createCaches(pairs) {
+ var largeStack = new mapCaches.Stack(pairs),
+ length = pairs ? pairs.length : 0;
- lodashStable.times(LARGE_ARRAY_SIZE - pairs.length + 1, function() {
- largeStack.set({}, {});
- });
+ lodashStable.times(LARGE_ARRAY_SIZE - length, function() {
+ largeStack.set({}, {});
+ });
- var caches = {
- 'hashes': new mapCaches.Hash(pairs),
- 'list caches': new mapCaches.ListCache(pairs),
- 'map caches': new mapCaches.MapCache(pairs),
- 'stack caches': new mapCaches.Stack(pairs),
- 'large stacks': largeStack
- };
+ return {
+ 'hashes': new mapCaches.Hash(pairs),
+ 'list caches': new mapCaches.ListCache(pairs),
+ 'map caches': new mapCaches.MapCache(pairs),
+ 'stack caches': new mapCaches.Stack(pairs),
+ 'large stacks': largeStack
+ };
+ }
- lodashStable.forOwn(caches, function(cache, key) {
- QUnit.test('should implement a `Map` interface for ' + key, function(assert) {
+ lodashStable.forOwn(createCaches(pairs), function(cache, kind) {
+ QUnit.test('should implement a `Map` interface for ' + kind, function(assert) {
assert.expect(82);
lodashStable.each(keys, function(key, index) {
@@ -1059,6 +1062,19 @@
}));
});
});
+
+ lodashStable.forOwn(createCaches(), function(cache, kind) {
+ QUnit.test('should support changing values of ' + kind, function(assert) {
+ assert.expect(10);
+
+ lodashStable.each(keys, function(key) {
+ cache.set(key, 1);
+ cache.set(key, 2);
+
+ assert.strictEqual(cache.get(key), 2);
+ });
+ });
+ });
}());
/*--------------------------------------------------------------------------*/
@@ -1167,7 +1183,7 @@
assert.strictEqual(after(NaN, 1), 1);
});
- QUnit.test('should not set a `this` binding', function(assert) {
+ QUnit.test('should use `this` binding of function', function(assert) {
assert.expect(2);
var after = _.after(1, function(assert) { return ++this.count; }),
@@ -1231,11 +1247,30 @@
assert.deepEqual(actual, expected);
});
- QUnit.test('should work when given less than the capped number of arguments', function(assert) {
+ QUnit.test('should not force a minimum argument count', function(assert) {
+ assert.expect(1);
+
+ var capped = _.ary(fn, 3),
+ args = ['a', 'b', 'c'];
+
+ var expected = lodashStable.map(args, function(arg, index) {
+ return args.slice(0, index);
+ });
+
+ var actual = lodashStable.map(expected, function(array) {
+ return capped.apply(undefined, array);
+ });
+
+ assert.deepEqual(actual, expected);
+ });
+
+ QUnit.test('should use `this` binding of function', function(assert) {
assert.expect(1);
- var capped = _.ary(fn, 3);
- assert.deepEqual(capped('a'), ['a']);
+ var capped = _.ary(function(a, b) { return this; }, 1),
+ object = { 'capped': capped };
+
+ assert.strictEqual(object.capped(), object);
});
QUnit.test('should use the existing `ary` if smaller', function(assert) {
@@ -1419,7 +1454,7 @@
QUnit.test('`_.' + methodName + '` should work with a `customizer` that returns `undefined`', function(assert) {
assert.expect(1);
- var expected = { 'a': undefined };
+ var expected = { 'a': 1 };
assert.deepEqual(func({}, expected, noop), expected);
});
});
@@ -1700,7 +1735,7 @@
assert.strictEqual(before(NaN, 1), 0);
});
- QUnit.test('should not set a `this` binding', function(assert) {
+ QUnit.test('should use `this` binding of function', function(assert) {
assert.expect(2);
var before = _.before(2, function(assert) { return ++this.count; }),
@@ -2726,14 +2761,12 @@
var func = _[methodName],
isDeep = methodName == 'cloneDeep';
- lodashStable.forOwn(objects, function(object, key) {
- QUnit.test('`_.' + methodName + '` should clone ' + key, function(assert) {
+ lodashStable.forOwn(objects, function(object, kind) {
+ QUnit.test('`_.' + methodName + '` should clone ' + kind, function(assert) {
assert.expect(2);
- var isEqual = (key == 'maps' || key == 'sets') ? _.isEqual : lodashStable.isEqual,
- actual = func(object);
-
- assert.ok(isEqual(actual, object));
+ var actual = func(object);
+ assert.ok(lodashStable.isEqual(actual, object));
if (lodashStable.isObject(object)) {
assert.notStrictEqual(actual, object);
@@ -3045,7 +3078,7 @@
var func = _[methodName],
isDeep = methodName == 'cloneDeepWith';
- QUnit.test('`_.' + methodName + '` should provide the correct `customizer` arguments', function(assert) {
+ QUnit.test('`_.' + methodName + '` should provide correct `customizer` arguments', function(assert) {
assert.expect(1);
var argsList = [],
@@ -3317,32 +3350,59 @@
QUnit.module('lodash.conforms');
(function() {
- var objects = [
- { 'a': 1, 'b': 8 },
- { 'a': 2, 'b': 4 },
- { 'a': 3, 'b': 16 }
- ];
+ QUnit.test('should not change behavior if `source` is modified', function(assert) {
+ assert.expect(2);
+
+ var object = { 'a': 2 },
+ source = { 'a': function(value) { return value > 1; } },
+ par = _.conforms(source);
+
+ assert.strictEqual(par(object), true);
- QUnit.test('should create a function that checks if a given object conforms to `source`', function(assert) {
+ source.a = function(value) { return value < 2; };
+ assert.strictEqual(par(object), true);
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
+ QUnit.module('conforms methods');
+
+ lodashStable.each(['conforms', 'conformsTo'], function(methodName) {
+ var isConforms = methodName == 'conforms';
+
+ function conforms(source) {
+ return isConforms ? _.conforms(source) : function(object) {
+ return _.conformsTo(object, source);
+ };
+ }
+
+ QUnit.test('`_.' + methodName + '` should check if `object` conforms to `source`', function(assert) {
assert.expect(2);
- var conforms = _.conforms({
+ var objects = [
+ { 'a': 1, 'b': 8 },
+ { 'a': 2, 'b': 4 },
+ { 'a': 3, 'b': 16 }
+ ];
+
+ var par = conforms({
'b': function(value) { return value > 4; }
});
- var actual = lodashStable.filter(objects, conforms);
+ var actual = lodashStable.filter(objects, par);
assert.deepEqual(actual, [objects[0], objects[2]]);
- conforms = _.conforms({
+ par = conforms({
'b': function(value) { return value > 8; },
'a': function(value) { return value > 1; }
});
- actual = lodashStable.filter(objects, conforms);
+ actual = lodashStable.filter(objects, par);
assert.deepEqual(actual, [objects[2]]);
});
- QUnit.test('should not match by inherited `source` properties', function(assert) {
+ QUnit.test('`_.' + methodName + '` should not match by inherited `source` properties', function(assert) {
assert.expect(1);
function Foo() {
@@ -3354,26 +3414,32 @@
return value > 8;
};
- var conforms = _.conforms(new Foo),
- actual = lodashStable.filter(objects, conforms);
+ var objects = [
+ { 'a': 1, 'b': 8 },
+ { 'a': 2, 'b': 4 },
+ { 'a': 3, 'b': 16 }
+ ];
+
+ var par = conforms(new Foo),
+ actual = lodashStable.filter(objects, par);
assert.deepEqual(actual, [objects[1], objects[2]]);
});
- QUnit.test('should not invoke `source` predicates for missing `object` properties', function(assert) {
+ QUnit.test('`_.' + methodName + '` should not invoke `source` predicates for missing `object` properties', function(assert) {
assert.expect(2);
var count = 0;
- var conforms = _.conforms({
+ var par = conforms({
'a': function() { count++; return true; }
});
- assert.strictEqual(conforms({}), false);
+ assert.strictEqual(par({}), false);
assert.strictEqual(count, 0);
});
- QUnit.test('should work with a function for `object`', function(assert) {
+ QUnit.test('`_.' + methodName + '` should work with a function for `object`', function(assert) {
assert.expect(2);
function Foo() {}
@@ -3382,27 +3448,27 @@
function Bar() {}
Bar.a = 2;
- var conforms = _.conforms({
+ var par = conforms({
'a': function(value) { return value > 1; }
});
- assert.strictEqual(conforms(Foo), false);
- assert.strictEqual(conforms(Bar), true);
+ assert.strictEqual(par(Foo), false);
+ assert.strictEqual(par(Bar), true);
});
- QUnit.test('should work with a function for `source`', function(assert) {
+ QUnit.test('`_.' + methodName + '` should work with a function for `source`', function(assert) {
assert.expect(1);
function Foo() {}
Foo.a = function(value) { return value > 1; };
var objects = [{ 'a': 1 }, { 'a': 2 }],
- actual = lodashStable.filter(objects, _.conforms(Foo));
+ actual = lodashStable.filter(objects, conforms(Foo));
assert.deepEqual(actual, [objects[1]]);
});
- QUnit.test('should work with a non-plain `object`', function(assert) {
+ QUnit.test('`_.' + methodName + '` should work with a non-plain `object`', function(assert) {
assert.expect(1);
function Foo() {
@@ -3410,78 +3476,62 @@
}
Foo.prototype.b = 2;
- var conforms = _.conforms({
+ var par = conforms({
'b': function(value) { return value > 1; }
});
- assert.strictEqual(conforms(new Foo), true);
+ assert.strictEqual(par(new Foo), true);
});
- QUnit.test('should return `false` when `object` is nullish', function(assert) {
+ QUnit.test('`_.' + methodName + '` should return `false` when `object` is nullish', function(assert) {
assert.expect(1);
var values = [, null, undefined],
expected = lodashStable.map(values, stubFalse);
- var conforms = _.conforms({
+ var par = conforms({
'a': function(value) { return value > 1; }
});
var actual = lodashStable.map(values, function(value, index) {
try {
- return index ? conforms(value) : conforms();
+ return index ? par(value) : par();
} catch (e) {}
});
assert.deepEqual(actual, expected);
});
- QUnit.test('should return `true` when comparing an empty `source` to a nullish `object`', function(assert) {
+ QUnit.test('`_.' + methodName + '` should return `true` when comparing an empty `source` to a nullish `object`', function(assert) {
assert.expect(1);
var values = [, null, undefined],
expected = lodashStable.map(values, stubTrue),
- conforms = _.conforms({});
+ par = conforms({});
var actual = lodashStable.map(values, function(value, index) {
try {
- return index ? conforms(value) : conforms();
+ return index ? par(value) : par();
} catch (e) {}
});
assert.deepEqual(actual, expected);
});
- QUnit.test('should return `true` when comparing an empty `source`', function(assert) {
+ QUnit.test('`_.' + methodName + '` should return `true` when comparing an empty `source`', function(assert) {
assert.expect(1);
var object = { 'a': 1 },
expected = lodashStable.map(empties, stubTrue);
var actual = lodashStable.map(empties, function(value) {
- var conforms = _.conforms(value);
- return conforms(object);
+ var par = conforms(value);
+ return par(object);
});
assert.deepEqual(actual, expected);
});
-
- QUnit.test('should not change behavior if `source` is modified', function(assert) {
- assert.expect(2);
-
- var source = {
- 'a': function(value) { return value > 1; }
- };
-
- var object = { 'a': 2 },
- conforms = _.conforms(source);
-
- assert.strictEqual(conforms(object), true);
-
- source.a = function(value) { return value < 2; };
- assert.strictEqual(conforms(object), true);
- });
- }());
+ });
/*--------------------------------------------------------------------------*/
@@ -3838,7 +3888,7 @@
assert.strictEqual(new curried(true), object);
});
- QUnit.test('should not set a `this` binding', function(assert) {
+ QUnit.test('should use `this` binding of function', function(assert) {
assert.expect(9);
var fn = function(a, b, c) {
@@ -3997,7 +4047,7 @@
assert.strictEqual(new curried(true), object);
});
- QUnit.test('should not set a `this` binding', function(assert) {
+ QUnit.test('should use `this` binding of function', function(assert) {
assert.expect(9);
var fn = function(a, b, c) {
@@ -4601,6 +4651,26 @@
/*--------------------------------------------------------------------------*/
+ QUnit.module('lodash.defaultTo');
+
+ (function() {
+ QUnit.test('should return a default value if `value` is `NaN` or nullish', function(assert) {
+ assert.expect(1);
+
+ var expected = lodashStable.map(falsey, function(value) {
+ return (value == null || value !== value) ? 1 : value;
+ });
+
+ var actual = lodashStable.map(falsey, function(value) {
+ return _.defaultTo(value, 1);
+ });
+
+ assert.deepEqual(actual, expected);
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
QUnit.module('lodash.defer');
(function() {
@@ -4861,7 +4931,7 @@
assert.deepEqual(actual, [{ 'x': 2 }]);
});
- QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -5124,7 +5194,7 @@
assert.deepEqual(actual, [1, 2]);
});
- QUnit.test('should provide the correct `predicate` arguments', function(assert) {
+ QUnit.test('should provide correct `predicate` arguments', function(assert) {
assert.expect(1);
var args;
@@ -5194,7 +5264,7 @@
assert.deepEqual(actual, [3, 4]);
});
- QUnit.test('should provide the correct `predicate` arguments', function(assert) {
+ QUnit.test('should provide correct `predicate` arguments', function(assert) {
assert.expect(1);
var args;
@@ -5323,14 +5393,6 @@
assert.strictEqual(_.endsWith(string, 'ab', 2.2), true);
});
-
- QUnit.test('should return `true` when `target` is an empty string regardless of `position`', function(assert) {
- assert.expect(1);
-
- assert.ok(lodashStable.every([-Infinity, NaN, -3, -1, 0, 1, 2, 3, 5, MAX_SAFE_INTEGER, Infinity], function(position) {
- return _.endsWith(string, '', position, true);
- }));
- });
}());
/*--------------------------------------------------------------------------*/
@@ -5747,209 +5809,184 @@
/*--------------------------------------------------------------------------*/
- lodashStable.each(['find', 'findLast', 'findIndex', 'findLastIndex', 'findKey', 'findLastKey'], function(methodName) {
+ lodashStable.each(['find', 'findIndex', 'findKey', 'findLast', 'findLastIndex', 'findLastKey'], function(methodName) {
QUnit.module('lodash.' + methodName);
- var func = _[methodName];
-
- (function() {
- var objects = [
- { 'a': 0, 'b': 0 },
- { 'a': 1, 'b': 1 },
- { 'a': 2, 'b': 2 }
- ];
+ var array = [1, 2, 3, 4],
+ func = _[methodName];
- var expected = ({
- 'find': [objects[1], undefined, objects[2]],
- 'findLast': [objects[2], undefined, objects[2]],
- 'findIndex': [1, -1, 2],
- 'findLastIndex': [2, -1, 2],
- 'findKey': ['1', undefined, '2'],
- 'findLastKey': ['2', undefined, '2']
- })[methodName];
+ var objects = [
+ { 'a': 0, 'b': 0 },
+ { 'a': 1, 'b': 1 },
+ { 'a': 2, 'b': 2 }
+ ];
- QUnit.test('`_.' + methodName + '` should return the found value', function(assert) {
- assert.expect(1);
+ var expected = ({
+ 'find': [objects[1], undefined, objects[2]],
+ 'findIndex': [1, -1, 2],
+ 'findKey': ['1', undefined, '2'],
+ 'findLast': [objects[2], undefined, objects[2]],
+ 'findLastIndex': [2, -1, 2],
+ 'findLastKey': ['2', undefined, '2']
+ })[methodName];
- assert.strictEqual(func(objects, function(object) { return object.a; }), expected[0]);
- });
+ QUnit.test('`_.' + methodName + '` should return the found value', function(assert) {
+ assert.expect(1);
- QUnit.test('`_.' + methodName + '` should return `' + expected[1] + '` if value is not found', function(assert) {
- assert.expect(1);
+ assert.strictEqual(func(objects, function(object) { return object.a; }), expected[0]);
+ });
- assert.strictEqual(func(objects, function(object) { return object.a === 3; }), expected[1]);
- });
+ QUnit.test('`_.' + methodName + '` should return `' + expected[1] + '` if value is not found', function(assert) {
+ assert.expect(1);
- QUnit.test('`_.' + methodName + '` should work with `_.matches` shorthands', function(assert) {
- assert.expect(1);
+ assert.strictEqual(func(objects, function(object) { return object.a === 3; }), expected[1]);
+ });
- assert.strictEqual(func(objects, { 'b': 2 }), expected[2]);
- });
+ QUnit.test('`_.' + methodName + '` should work with `_.matches` shorthands', function(assert) {
+ assert.expect(1);
- QUnit.test('`_.' + methodName + '` should work with `_.matchesProperty` shorthands', function(assert) {
- assert.expect(1);
+ assert.strictEqual(func(objects, { 'b': 2 }), expected[2]);
+ });
- assert.strictEqual(func(objects, ['b', 2]), expected[2]);
- });
+ QUnit.test('`_.' + methodName + '` should work with `_.matchesProperty` shorthands', function(assert) {
+ assert.expect(1);
- QUnit.test('`_.' + methodName + '` should work with `_.property` shorthands', function(assert) {
- assert.expect(1);
+ assert.strictEqual(func(objects, ['b', 2]), expected[2]);
+ });
- assert.strictEqual(func(objects, 'b'), expected[0]);
- });
+ QUnit.test('`_.' + methodName + '` should work with `_.property` shorthands', function(assert) {
+ assert.expect(1);
- QUnit.test('`_.' + methodName + '` should return `' + expected[1] + '` for empty collections', function(assert) {
- assert.expect(1);
+ assert.strictEqual(func(objects, 'b'), expected[0]);
+ });
- var emptyValues = lodashStable.endsWith(methodName, 'Index') ? lodashStable.reject(empties, lodashStable.isPlainObject) : empties,
- expecting = lodashStable.map(emptyValues, lodashStable.constant(expected[1]));
+ QUnit.test('`_.' + methodName + '` should return `' + expected[1] + '` for empty collections', function(assert) {
+ assert.expect(1);
- var actual = lodashStable.map(emptyValues, function(value) {
- try {
- return func(value, { 'a': 3 });
- } catch (e) {}
- });
+ var emptyValues = lodashStable.endsWith(methodName, 'Index') ? lodashStable.reject(empties, lodashStable.isPlainObject) : empties,
+ expecting = lodashStable.map(emptyValues, lodashStable.constant(expected[1]));
- assert.deepEqual(actual, expecting);
+ var actual = lodashStable.map(emptyValues, function(value) {
+ try {
+ return func(value, { 'a': 3 });
+ } catch (e) {}
});
- }());
- (function() {
- var array = [1, 2, 3, 4];
+ assert.deepEqual(actual, expecting);
+ });
+
+ QUnit.test('`_.' + methodName + '` should return an unwrapped value when implicitly chaining', function(assert) {
+ assert.expect(1);
var expected = ({
- 'find': [0, 1, 2, 3],
- 'findLast': [3, 2, 1, 0],
- 'findIndex': [0, 1, 2, 3],
- 'findLastIndex': [3, 2, 1, 0]
+ 'find': 1,
+ 'findIndex': 0,
+ 'findKey': '0',
+ 'findLast': 4,
+ 'findLastIndex': 3,
+ 'findLastKey': '3'
})[methodName];
- if (expected != null) {
- QUnit.test('`_.' + methodName + '` should pass the index as the second argument for `iteratee`', function(assert) {
- assert.expect(1);
+ if (!isNpm) {
+ assert.strictEqual(_(array)[methodName](), expected);
+ }
+ else {
+ skipAssert(assert);
+ }
+ });
+
+ QUnit.test('`_.' + methodName + '` should return a wrapped value when explicitly chaining', function(assert) {
+ assert.expect(1);
- var actual = [];
+ if (!isNpm) {
+ assert.ok(_(array).chain()[methodName]() instanceof _);
+ }
+ else {
+ skipAssert(assert);
+ }
+ });
- func(array, function(n, index) {
- actual.push(index);
- return false;
- });
+ QUnit.test('`_.' + methodName + '` should not execute immediately when explicitly chaining', function(assert) {
+ assert.expect(1);
- assert.deepEqual(actual, expected);
- });
+ if (!isNpm) {
+ var wrapped = _(array).chain()[methodName]();
+ assert.strictEqual(wrapped.__wrapped__, array);
}
- }());
+ else {
+ skipAssert(assert);
+ }
+ });
- (function() {
- var array = [1, 2, 3, 4];
+ QUnit.test('`_.' + methodName + '` should work in a lazy sequence', function(assert) {
+ assert.expect(2);
- QUnit.test('`_.' + methodName + '` should return an unwrapped value when implicitly chaining', function(assert) {
- assert.expect(1);
+ if (!isNpm) {
+ var largeArray = lodashStable.range(1, LARGE_ARRAY_SIZE + 1),
+ smallArray = array;
- var expected = ({
- 'find': 1,
- 'findLast': 4,
- 'findIndex': 0,
- 'findLastIndex': 3,
- 'findKey': '0',
- 'findLastKey': '3'
- })[methodName];
+ lodashStable.times(2, function(index) {
+ var array = index ? largeArray : smallArray,
+ wrapped = _(array).filter(isEven);
- if (!isNpm) {
- assert.strictEqual(_(array)[methodName](), expected);
- }
- else {
- skipAssert(assert);
- }
- });
+ assert.strictEqual(wrapped[methodName](), func(lodashStable.filter(array, isEven)));
+ });
+ }
+ else {
+ skipAssert(assert, 2);
+ }
+ });
+ });
- QUnit.test('`_.' + methodName + '` should return a wrapped value when explicitly chaining', function(assert) {
- assert.expect(1);
+ _.each(['find', 'findIndex', 'findLast', 'findLastIndex'], function(methodName) {
+ var func = _[methodName];
- if (!isNpm) {
- assert.ok(_(array).chain()[methodName]() instanceof _);
- }
- else {
- skipAssert(assert);
- }
- });
+ QUnit.test('`_.' + methodName + '` should provide correct `predicate` arguments for arrays', function(assert) {
+ assert.expect(1);
- QUnit.test('`_.' + methodName + '` should not execute immediately when explicitly chaining', function(assert) {
- assert.expect(1);
+ var args,
+ array = ['a'];
- if (!isNpm) {
- var wrapped = _(array).chain()[methodName]();
- assert.strictEqual(wrapped.__wrapped__, array);
- }
- else {
- skipAssert(assert);
- }
+ func(array, function() {
+ args || (args = slice.call(arguments));
});
- QUnit.test('`_.' + methodName + '` should work in a lazy sequence', function(assert) {
- assert.expect(2);
+ assert.deepEqual(args, ['a', 0, array]);
+ });
+ });
- if (!isNpm) {
- var largeArray = lodashStable.range(1, LARGE_ARRAY_SIZE + 1),
- smallArray = array;
+ _.each(['find', 'findKey', 'findLast', 'findLastKey'], function(methodName) {
+ var func = _[methodName];
- lodashStable.times(2, function(index) {
- var array = index ? largeArray : smallArray,
- wrapped = _(array).filter(isEven);
+ QUnit.test('`_.' + methodName + '` should work with an object for `collection`', function(assert) {
+ assert.expect(1);
- assert.strictEqual(wrapped[methodName](), func(lodashStable.filter(array, isEven)));
- });
- }
- else {
- skipAssert(assert, 2);
- }
+ var actual = func({ 'a': 1, 'b': 2, 'c': 3 }, function(n) {
+ return n < 3;
});
- }());
- (function() {
var expected = ({
'find': 1,
- 'findLast': 2,
'findKey': 'a',
+ 'findLast': 2,
'findLastKey': 'b'
})[methodName];
- if (expected != null) {
- QUnit.test('`_.' + methodName + '` should work with an object for `collection`', function(assert) {
- assert.expect(1);
-
- var actual = func({ 'a': 1, 'b': 2, 'c': 3 }, function(n) {
- return n < 3;
- });
-
- assert.strictEqual(actual, expected);
- });
- }
- }());
-
- (function() {
- var expected = ({
- 'find': ['a', 'b', 'c'],
- 'findLast': ['c', 'b', 'a'],
- 'findKey': ['a', 'b', 'c'],
- 'findLastKey': ['c', 'b', 'a']
- })[methodName];
+ assert.strictEqual(actual, expected);
+ });
- if (expected != null) {
- QUnit.test('`_.' + methodName + '` should pass the key as the second argument for `iteratee`', function(assert) {
- assert.expect(1);
+ QUnit.test('`_.' + methodName + '` should provide correct `predicate` arguments for objects', function(assert) {
+ assert.expect(1);
- var actual = [];
+ var args,
+ object = { 'a': 1 };
- func({ 'a': 1, 'b': 2, 'c': 3 }, function(n, key) {
- actual.push(key);
- return false;
- });
+ func(object, function() {
+ args || (args = slice.call(arguments));
+ });
- assert.deepEqual(actual, expected);
- });
- }
- }());
+ assert.deepEqual(args, [1, 'a', object]);
+ });
});
/*--------------------------------------------------------------------------*/
@@ -6460,7 +6497,8 @@
(function() {
var args = arguments,
- array = [1, [2, [3, [4]], 5]];
+ array = [1, [2, [3, [4]], 5]],
+ methodNames = ['flatten', 'flattenDeep', 'flattenDepth'];
QUnit.test('should flatten `arguments` objects', function(assert) {
assert.expect(3);
@@ -6480,12 +6518,34 @@
expected.push(undefined, undefined, undefined);
- lodashStable.each([_.flatten(array), _.flattenDeep(array), _.flattenDepth(array)], function(actual) {
+ lodashStable.each(methodNames, function(methodName) {
+ var actual = _[methodName](array);
assert.deepEqual(actual, expected);
assert.ok('4' in actual);
});
});
+ QUnit.test('should flatten objects with a truthy `Symbol.isConcatSpreadable` value', function(assert) {
+ assert.expect(1);
+
+ if (Symbol && Symbol.isConcatSpreadable) {
+ var object = { '0': 'a', 'length': 1 },
+ array = [object],
+ expected = lodashStable.map(methodNames, lodashStable.constant(['a']));
+
+ object[Symbol.isConcatSpreadable] = true;
+
+ var actual = lodashStable.map(methodNames, function(methodName) {
+ return _[methodName](array);
+ });
+
+ assert.deepEqual(actual, expected);
+ }
+ else {
+ skipAssert(assert);
+ }
+ });
+
QUnit.test('should work with extremely large arrays', function(assert) {
assert.expect(3);
@@ -6874,7 +6934,7 @@
isOmitPick = /^(?:omit|pick)By$/.test(methodName),
isSome = methodName == 'some';
- QUnit.test('`_.' + methodName + '` should provide the correct iteratee arguments', function(assert) {
+ QUnit.test('`_.' + methodName + '` should provide correct iteratee arguments', function(assert) {
assert.expect(1);
if (func) {
@@ -7290,7 +7350,7 @@
var func = _[methodName],
isMergeWith = methodName == 'mergeWith';
- QUnit.test('`_.' + methodName + '` should provide the correct `customizer` arguments', function(assert) {
+ QUnit.test('`_.' + methodName + '` should provide correct `customizer` arguments', function(assert) {
assert.expect(3);
var args,
@@ -7895,64 +7955,71 @@
assert.deepEqual(actual, [1, 4, 7]);
});
- QUnit.test('should return an unwrapped value when implicitly chaining', function(assert) {
+ QUnit.test('should be aliased', function(assert) {
assert.expect(1);
+ assert.strictEqual(_.first, _.head);
+ });
+
+ QUnit.test('should return an unwrapped value when implicitly chaining', function(assert) {
+ assert.expect(2);
+
if (!isNpm) {
- assert.strictEqual(_(array).head(), 1);
+ var wrapped = _(array);
+ assert.strictEqual(wrapped.head(), 1);
+ assert.strictEqual(wrapped.first(), 1);
}
else {
- skipAssert(assert);
+ skipAssert(assert, 2);
}
});
QUnit.test('should return a wrapped value when explicitly chaining', function(assert) {
- assert.expect(1);
+ assert.expect(2);
if (!isNpm) {
- assert.ok(_(array).chain().head() instanceof _);
+ var wrapped = _(array).chain();
+ assert.ok(wrapped.head() instanceof _);
+ assert.ok(wrapped.first() instanceof _);
}
else {
- skipAssert(assert);
+ skipAssert(assert, 2);
}
});
QUnit.test('should not execute immediately when explicitly chaining', function(assert) {
- assert.expect(1);
+ assert.expect(2);
if (!isNpm) {
- var wrapped = _(array).chain().head();
- assert.strictEqual(wrapped.__wrapped__, array);
+ var wrapped = _(array).chain();
+ assert.strictEqual(wrapped.head().__wrapped__, array);
+ assert.strictEqual(wrapped.first().__wrapped__, array);
}
else {
- skipAssert(assert);
+ skipAssert(assert, 2);
}
});
QUnit.test('should work in a lazy sequence', function(assert) {
- assert.expect(2);
+ assert.expect(4);
if (!isNpm) {
var largeArray = lodashStable.range(LARGE_ARRAY_SIZE),
smallArray = array;
- lodashStable.times(2, function(index) {
- var array = index ? largeArray : smallArray,
- wrapped = _(array).filter(isEven);
+ lodashStable.each(['head', 'first'], function(methodName) {
+ lodashStable.times(2, function(index) {
+ var array = index ? largeArray : smallArray,
+ actual = _(array).filter(isEven)[methodName]();
- assert.strictEqual(wrapped.head(), _.head(_.filter(array, isEven)));
+ assert.strictEqual(actual, _[methodName](_.filter(array, isEven)));
+ });
});
}
else {
- skipAssert(assert, 2);
+ skipAssert(assert, 4);
}
});
-
- QUnit.test('should be aliased', function(assert) {
- assert.expect(1);
-
- assert.strictEqual(_.first, _.head);
- });
}());
/*--------------------------------------------------------------------------*/
@@ -8086,10 +8153,10 @@
QUnit.test('should work as an iteratee for methods like `_.every`', function(assert) {
assert.expect(1);
- var array1 = [1, 2, 3],
- array2 = [2, 3, 1];
+ var array = [2, 3, 1],
+ values = [1, 2, 3];
- assert.ok(lodashStable.every(array1, lodashStable.partial(_.includes, array2)));
+ assert.ok(lodashStable.every(values, lodashStable.partial(_.includes, array)));
});
}(1, 2, 3, 4));
@@ -8365,7 +8432,7 @@
assert.deepEqual(actual, [{ 'x': 1 }]);
});
- QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -9558,6 +9625,20 @@
assert.strictEqual(_.isEqual(array1, array2), false);
});
+ QUnit.test('should have transitive equivalence for circular references of arrays', function(assert) {
+ assert.expect(3);
+
+ var array1 = [],
+ array2 = [array1],
+ array3 = [array2];
+
+ array1[0] = array1;
+
+ assert.strictEqual(_.isEqual(array1, array2), true);
+ assert.strictEqual(_.isEqual(array2, array3), true);
+ assert.strictEqual(_.isEqual(array1, array3), true);
+ });
+
QUnit.test('should compare objects with circular references', function(assert) {
assert.expect(4);
@@ -9586,6 +9667,20 @@
assert.strictEqual(_.isEqual(object1, object2), false);
});
+ QUnit.test('should have transitive equivalence for circular references of objects', function(assert) {
+ assert.expect(3);
+
+ var object1 = {},
+ object2 = { 'a': object1 },
+ object3 = { 'a': object2 };
+
+ object1.a = object1;
+
+ assert.strictEqual(_.isEqual(object1, object2), true);
+ assert.strictEqual(_.isEqual(object2, object3), true);
+ assert.strictEqual(_.isEqual(object1, object3), true);
+ });
+
QUnit.test('should compare objects with multiple circular references', function(assert) {
assert.expect(3);
@@ -9777,9 +9872,10 @@
var date = new Date(2012, 4, 23);
assert.strictEqual(_.isEqual(date, new Date(2012, 4, 23)), true);
+ assert.strictEqual(_.isEqual(new Date('a'), new Date('b')), true);
+
assert.strictEqual(_.isEqual(date, new Date(2013, 3, 25)), false);
assert.strictEqual(_.isEqual(date, { 'getTime': lodashStable.constant(+date) }), false);
- assert.strictEqual(_.isEqual(new Date('a'), new Date('a')), false);
});
QUnit.test('should compare error objects', function(assert) {
@@ -10077,7 +10173,7 @@
QUnit.module('lodash.isEqualWith');
(function() {
- QUnit.test('should provide the correct `customizer` arguments', function(assert) {
+ QUnit.test('should provide correct `customizer` arguments', function(assert) {
assert.expect(1);
var argsList = [],
@@ -10092,11 +10188,7 @@
[object1.a, object2.a, 'a', object1, object2],
[object1.a[0], object2.a[0], 0, object1.a, object2.a],
[object1.a[1], object2.a[1], 1, object1.a, object2.a],
- [object1.b, object2.b, 'b', object1.b, object2.b],
- [object1.b.a, object2.b.a, 'a', object1.b, object2.b],
- [object1.b.a[0], object2.b.a[0], 0, object1.b.a, object2.b.a],
- [object1.b.a[1], object2.b.a[1], 1, object1.b.a, object2.b.a],
- [object1.b.b, object2.b.b, 'b', object1.b.b, object2.b.b]
+ [object1.b, object2.b, 'b', object1.b, object2.b]
];
_.isEqualWith(object1, object2, function(assert) {
@@ -10490,452 +10582,112 @@
assert.strictEqual(func(new Error), false);
assert.strictEqual(func({ 'a': 1 }), false);
assert.strictEqual(func(/x/), false);
- assert.strictEqual(func('a'), false);
- assert.strictEqual(func(symbol), false);
- });
- });
-
- /*--------------------------------------------------------------------------*/
-
- QUnit.module('lodash.isLength');
-
- (function() {
- QUnit.test('should return `true` for lengths', function(assert) {
- assert.expect(1);
-
- var values = [0, 3, MAX_SAFE_INTEGER],
- expected = lodashStable.map(values, stubTrue),
- actual = lodashStable.map(values, _.isLength);
-
- assert.deepEqual(actual, expected);
- });
-
- QUnit.test('should return `false` for non-lengths', function(assert) {
- assert.expect(1);
-
- var values = [-1, '1', 1.1, MAX_SAFE_INTEGER + 1],
- expected = lodashStable.map(values, stubFalse),
- actual = lodashStable.map(values, _.isLength);
-
- assert.deepEqual(actual, expected);
- });
- }());
-
- /*--------------------------------------------------------------------------*/
-
- QUnit.module('lodash.isMap');
-
- (function() {
- var args = arguments;
-
- QUnit.test('should return `true` for maps', function(assert) {
- assert.expect(1);
-
- if (Map) {
- assert.strictEqual(_.isMap(map), true);
- }
- else {
- skipAssert(assert);
- }
- });
-
- QUnit.test('should return `false` for non-maps', function(assert) {
- assert.expect(14);
-
- var expected = lodashStable.map(falsey, stubFalse);
-
- var actual = lodashStable.map(falsey, function(value, index) {
- return index ? _.isMap(value) : _.isMap();
- });
-
- assert.deepEqual(actual, expected);
-
- assert.strictEqual(_.isMap(args), false);
- assert.strictEqual(_.isMap([1, 2, 3]), false);
- assert.strictEqual(_.isMap(true), false);
- assert.strictEqual(_.isMap(new Date), false);
- assert.strictEqual(_.isMap(new Error), false);
- assert.strictEqual(_.isMap(_), false);
- assert.strictEqual(_.isMap(slice), false);
- assert.strictEqual(_.isMap({ 'a': 1 }), false);
- assert.strictEqual(_.isMap(1), false);
- assert.strictEqual(_.isMap(/x/), false);
- assert.strictEqual(_.isMap('a'), false);
- assert.strictEqual(_.isMap(symbol), false);
- assert.strictEqual(_.isMap(weakMap), false);
- });
-
- QUnit.test('should work for objects with a non-function `constructor` (test in IE 11)', function(assert) {
- assert.expect(1);
-
- var values = [false, true],
- expected = lodashStable.map(values, stubFalse);
-
- var actual = lodashStable.map(values, function(value) {
- return _.isMap({ 'constructor': value });
- });
-
- assert.deepEqual(actual, expected);
- });
-
- QUnit.test('should work with maps from another realm', function(assert) {
- assert.expect(1);
-
- if (realm.map) {
- assert.strictEqual(_.isMap(realm.map), true);
- }
- else {
- skipAssert(assert);
- }
- });
- }(1, 2, 3));
-
- /*--------------------------------------------------------------------------*/
-
- QUnit.module('lodash.isMatch');
-
- (function() {
- QUnit.test('should perform a deep comparison between `object` and `source`', function(assert) {
- assert.expect(5);
-
- var object = { 'a': 1, 'b': 2, 'c': 3 };
- assert.strictEqual(_.isMatch(object, { 'a': 1 }), true);
- assert.strictEqual(_.isMatch(object, { 'b': 1 }), false);
- assert.strictEqual(_.isMatch(object, { 'a': 1, 'c': 3 }), true);
- assert.strictEqual(_.isMatch(object, { 'c': 3, 'd': 4 }), false);
-
- object = { 'a': { 'b': { 'c': 1, 'd': 2 }, 'e': 3 }, 'f': 4 };
- assert.strictEqual(_.isMatch(object, { 'a': { 'b': { 'c': 1 } } }), true);
- });
-
- QUnit.test('should match inherited string keyed `object` properties', function(assert) {
- assert.expect(1);
-
- function Foo() {
- this.a = 1;
- }
- Foo.prototype.b = 2;
-
- assert.strictEqual(_.isMatch({ 'a': new Foo }, { 'a': { 'b': 2 } }), true);
- });
-
- QUnit.test('should not match by inherited `source` properties', function(assert) {
- assert.expect(1);
-
- function Foo() {
- this.a = 1;
- }
- Foo.prototype.b = 2;
-
- var objects = [{ 'a': 1 }, { 'a': 1, 'b': 2 }],
- source = new Foo,
- expected = lodashStable.map(objects, stubTrue);
-
- var actual = lodashStable.map(objects, function(object) {
- return _.isMatch(object, source);
- });
-
- assert.deepEqual(actual, expected);
- });
-
- QUnit.test('should compare a variety of `source` property values', function(assert) {
- assert.expect(2);
-
- var object1 = { 'a': false, 'b': true, 'c': '3', 'd': 4, 'e': [5], 'f': { 'g': 6 } },
- object2 = { 'a': 0, 'b': 1, 'c': 3, 'd': '4', 'e': ['5'], 'f': { 'g': '6' } };
-
- assert.strictEqual(_.isMatch(object1, object1), true);
- assert.strictEqual(_.isMatch(object1, object2), false);
- });
-
- QUnit.test('should match `-0` as `0`', function(assert) {
- assert.expect(2);
-
- var object1 = { 'a': -0 },
- object2 = { 'a': 0 };
-
- assert.strictEqual(_.isMatch(object1, object2), true);
- assert.strictEqual(_.isMatch(object2, object1), true);
- });
-
- QUnit.test('should compare functions by reference', function(assert) {
- assert.expect(3);
-
- var object1 = { 'a': lodashStable.noop },
- object2 = { 'a': noop },
- object3 = { 'a': {} };
-
- assert.strictEqual(_.isMatch(object1, object1), true);
- assert.strictEqual(_.isMatch(object2, object1), false);
- assert.strictEqual(_.isMatch(object3, object1), false);
- });
-
- QUnit.test('should work with a function for `object`', function(assert) {
- assert.expect(1);
-
- function Foo() {}
- Foo.a = { 'b': 2, 'c': 3 };
-
- assert.strictEqual(_.isMatch(Foo, { 'a': { 'b': 2 } }), true);
- });
-
- QUnit.test('should work with a function for `source`', function(assert) {
- assert.expect(1);
-
- function Foo() {}
- Foo.a = 1;
- Foo.b = function() {};
- Foo.c = 3;
-
- var objects = [{ 'a': 1 }, { 'a': 1, 'b': Foo.b, 'c': 3 }];
-
- var actual = lodashStable.map(objects, function(object) {
- return _.isMatch(object, Foo);
- });
-
- assert.deepEqual(actual, [false, true]);
- });
-
- QUnit.test('should work with a non-plain `object`', function(assert) {
- assert.expect(1);
-
- function Foo(object) { lodashStable.assign(this, object); }
-
- var object = new Foo({ 'a': new Foo({ 'b': 2, 'c': 3 }) });
- assert.strictEqual(_.isMatch(object, { 'a': { 'b': 2 } }), true);
- });
-
- QUnit.test('should partial match arrays', function(assert) {
- assert.expect(3);
-
- var objects = [{ 'a': ['b'] }, { 'a': ['c', 'd'] }],
- source = { 'a': ['d'] },
- predicate = function(object) { return _.isMatch(object, source); },
- actual = lodashStable.filter(objects, predicate);
-
- assert.deepEqual(actual, [objects[1]]);
-
- source = { 'a': ['b', 'd'] };
- actual = lodashStable.filter(objects, predicate);
-
- assert.deepEqual(actual, []);
-
- source = { 'a': ['d', 'b'] };
- actual = lodashStable.filter(objects, predicate);
-
- assert.deepEqual(actual, []);
- });
-
- QUnit.test('should partial match arrays with duplicate values', function(assert) {
- assert.expect(1);
-
- var objects = [{ 'a': [1, 2] }, { 'a': [2, 2] }],
- source = { 'a': [2, 2] };
-
- var actual = lodashStable.filter(objects, function(object) {
- return _.isMatch(object, source);
- });
-
- assert.deepEqual(actual, [objects[1]]);
- });
-
- QUnit.test('should partial match arrays of objects', function(assert) {
- assert.expect(1);
-
- var source = { 'a': [{ 'b': 1 }, { 'b': 4, 'c': 5 }] };
-
- var objects = [
- { 'a': [{ 'b': 1, 'c': 2 }, { 'b': 4, 'c': 5, 'd': 6 }] },
- { 'a': [{ 'b': 1, 'c': 2 }, { 'b': 4, 'c': 6, 'd': 7 }] }
- ];
-
- var actual = lodashStable.filter(objects, function(object) {
- return _.isMatch(object, source);
- });
-
- assert.deepEqual(actual, [objects[0]]);
- });
-
- QUnit.test('should partial match maps', function(assert) {
- assert.expect(3);
-
- if (Map) {
- var objects = [{ 'a': new Map }, { 'a': new Map }];
- objects[0].a.set('a', 1);
- objects[1].a.set('a', 1);
- objects[1].a.set('b', 2);
-
- var map = new Map;
- map.set('b', 2);
-
- var source = { 'a': map },
- predicate = function(object) { return _.isMatch(object, source); },
- actual = lodashStable.filter(objects, predicate);
-
- assert.deepEqual(actual, [objects[1]]);
-
- map['delete']('b');
- actual = lodashStable.filter(objects, predicate);
-
- assert.deepEqual(actual, objects);
-
- map.set('c', 3);
- actual = lodashStable.filter(objects, predicate);
-
- assert.deepEqual(actual, []);
- }
- else {
- skipAssert(assert, 3);
- }
- });
-
- QUnit.test('should partial match sets', function(assert) {
- assert.expect(3);
-
- if (Set) {
- var objects = [{ 'a': new Set }, { 'a': new Set }];
- objects[0].a.add(1);
- objects[1].a.add(1);
- objects[1].a.add(2);
-
- var set = new Set;
- set.add(2);
-
- var source = { 'a': set },
- predicate = function(object) { return _.isMatch(object, source); },
- actual = lodashStable.filter(objects, predicate);
-
- assert.deepEqual(actual, [objects[1]]);
-
- set['delete'](2);
- actual = lodashStable.filter(objects, predicate);
-
- assert.deepEqual(actual, objects);
-
- set.add(3);
- actual = lodashStable.filter(objects, predicate);
-
- assert.deepEqual(actual, []);
- }
- else {
- skipAssert(assert, 3);
- }
+ assert.strictEqual(func('a'), false);
+ assert.strictEqual(func(symbol), false);
});
+ });
- QUnit.test('should match `undefined` values', function(assert) {
- assert.expect(3);
+ /*--------------------------------------------------------------------------*/
- var objects = [{ 'a': 1 }, { 'a': 1, 'b': 1 }, { 'a': 1, 'b': undefined }],
- source = { 'b': undefined },
- predicate = function(object) { return _.isMatch(object, source); },
- actual = lodashStable.map(objects, predicate),
- expected = [false, false, true];
+ QUnit.module('lodash.isLength');
- assert.deepEqual(actual, expected);
+ (function() {
+ QUnit.test('should return `true` for lengths', function(assert) {
+ assert.expect(1);
- source = { 'a': 1, 'b': undefined };
- actual = lodashStable.map(objects, predicate);
+ var values = [0, 3, MAX_SAFE_INTEGER],
+ expected = lodashStable.map(values, stubTrue),
+ actual = lodashStable.map(values, _.isLength);
assert.deepEqual(actual, expected);
+ });
- objects = [{ 'a': { 'b': 2 } }, { 'a': { 'b': 2, 'c': 3 } }, { 'a': { 'b': 2, 'c': undefined } }];
- source = { 'a': { 'c': undefined } };
- actual = lodashStable.map(objects, predicate);
+ QUnit.test('should return `false` for non-lengths', function(assert) {
+ assert.expect(1);
+
+ var values = [-1, '1', 1.1, MAX_SAFE_INTEGER + 1],
+ expected = lodashStable.map(values, stubFalse),
+ actual = lodashStable.map(values, _.isLength);
assert.deepEqual(actual, expected);
});
+ }());
- QUnit.test('should match `undefined` values on primitives', function(assert) {
- assert.expect(3);
+ /*--------------------------------------------------------------------------*/
- numberProto.a = 1;
- numberProto.b = undefined;
+ QUnit.module('lodash.isMap');
- try {
- assert.strictEqual(_.isMatch(1, { 'b': undefined }), true);
- } catch (e) {
- assert.ok(false, e.message);
- }
- try {
- assert.strictEqual(_.isMatch(1, { 'a': 1, 'b': undefined }), true);
- } catch (e) {
- assert.ok(false, e.message);
- }
- numberProto.a = { 'b': 1, 'c': undefined };
- try {
- assert.strictEqual(_.isMatch(1, { 'a': { 'c': undefined } }), true);
- } catch (e) {
- assert.ok(false, e.message);
- }
- delete numberProto.a;
- delete numberProto.b;
- });
+ (function() {
+ var args = arguments;
- QUnit.test('should return `false` when `object` is nullish', function(assert) {
+ QUnit.test('should return `true` for maps', function(assert) {
assert.expect(1);
- var values = [null, undefined],
- expected = lodashStable.map(values, stubFalse),
- source = { 'a': 1 };
-
- var actual = lodashStable.map(values, function(value) {
- try {
- return _.isMatch(value, source);
- } catch (e) {}
- });
-
- assert.deepEqual(actual, expected);
+ if (Map) {
+ assert.strictEqual(_.isMap(map), true);
+ }
+ else {
+ skipAssert(assert);
+ }
});
- QUnit.test('should return `true` when comparing an empty `source` to a nullish `object`', function(assert) {
- assert.expect(1);
+ QUnit.test('should return `false` for non-maps', function(assert) {
+ assert.expect(14);
- var values = [null, undefined],
- expected = lodashStable.map(values, stubTrue),
- source = {};
+ var expected = lodashStable.map(falsey, stubFalse);
- var actual = lodashStable.map(values, function(value) {
- try {
- return _.isMatch(value, source);
- } catch (e) {}
+ var actual = lodashStable.map(falsey, function(value, index) {
+ return index ? _.isMap(value) : _.isMap();
});
assert.deepEqual(actual, expected);
+
+ assert.strictEqual(_.isMap(args), false);
+ assert.strictEqual(_.isMap([1, 2, 3]), false);
+ assert.strictEqual(_.isMap(true), false);
+ assert.strictEqual(_.isMap(new Date), false);
+ assert.strictEqual(_.isMap(new Error), false);
+ assert.strictEqual(_.isMap(_), false);
+ assert.strictEqual(_.isMap(slice), false);
+ assert.strictEqual(_.isMap({ 'a': 1 }), false);
+ assert.strictEqual(_.isMap(1), false);
+ assert.strictEqual(_.isMap(/x/), false);
+ assert.strictEqual(_.isMap('a'), false);
+ assert.strictEqual(_.isMap(symbol), false);
+ assert.strictEqual(_.isMap(weakMap), false);
});
- QUnit.test('should return `true` when comparing an empty `source`', function(assert) {
+ QUnit.test('should work for objects with a non-function `constructor` (test in IE 11)', function(assert) {
assert.expect(1);
- var object = { 'a': 1 },
- expected = lodashStable.map(empties, stubTrue);
+ var values = [false, true],
+ expected = lodashStable.map(values, stubFalse);
- var actual = lodashStable.map(empties, function(value) {
- return _.isMatch(object, value);
+ var actual = lodashStable.map(values, function(value) {
+ return _.isMap({ 'constructor': value });
});
assert.deepEqual(actual, expected);
});
- QUnit.test('should return `true` when comparing a `source` of empty arrays and objects', function(assert) {
+ QUnit.test('should work with maps from another realm', function(assert) {
assert.expect(1);
- var objects = [{ 'a': [1], 'b': { 'c': 1 } }, { 'a': [2, 3], 'b': { 'd': 2 } }],
- source = { 'a': [], 'b': {} };
-
- var actual = lodashStable.filter(objects, function(object) {
- return _.isMatch(object, source);
- });
-
- assert.deepEqual(actual, objects);
+ if (realm.map) {
+ assert.strictEqual(_.isMap(realm.map), true);
+ }
+ else {
+ skipAssert(assert);
+ }
});
- }());
+ }(1, 2, 3));
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.isMatchWith');
(function() {
- QUnit.test('should provide the correct `customizer` arguments', function(assert) {
+ QUnit.test('should provide correct `customizer` arguments', function(assert) {
assert.expect(1);
var argsList = [],
@@ -10953,11 +10705,7 @@
[object1.b.a, object2.b.a, 'a', object1.b, object2.b],
[object1.b.a[0], object2.b.a[0], 0, object1.b.a, object2.b.a],
[object1.b.a[1], object2.b.a[1], 1, object1.b.a, object2.b.a],
- [object1.b.b, object2.b.b, 'b', object1.b, object2.b],
- [object1.b.b.a, object2.b.b.a, 'a', object1.b.b, object2.b.b],
- [object1.b.b.a[0], object2.b.b.a[0], 0, object1.b.b.a, object2.b.b.a],
- [object1.b.b.a[1], object2.b.b.a[1], 1, object1.b.b.a, object2.b.b.a],
- [object1.b.b.b, object2.b.b.b, 'b', object1.b.b, object2.b.b]
+ [object1.b.b, object2.b.b, 'b', object1.b, object2.b]
];
_.isMatchWith(object1, object2, function(assert) {
@@ -13659,7 +13407,7 @@
}
});
- QUnit.test('should provide the correct `predicate` arguments in a lazy sequence', function(assert) {
+ QUnit.test('should provide correct `predicate` arguments in a lazy sequence', function(assert) {
assert.expect(5);
if (!isNpm) {
@@ -13842,36 +13590,76 @@
});
});
- /*--------------------------------------------------------------------------*/
-
QUnit.module('lodash.matches');
(function() {
- QUnit.test('should create a function that performs a deep comparison between `source` and a given object', function(assert) {
- assert.expect(6);
+ QUnit.test('should not change behavior if `source` is modified', function(assert) {
+ assert.expect(9);
+
+ var sources = [
+ { 'a': { 'b': 2, 'c': 3 } },
+ { 'a': 1, 'b': 2 },
+ { 'a': 1 }
+ ];
+
+ lodashStable.each(sources, function(source, index) {
+ var object = lodashStable.cloneDeep(source),
+ par = _.matches(source);
+
+ assert.strictEqual(par(object), true);
+
+ if (index) {
+ source.a = 2;
+ source.b = 1;
+ source.c = 3;
+ } else {
+ source.a.b = 1;
+ source.a.c = 2;
+ source.a.d = 3;
+ }
+ assert.strictEqual(par(object), true);
+ assert.strictEqual(par(source), false);
+ });
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
+ QUnit.module('matches methods');
+
+ lodashStable.each(['matches', 'isMatch'], function(methodName) {
+ var isMatches = methodName == 'matches';
+
+ function matches(source) {
+ return isMatches ? _.matches(source) : function(object) {
+ return _.isMatch(object, source);
+ };
+ }
+
+ QUnit.test('`_.' + methodName + '` should perform a deep comparison between `source` and `object`', function(assert) {
+ assert.expect(5);
var object = { 'a': 1, 'b': 2, 'c': 3 },
- matches = _.matches({ 'a': 1 });
+ par = matches({ 'a': 1 });
- assert.strictEqual(matches.length, 1);
- assert.strictEqual(matches(object), true);
+ assert.strictEqual(par(object), true);
- matches = _.matches({ 'b': 1 });
- assert.strictEqual(matches(object), false);
+ par = matches({ 'b': 1 });
+ assert.strictEqual(par(object), false);
- matches = _.matches({ 'a': 1, 'c': 3 });
- assert.strictEqual(matches(object), true);
+ par = matches({ 'a': 1, 'c': 3 });
+ assert.strictEqual(par(object), true);
- matches = _.matches({ 'c': 3, 'd': 4 });
- assert.strictEqual(matches(object), false);
+ par = matches({ 'c': 3, 'd': 4 });
+ assert.strictEqual(par(object), false);
object = { 'a': { 'b': { 'c': 1, 'd': 2 }, 'e': 3 }, 'f': 4 };
- matches = _.matches({ 'a': { 'b': { 'c': 1 } } });
+ par = matches({ 'a': { 'b': { 'c': 1 } } });
- assert.strictEqual(matches(object), true);
+ assert.strictEqual(par(object), true);
});
- QUnit.test('should match inherited string keyed `object` properties', function(assert) {
+ QUnit.test('`_.' + methodName + '` should match inherited string keyed `object` properties', function(assert) {
assert.expect(1);
function Foo() {
@@ -13880,12 +13668,12 @@
Foo.prototype.b = 2;
var object = { 'a': new Foo },
- matches = _.matches({ 'a': { 'b': 2 } });
+ par = matches({ 'a': { 'b': 2 } });
- assert.strictEqual(matches(object), true);
+ assert.strictEqual(par(object), true);
});
- QUnit.test('should not match by inherited `source` properties', function(assert) {
+ QUnit.test('`_.' + methodName + '` should not match by inherited `source` properties', function(assert) {
assert.expect(1);
function Foo() {
@@ -13895,60 +13683,60 @@
var objects = [{ 'a': 1 }, { 'a': 1, 'b': 2 }],
source = new Foo,
- actual = lodashStable.map(objects, _.matches(source)),
+ actual = lodashStable.map(objects, matches(source)),
expected = lodashStable.map(objects, stubTrue);
assert.deepEqual(actual, expected);
});
- QUnit.test('should compare a variety of `source` property values', function(assert) {
+ QUnit.test('`_.' + methodName + '` should compare a variety of `source` property values', function(assert) {
assert.expect(2);
var object1 = { 'a': false, 'b': true, 'c': '3', 'd': 4, 'e': [5], 'f': { 'g': 6 } },
object2 = { 'a': 0, 'b': 1, 'c': 3, 'd': '4', 'e': ['5'], 'f': { 'g': '6' } },
- matches = _.matches(object1);
+ par = matches(object1);
- assert.strictEqual(matches(object1), true);
- assert.strictEqual(matches(object2), false);
+ assert.strictEqual(par(object1), true);
+ assert.strictEqual(par(object2), false);
});
- QUnit.test('should match `-0` as `0`', function(assert) {
+ QUnit.test('`_.' + methodName + '` should match `-0` as `0`', function(assert) {
assert.expect(2);
var object1 = { 'a': -0 },
object2 = { 'a': 0 },
- matches = _.matches(object1);
+ par = matches(object1);
- assert.strictEqual(matches(object2), true);
+ assert.strictEqual(par(object2), true);
- matches = _.matches(object2);
- assert.strictEqual(matches(object1), true);
+ par = matches(object2);
+ assert.strictEqual(par(object1), true);
});
- QUnit.test('should compare functions by reference', function(assert) {
+ QUnit.test('`_.' + methodName + '` should compare functions by reference', function(assert) {
assert.expect(3);
var object1 = { 'a': lodashStable.noop },
object2 = { 'a': noop },
object3 = { 'a': {} },
- matches = _.matches(object1);
+ par = matches(object1);
- assert.strictEqual(matches(object1), true);
- assert.strictEqual(matches(object2), false);
- assert.strictEqual(matches(object3), false);
+ assert.strictEqual(par(object1), true);
+ assert.strictEqual(par(object2), false);
+ assert.strictEqual(par(object3), false);
});
- QUnit.test('should work with a function for `object`', function(assert) {
+ QUnit.test('`_.' + methodName + '` should work with a function for `object`', function(assert) {
assert.expect(1);
function Foo() {}
Foo.a = { 'b': 2, 'c': 3 };
- var matches = _.matches({ 'a': { 'b': 2 } });
- assert.strictEqual(matches(Foo), true);
+ var par = matches({ 'a': { 'b': 2 } });
+ assert.strictEqual(par(Foo), true);
});
- QUnit.test('should work with a function for `source`', function(assert) {
+ QUnit.test('`_.' + methodName + '` should work with a function for `source`', function(assert) {
assert.expect(1);
function Foo() {}
@@ -13957,42 +13745,42 @@
Foo.c = 3;
var objects = [{ 'a': 1 }, { 'a': 1, 'b': Foo.b, 'c': 3 }],
- actual = lodashStable.map(objects, _.matches(Foo));
+ actual = lodashStable.map(objects, matches(Foo));
assert.deepEqual(actual, [false, true]);
});
- QUnit.test('should work with a non-plain `object`', function(assert) {
+ QUnit.test('`_.' + methodName + '` should work with a non-plain `object`', function(assert) {
assert.expect(1);
function Foo(object) { lodashStable.assign(this, object); }
var object = new Foo({ 'a': new Foo({ 'b': 2, 'c': 3 }) }),
- matches = _.matches({ 'a': { 'b': 2 } });
+ par = matches({ 'a': { 'b': 2 } });
- assert.strictEqual(matches(object), true);
+ assert.strictEqual(par(object), true);
});
- QUnit.test('should partial match arrays', function(assert) {
+ QUnit.test('`_.' + methodName + '` should partial match arrays', function(assert) {
assert.expect(3);
var objects = [{ 'a': ['b'] }, { 'a': ['c', 'd'] }],
- actual = lodashStable.filter(objects, _.matches({ 'a': ['d'] }));
+ actual = lodashStable.filter(objects, matches({ 'a': ['d'] }));
assert.deepEqual(actual, [objects[1]]);
- actual = lodashStable.filter(objects, _.matches({ 'a': ['b', 'd'] }));
+ actual = lodashStable.filter(objects, matches({ 'a': ['b', 'd'] }));
assert.deepEqual(actual, []);
- actual = lodashStable.filter(objects, _.matches({ 'a': ['d', 'b'] }));
+ actual = lodashStable.filter(objects, matches({ 'a': ['d', 'b'] }));
assert.deepEqual(actual, []);
});
- QUnit.test('should partial match arrays with duplicate values', function(assert) {
+ QUnit.test('`_.' + methodName + '` should partial match arrays with duplicate values', function(assert) {
assert.expect(1);
var objects = [{ 'a': [1, 2] }, { 'a': [2, 2] }],
- actual = lodashStable.filter(objects, _.matches({ 'a': [2, 2] }));
+ actual = lodashStable.filter(objects, matches({ 'a': [2, 2] }));
assert.deepEqual(actual, [objects[1]]);
});
@@ -14005,11 +13793,11 @@
{ 'a': [{ 'b': 1, 'c': 2 }, { 'b': 4, 'c': 6, 'd': 7 }] }
];
- var actual = lodashStable.filter(objects, _.matches({ 'a': [{ 'b': 1 }, { 'b': 4, 'c': 5 }] }));
+ var actual = lodashStable.filter(objects, matches({ 'a': [{ 'b': 1 }, { 'b': 4, 'c': 5 }] }));
assert.deepEqual(actual, [objects[0]]);
});
- QUnit.test('should partial match maps', function(assert) {
+ QUnit.test('`_.' + methodName + '` should partial match maps', function(assert) {
assert.expect(3);
if (Map) {
@@ -14020,17 +13808,17 @@
var map = new Map;
map.set('b', 2);
- var actual = lodashStable.filter(objects, _.matches({ 'a': map }));
+ var actual = lodashStable.filter(objects, matches({ 'a': map }));
assert.deepEqual(actual, [objects[1]]);
map['delete']('b');
- actual = lodashStable.filter(objects, _.matches({ 'a': map }));
+ actual = lodashStable.filter(objects, matches({ 'a': map }));
assert.deepEqual(actual, objects);
map.set('c', 3);
- actual = lodashStable.filter(objects, _.matches({ 'a': map }));
+ actual = lodashStable.filter(objects, matches({ 'a': map }));
assert.deepEqual(actual, []);
}
@@ -14039,7 +13827,7 @@
}
});
- QUnit.test('should partial match sets', function(assert) {
+ QUnit.test('`_.' + methodName + '` should partial match sets', function(assert) {
assert.expect(3);
if (Set) {
@@ -14050,17 +13838,17 @@
var set = new Set;
set.add(2);
- var actual = lodashStable.filter(objects, _.matches({ 'a': set }));
+ var actual = lodashStable.filter(objects, matches({ 'a': set }));
assert.deepEqual(actual, [objects[1]]);
set['delete'](2);
- actual = lodashStable.filter(objects, _.matches({ 'a': set }));
+ actual = lodashStable.filter(objects, matches({ 'a': set }));
assert.deepEqual(actual, objects);
set.add(3);
- actual = lodashStable.filter(objects, _.matches({ 'a': set }));
+ actual = lodashStable.filter(objects, matches({ 'a': set }));
assert.deepEqual(actual, []);
}
@@ -14069,47 +13857,47 @@
}
});
- QUnit.test('should match `undefined` values', function(assert) {
+ QUnit.test('`_.' + methodName + '` should match `undefined` values', function(assert) {
assert.expect(3);
var objects = [{ 'a': 1 }, { 'a': 1, 'b': 1 }, { 'a': 1, 'b': undefined }],
- actual = lodashStable.map(objects, _.matches({ 'b': undefined })),
+ actual = lodashStable.map(objects, matches({ 'b': undefined })),
expected = [false, false, true];
assert.deepEqual(actual, expected);
- actual = lodashStable.map(objects, _.matches({ 'a': 1, 'b': undefined }));
+ actual = lodashStable.map(objects, matches({ 'a': 1, 'b': undefined }));
assert.deepEqual(actual, expected);
objects = [{ 'a': { 'b': 2 } }, { 'a': { 'b': 2, 'c': 3 } }, { 'a': { 'b': 2, 'c': undefined } }];
- actual = lodashStable.map(objects, _.matches({ 'a': { 'c': undefined } }));
+ actual = lodashStable.map(objects, matches({ 'a': { 'c': undefined } }));
assert.deepEqual(actual, expected);
});
- QUnit.test('should match `undefined` values on primitives', function(assert) {
+ QUnit.test('`_.' + methodName + '` should match `undefined` values on primitives', function(assert) {
assert.expect(3);
numberProto.a = 1;
numberProto.b = undefined;
try {
- var matches = _.matches({ 'b': undefined });
- assert.strictEqual(matches(1), true);
+ var par = matches({ 'b': undefined });
+ assert.strictEqual(par(1), true);
} catch (e) {
assert.ok(false, e.message);
}
try {
- matches = _.matches({ 'a': 1, 'b': undefined });
- assert.strictEqual(matches(1), true);
+ par = matches({ 'a': 1, 'b': undefined });
+ assert.strictEqual(par(1), true);
} catch (e) {
assert.ok(false, e.message);
}
numberProto.a = { 'b': 1, 'c': undefined };
try {
- matches = _.matches({ 'a': { 'c': undefined } });
- assert.strictEqual(matches(1), true);
+ par = matches({ 'a': { 'c': undefined } });
+ assert.strictEqual(par(1), true);
} catch (e) {
assert.ok(false, e.message);
}
@@ -14117,90 +13905,61 @@
delete numberProto.b;
});
- QUnit.test('should return `false` when `object` is nullish', function(assert) {
+ QUnit.test('`_.' + methodName + '` should return `false` when `object` is nullish', function(assert) {
assert.expect(1);
var values = [, null, undefined],
expected = lodashStable.map(values, stubFalse),
- matches = _.matches({ 'a': 1 });
+ par = matches({ 'a': 1 });
var actual = lodashStable.map(values, function(value, index) {
try {
- return index ? matches(value) : matches();
+ return index ? par(value) : par();
} catch (e) {}
});
assert.deepEqual(actual, expected);
});
- QUnit.test('should return `true` when comparing an empty `source` to a nullish `object`', function(assert) {
+ QUnit.test('`_.' + methodName + '` hould return `true` when comparing an empty `source`', function(assert) {
assert.expect(1);
- var values = [, null, undefined],
- expected = lodashStable.map(values, stubTrue),
- matches = _.matches({});
+ var object = { 'a': 1 },
+ expected = lodashStable.map(empties, stubTrue);
- var actual = lodashStable.map(values, function(value, index) {
- try {
- return index ? matches(value) : matches();
- } catch (e) {}
+ var actual = lodashStable.map(empties, function(value) {
+ var par = matches(value);
+ return par(object);
});
assert.deepEqual(actual, expected);
});
- QUnit.test('should return `true` when comparing an empty `source`', function(assert) {
+ QUnit.test('`_.' + methodName + '` should return `true` when comparing an empty `source` to a nullish `object`', function(assert) {
assert.expect(1);
- var object = { 'a': 1 },
- expected = lodashStable.map(empties, stubTrue);
+ var values = [, null, undefined],
+ expected = lodashStable.map(values, stubTrue),
+ par = matches({});
- var actual = lodashStable.map(empties, function(value) {
- var matches = _.matches(value);
- return matches(object);
+ var actual = lodashStable.map(values, function(value, index) {
+ try {
+ return index ? par(value) : par();
+ } catch (e) {}
});
assert.deepEqual(actual, expected);
});
- QUnit.test('should return `true` when comparing a `source` of empty arrays and objects', function(assert) {
+ QUnit.test('`_.' + methodName + '` should return `true` when comparing a `source` of empty arrays and objects', function(assert) {
assert.expect(1);
var objects = [{ 'a': [1], 'b': { 'c': 1 } }, { 'a': [2, 3], 'b': { 'd': 2 } }],
- actual = lodashStable.filter(objects, _.matches({ 'a': [], 'b': {} }));
+ actual = lodashStable.filter(objects, matches({ 'a': [], 'b': {} }));
assert.deepEqual(actual, objects);
});
-
- QUnit.test('should not change behavior if `source` is modified', function(assert) {
- assert.expect(9);
-
- var sources = [
- { 'a': { 'b': 2, 'c': 3 } },
- { 'a': 1, 'b': 2 },
- { 'a': 1 }
- ];
-
- lodashStable.each(sources, function(source, index) {
- var object = lodashStable.cloneDeep(source),
- matches = _.matches(source);
-
- assert.strictEqual(matches(object), true);
-
- if (index) {
- source.a = 2;
- source.b = 1;
- source.c = 3;
- } else {
- source.a.b = 1;
- source.a.c = 2;
- source.a.d = 3;
- }
- assert.strictEqual(matches(object), true);
- assert.strictEqual(matches(source), false);
- });
- });
- }());
+ });
/*--------------------------------------------------------------------------*/
@@ -14704,7 +14463,7 @@
assert.deepEqual(actual, 2);
});
- QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -16135,7 +15894,7 @@
QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
assert.expect(1);
- var over = _.overArgs(fn, ['b', 1], [['a', 1]]);
+ var over = _.overArgs(fn, [['b', 1], ['a', 1]]);
assert.deepEqual(over({ 'b': 2 }, { 'a': 1 }), [false, true]);
});
@@ -16724,7 +16483,7 @@
QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
assert.expect(2);
- var over = _.over(['b', 2], [['a', 2]]);
+ var over = _.over([['b', 2], ['a', 2]]);
assert.deepEqual(over({ 'a': 1, 'b': 2 }), [true, false]);
assert.deepEqual(over({ 'a': 2, 'b': 1 }), [false, true]);
@@ -16818,7 +16577,7 @@
QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
assert.expect(2);
- var over = _.overEvery(['b', 2], [['a', 1]]);
+ var over = _.overEvery([['b', 2], ['a', 1]]);
assert.strictEqual(over({ 'a': 1, 'b': 2 }), true);
assert.strictEqual(over({ 'a': 0, 'b': 2 }), false);
@@ -16939,7 +16698,7 @@
QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
assert.expect(2);
- var over = _.overSome(['a', 1], [['b', 2]]);
+ var over = _.overSome([['b', 2], ['a', 1]]);
assert.strictEqual(over({ 'a': 0, 'b': 2 }), true);
assert.strictEqual(over({ 'a': 0, 'b': 0 }), false);
@@ -18152,7 +17911,7 @@
assert.deepEqual(actual, [{ 'x': 2 }]);
});
- QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args,
@@ -18692,7 +18451,7 @@
assert.strictEqual(_.reduce(array), 1);
});
- QUnit.test('should provide the correct `iteratee` arguments when iterating an array', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments when iterating an array', function(assert) {
assert.expect(2);
var args;
@@ -18711,7 +18470,7 @@
assert.deepEqual(args, [1, 2, 1, array]);
});
- QUnit.test('should provide the correct `iteratee` arguments when iterating an object', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments when iterating an object', function(assert) {
assert.expect(2);
var args,
@@ -18754,7 +18513,7 @@
assert.strictEqual(_.reduceRight(array), 3);
});
- QUnit.test('should provide the correct `iteratee` arguments when iterating an array', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments when iterating an array', function(assert) {
assert.expect(2);
var args;
@@ -18773,7 +18532,7 @@
assert.deepEqual(args, [3, 2, 1, array]);
});
- QUnit.test('should provide the correct `iteratee` arguments when iterating an object', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments when iterating an object', function(assert) {
assert.expect(2);
var args,
@@ -18989,7 +18748,7 @@
}
});
- QUnit.test('`_.' + methodName + '` should provide the correct `predicate` arguments in a lazy sequence', function(assert) {
+ QUnit.test('`_.' + methodName + '` should provide correct `predicate` arguments in a lazy sequence', function(assert) {
assert.expect(5);
if (!isNpm) {
@@ -19052,7 +18811,7 @@
assert.deepEqual(actual, [2, 4]);
});
- QUnit.test('should provide the correct `predicate` arguments', function(assert) {
+ QUnit.test('should provide correct `predicate` arguments', function(assert) {
assert.expect(1);
var argsList = [],
@@ -19458,7 +19217,7 @@
assert.deepEqual(rest(1, 2, 3, 4), [1, [2, 3, 4]]);
});
- QUnit.test('should treat `start` as `0` for negative or `NaN` values', function(assert) {
+ QUnit.test('should treat `start` as `0` for `NaN` or negative values', function(assert) {
assert.expect(1);
var values = [-1, NaN, 'a'],
@@ -20597,7 +20356,7 @@
assert.deepEqual(actual, [3, 1, 2]);
});
- QUnit.test('should move symbol, `null`, `undefined`, and `NaN` values to the end', function(assert) {
+ QUnit.test('should move `NaN`, nullish, and symbol values to the end', function(assert) {
assert.expect(2);
var symbol1 = Symbol ? Symbol('a') : null,
@@ -20836,7 +20595,7 @@
var func = _[methodName],
isSortedIndexBy = methodName == 'sortedIndexBy';
- QUnit.test('`_.' + methodName + '` should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('`_.' + methodName + '` should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -21003,7 +20762,7 @@
assert.deepEqual(actual, expected);
});
- QUnit.test('should provide the correct `func` arguments', function(assert) {
+ QUnit.test('should provide correct `func` arguments', function(assert) {
assert.expect(1);
var args;
@@ -21118,14 +20877,6 @@
assert.strictEqual(_.startsWith(string, 'bc', 1.2), true);
});
-
- QUnit.test('should return `true` when `target` is an empty string regardless of `position`', function(assert) {
- assert.expect(1);
-
- assert.ok(lodashStable.every([-Infinity, NaN, -3, -1, 0, 1, 2, 3, 5, MAX_SAFE_INTEGER, Infinity], function(position) {
- return _.startsWith(string, '', position, true);
- }));
- });
}());
/*--------------------------------------------------------------------------*/
@@ -21157,9 +20908,20 @@
assert.expect(2);
var position = isStartsWith ? 1 : 2;
+
assert.strictEqual(func(string, 'b', Object(position)), true);
assert.strictEqual(func(string, 'b', { 'toString': lodashStable.constant(String(position)) }), true);
});
+
+ QUnit.test('should return `true` when `target` is an empty string regardless of `position`', function(assert) {
+ assert.expect(1);
+
+ var positions = [-Infinity, NaN, -3, -1, 0, 1, 2, 3, 5, MAX_SAFE_INTEGER, Infinity];
+
+ assert.ok(lodashStable.every(positions, function(position) {
+ return func(string, '', position);
+ }));
+ });
});
/*--------------------------------------------------------------------------*/
@@ -21221,12 +20983,13 @@
QUnit.module('math operator methods');
lodashStable.each(['add', 'divide', 'multiply', 'subtract'], function(methodName) {
- var func = _[methodName];
+ var func = _[methodName],
+ isAddSub = methodName == 'add' || methodName == 'subtract';
- QUnit.test('`_.' + methodName + '` should return `0` when no arguments are given', function(assert) {
+ QUnit.test('`_.' + methodName + '` should return `' + (isAddSub ? 0 : 1) + '` when no arguments are given', function(assert) {
assert.expect(1);
- assert.strictEqual(func(), 0);
+ assert.strictEqual(func(), isAddSub ? 0 : 1);
});
QUnit.test('`_.' + methodName + '` should work with only one defined argument', function(assert) {
@@ -21315,7 +21078,7 @@
assert.deepEqual(actual, 6);
});
- QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -21667,7 +21430,7 @@
assert.deepEqual(actual, [3, 4]);
});
- QUnit.test('should provide the correct `predicate` arguments', function(assert) {
+ QUnit.test('should provide correct `predicate` arguments', function(assert) {
assert.expect(1);
var args;
@@ -21715,7 +21478,7 @@
}
});
- QUnit.test('should provide the correct `predicate` arguments in a lazy sequence', function(assert) {
+ QUnit.test('should provide correct `predicate` arguments in a lazy sequence', function(assert) {
assert.expect(5);
if (!isNpm) {
@@ -21782,7 +21545,7 @@
assert.deepEqual(actual, [1, 2]);
});
- QUnit.test('should provide the correct `predicate` arguments', function(assert) {
+ QUnit.test('should provide correct `predicate` arguments', function(assert) {
assert.expect(1);
var args;
@@ -21848,7 +21611,7 @@
}
});
- QUnit.test('should provide the correct `predicate` arguments in a lazy sequence', function(assert) {
+ QUnit.test('should provide correct `predicate` arguments in a lazy sequence', function(assert) {
assert.expect(5);
if (!isNpm) {
@@ -23081,7 +22844,7 @@
assert.deepEqual(actual, [0, 1]);
});
- QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -23162,7 +22925,7 @@
QUnit.test('should convert iterables to arrays', function(assert) {
assert.expect(1);
- if (!isNpm && Symbol && Symbol.iterator) {
+ if (Symbol && Symbol.iterator) {
var object = { '0': 'a', 'length': 1 };
object[Symbol.iterator] = arrayProto[Symbol.iterator];
@@ -24042,7 +23805,7 @@
'object': { 'a': 1, 'b': 2, 'c': 3 }
},
function(object, key) {
- QUnit.test('should provide the correct `iteratee` arguments when transforming an ' + key, function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments when transforming an ' + key, function(assert) {
assert.expect(2);
var args;
@@ -24387,12 +24150,21 @@
assert.deepEqual(actual, [6, 8, 10]);
});
- QUnit.test('should work when provided less than the capped number of arguments', function(assert) {
+ QUnit.test('should not force a minimum argument count', function(assert) {
assert.expect(1);
var capped = _.unary(fn);
assert.deepEqual(capped(), []);
});
+
+ QUnit.test('should use `this` binding of function', function(assert) {
+ assert.expect(1);
+
+ var capped = _.unary(function(a, b) { return this; }),
+ object = { 'capped': capped };
+
+ assert.strictEqual(object.capped(), object);
+ });
}());
/*--------------------------------------------------------------------------*/
@@ -24491,7 +24263,7 @@
assert.deepEqual(actual, [{ 'x': 1 }, { 'x': 2 }]);
});
- QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -24502,6 +24274,13 @@
assert.deepEqual(args, [2.1]);
});
+
+ QUnit.test('should output values from the first possible array', function(assert) {
+ assert.expect(1);
+
+ var actual = _.unionBy([{ 'x': 1, 'y': 1 }], [{ 'x': 1, 'y': 2 }], 'x');
+ assert.deepEqual(actual, [{ 'x': 1, 'y': 1 }]);
+ });
}());
/*--------------------------------------------------------------------------*/
@@ -24518,6 +24297,19 @@
assert.deepEqual(actual, [objects[0], objects[1], others[0]]);
});
+
+ QUnit.test('should output values from the first possible array', function(assert) {
+ assert.expect(1);
+
+ var objects = [{ 'x': 1, 'y': 1 }],
+ others = [{ 'x': 1, 'y': 2 }];
+
+ var actual = _.unionWith(objects, others, function(a, b) {
+ return a.x == b.x;
+ });
+
+ assert.deepEqual(actual, [{ 'x': 1, 'y': 1 }]);
+ });
}());
/*--------------------------------------------------------------------------*/
@@ -24720,7 +24512,7 @@
assert.deepEqual(actual, [[1, 2]]);
});
- QUnit.test('`_.' + methodName + '` should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('`_.' + methodName + '` should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -24774,7 +24566,7 @@
QUnit.test('should work with a `comparator` argument', function(assert) {
assert.expect(1);
- var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }],
+ var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }],
actual = _.uniqWith(objects, lodashStable.isEqual);
assert.deepEqual(actual, [objects[0], objects[1]]);
@@ -24989,7 +24781,7 @@
assert.deepEqual(actual, [6, 15]);
});
- QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -25299,7 +25091,7 @@
assert.strictEqual(p('fred, barney, & pebbles'), '
fred, barney, & pebbles
');
});
- QUnit.test('should provide the correct `wrapper` arguments', function(assert) {
+ QUnit.test('should provide correct `wrapper` arguments', function(assert) {
assert.expect(1);
var args;
@@ -25326,7 +25118,7 @@
assert.deepEqual(actual, expected);
});
- QUnit.test('should not set a `this` binding', function(assert) {
+ QUnit.test('should use `this` binding of function', function(assert) {
assert.expect(1);
var p = _.wrap(_.escape, function(func) {
@@ -25439,7 +25231,7 @@
assert.deepEqual(actual, [{ 'x': 2 }]);
});
- QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -25546,7 +25338,7 @@
assert.deepEqual(actual, [1, 2, 3]);
});
- QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
+ QUnit.test('should provide correct `iteratee` arguments', function(assert) {
assert.expect(1);
var args;
@@ -26270,6 +26062,7 @@
'ceil',
'clone',
'deburr',
+ 'defaultTo',
'divide',
'endsWith',
'escape',
@@ -26600,7 +26393,7 @@
var acceptFalsey = lodashStable.difference(allMethods, rejectFalsey);
QUnit.test('should accept falsey arguments', function(assert) {
- assert.expect(314);
+ assert.expect(316);
var arrays = lodashStable.map(falsey, stubArray);
@@ -26686,7 +26479,7 @@
});
});
- QUnit.test('should not set a `this` binding', function(assert) {
+ QUnit.test('should use `this` binding of function', function(assert) {
assert.expect(30);
lodashStable.each(noBinding, function(methodName) {
@@ -26725,5 +26518,6 @@
if (!document) {
QUnit.config.noglobals = true;
QUnit.load();
+ QUnit.start();
}
}.call(this));
diff --git a/test/underscore.html b/test/underscore.html
index a3e56e8190..d2fef52c14 100644
--- a/test/underscore.html
+++ b/test/underscore.html
@@ -56,9 +56,6 @@
'works on an arguments object',
'can handle very deep arrays'
],
- 'head': [
- 'is an alias for first'
- ],
'indexOf': [
"sorted indexOf doesn't uses binary search",
'0'
@@ -86,9 +83,6 @@
'an array of pairs zipped together into an object',
'an object converted to pairs and back to an object'
],
- 'range': [
- 'range with two arguments a & b, b<a generates an empty array'
- ],
'rest': [
'returns the whole array when index is 0',
'returns elements starting at the given index',
@@ -129,7 +123,8 @@
'Iterating objects with sketchy length properties': true,
'Resistant to collection length and properties changing while iterating': true,
'countBy': [
- 'true'
+ '{}',
+ '[{}]'
],
'each': [
'context object property accessed'
@@ -141,24 +136,17 @@
],
'filter': [
'given context',
- '[{"a":1,"b":2},{"a":1,"b":3},{"a":1,"b":4}]',
- '[{"a":1,"b":2},{"a":2,"b":2}]',
- 'Empty object accepts all items',
'OO-filter'
],
'find': [
- '{"a":1,"b":4}',
- 'undefined when not found',
- 'undefined when searching empty list',
- 'works on objects',
- 'undefined',
'called with context'
],
'findWhere': [
'checks properties given function'
],
'groupBy': [
- 'true'
+ '{}',
+ '[{}]'
],
'includes': [
"doesn't delegate to binary search"
@@ -198,8 +186,7 @@
'partition': [
'can reference the array index',
'Died on test #8',
- 'partition takes a context argument',
- 'function(a){[code]}'
+ 'partition takes a context argument'
],
'pluck': [
'[1]'
@@ -223,15 +210,15 @@
'checks properties given function'
],
'Can use various collection methods on NodeLists': [
- '',
- ''
+ ''
]
},
'Functions': {
'debounce asap': true,
'debounce asap cancel': true,
- 'debounce after system time is set backwards': true,
'debounce asap recursively': true,
+ 'debounce after system time is set backwards': true,
+ 'debounce re-entrant': true,
'throttle repeatedly with results': true,
'more throttle does not trigger leading call when leading is set to false': true,
'throttle does not trigger trailing call when trailing is set to false': true,
@@ -245,17 +232,17 @@
'bindAll': [
'throws an error for bindAll with no functions named'
],
+ 'debounce': [
+ 'incr was debounced'
+ ],
+ 'iteratee': [
+ '"bbiz"',
+ '"foo"',
+ '1'
+ ],
'memoize': [
'{"bar":"BAR","foo":"FOO"}',
'Died on test #8'
- ],
- 'partial':[
- 'can partially apply with placeholders',
- 'accepts more arguments than the number of placeholders',
- 'accepts fewer arguments than the number of placeholders',
- 'unfilled placeholders are undefined',
- 'keeps prototype',
- 'allows the placeholder to be swapped out'
]
},
'Objects': {
@@ -265,10 +252,6 @@
'is not fooled by sparse arrays with additional properties',
'[]'
],
- 'defaults': [
- 'defaults skips nulls',
- 'defaults skips undefined'
- ],
'extend': [
'extending null results in null',
'extending undefined results in undefined'
@@ -285,15 +268,13 @@
'Commutative equality is implemented for `0` and `-0`',
'`new Number(0)` and `-0` are not equal',
'Commutative equality is implemented for `new Number(0)` and `-0`',
+ 'Invalid dates are not equal',
'false'
],
'isFinite': [
'Numeric strings are numbers',
'Number instances can be finite'
],
- 'isMatch': [
- 'doesnt falsey match constructor on undefined/null'
- ],
'isSet': [
'Died on test #9'
],
@@ -309,10 +290,6 @@
'called with context',
'mapValue identity'
],
- 'matcher': [
- 'null matches null',
- 'treats primitives as empty'
- ],
'omit': [
'can accept a predicate',
'function is given context'
@@ -323,7 +300,6 @@
]
},
'Utility': {
- 'noConflict (node vm)': true,
'now': [
'Produces the correct time in milliseconds'
],
diff --git a/vendor/backbone/backbone.js b/vendor/backbone/backbone.js
index 55ccb22bd0..02722ac811 100644
--- a/vendor/backbone/backbone.js
+++ b/vendor/backbone/backbone.js
@@ -394,6 +394,7 @@
var Model = Backbone.Model = function(attributes, options) {
var attrs = attributes || {};
options || (options = {});
+ this.preinitialize.apply(this, arguments);
this.cid = _.uniqueId(this.cidPrefix);
this.attributes = {};
if (options.collection) this.collection = options.collection;
@@ -422,6 +423,10 @@
// You may want to override this if you're experiencing name clashes with model ids.
cidPrefix: 'c',
+ // preinitialize is an empty function by default. You can override it with a function
+ // or object. preinitialize will run before any instantiation logic is run in the Model.
+ preinitialize: function(){},
+
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
@@ -562,12 +567,14 @@
if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
var old = this._changing ? this._previousAttributes : this.attributes;
var changed = {};
+ var hasChanged;
for (var attr in diff) {
var val = diff[attr];
if (_.isEqual(old[attr], val)) continue;
changed[attr] = val;
+ hasChanged = true;
}
- return _.size(changed) ? changed : false;
+ return hasChanged ? changed : false;
},
// Get the previous value of an attribute, recorded at the time the last
@@ -754,6 +761,7 @@
// its models in sort order, as they're added and removed.
var Collection = Backbone.Collection = function(models, options) {
options || (options = {});
+ this.preinitialize.apply(this, arguments);
if (options.model) this.model = options.model;
if (options.comparator !== void 0) this.comparator = options.comparator;
this._reset();
@@ -783,6 +791,11 @@
// This should be overridden in most cases.
model: Model,
+
+ // preinitialize is an empty function by default. You can override it with a function
+ // or object. preinitialize will run before any instantiation logic is run in the Collection.
+ preinitialize: function(){},
+
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
@@ -1219,6 +1232,7 @@
// if an existing element is not provided...
var View = Backbone.View = function(options) {
this.cid = _.uniqueId('view');
+ this.preinitialize.apply(this, arguments);
_.extend(this, _.pick(options, viewOptions));
this._ensureElement();
this.initialize.apply(this, arguments);
@@ -1242,6 +1256,10 @@
return this.$el.find(selector);
},
+ // preinitialize is an empty function by default. You can override it with a function
+ // or object. preinitialize will run before any instantiation logic is run in the View
+ preinitialize: function(){},
+
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
@@ -1467,6 +1485,7 @@
// matched. Creating a new one sets its `routes` hash, if not set statically.
var Router = Backbone.Router = function(options) {
options || (options = {});
+ this.preinitialize.apply(this, arguments);
if (options.routes) this.routes = options.routes;
this._bindRoutes();
this.initialize.apply(this, arguments);
@@ -1482,6 +1501,10 @@
// Set up all inheritable **Backbone.Router** properties and methods.
_.extend(Router.prototype, Events, {
+ // preinitialize is an empty function by default. You can override it with a function
+ // or object. preinitialize will run before any instantiation logic is run in the Router.
+ preinitialize: function(){},
+
// Initialize is an empty function by default. Override it with your own
// initialization logic.
initialize: function(){},
@@ -1812,11 +1835,14 @@
}
var url = rootPath + fragment;
- // Strip the hash and decode for matching.
- fragment = this.decodeFragment(fragment.replace(pathStripper, ''));
+ // Strip the fragment of the query and hash for matching.
+ fragment = fragment.replace(pathStripper, '');
+
+ // Decode for matching.
+ var decodedFragment = this.decodeFragment(fragment);
- if (this.fragment === fragment) return;
- this.fragment = fragment;
+ if (this.fragment === decodedFragment) return;
+ this.fragment = decodedFragment;
// If pushState is available, we use it to set the fragment as a real URL.
if (this._usePushState) {
diff --git a/vendor/backbone/test/collection.js b/vendor/backbone/test/collection.js
index dd98aca5c2..4d1dd44832 100644
--- a/vendor/backbone/test/collection.js
+++ b/vendor/backbone/test/collection.js
@@ -1,4 +1,4 @@
-(function() {
+(function(QUnit) {
var a, b, c, d, e, col, otherCol;
@@ -593,7 +593,7 @@
assert.equal(error, 'fail');
assert.equal(options.validationError, 'fail');
});
- assert.equal(collection.create({'foo': 'bar'}, {validate: true}), false);
+ assert.equal(collection.create({foo: 'bar'}, {validate: true}), false);
});
QUnit.test('create will pass extra options to success callback', function(assert) {
@@ -661,6 +661,31 @@
assert.equal(coll.one, 1);
});
+ QUnit.test('preinitialize', function(assert) {
+ assert.expect(1);
+ var Collection = Backbone.Collection.extend({
+ preinitialize: function() {
+ this.one = 1;
+ }
+ });
+ var coll = new Collection;
+ assert.equal(coll.one, 1);
+ });
+
+ QUnit.test('preinitialize occurs before the collection is set up', function(assert) {
+ assert.expect(2);
+ var Collection = Backbone.Collection.extend({
+ preinitialize: function() {
+ assert.notEqual(this.model, FooModel);
+ }
+ });
+ var FooModel = Backbone.Model.extend({id: 'foo'});
+ var coll = new Collection({}, {
+ model: FooModel
+ });
+ assert.equal(coll.model, FooModel);
+ });
+
QUnit.test('toJSON', function(assert) {
assert.expect(1);
assert.equal(JSON.stringify(col), '[{"id":3,"label":"a"},{"id":2,"label":"b"},{"id":1,"label":"c"},{"id":0,"label":"d"}]');
@@ -1724,10 +1749,10 @@
return new M(attrs);
}
});
- var c2 = new C2({'_id': 1});
+ var c2 = new C2({_id: 1});
assert.equal(c2.get(1), void 0);
assert.equal(c2.modelId(c2.at(0).attributes), void 0);
- var m = new M({'_id': 2});
+ var m = new M({_id: 2});
c2.add(m);
assert.equal(c2.get(2), void 0);
assert.equal(c2.modelId(m.attributes), void 0);
@@ -1995,4 +2020,4 @@
assert.equal(fired, false);
});
-})();
+})(QUnit);
diff --git a/vendor/backbone/test/events.js b/vendor/backbone/test/events.js
index 544b39a19a..ec1e5474fa 100644
--- a/vendor/backbone/test/events.js
+++ b/vendor/backbone/test/events.js
@@ -1,4 +1,4 @@
-(function() {
+(function(QUnit) {
QUnit.module('Backbone.Events');
@@ -703,4 +703,4 @@
two.trigger('y', 2);
});
-})();
+})(QUnit);
diff --git a/vendor/backbone/test/model.js b/vendor/backbone/test/model.js
index b73a1c794c..440047fef6 100644
--- a/vendor/backbone/test/model.js
+++ b/vendor/backbone/test/model.js
@@ -1,4 +1,4 @@
-(function() {
+(function(QUnit) {
var ProxyModel = Backbone.Model.extend();
var Klass = Backbone.Collection.extend({
@@ -63,6 +63,36 @@
assert.equal(model.get('value'), 2);
});
+
+ QUnit.test('preinitialize', function(assert) {
+ assert.expect(2);
+ var Model = Backbone.Model.extend({
+
+ preinitialize: function() {
+ this.one = 1;
+ }
+ });
+ var model = new Model({}, {collection: collection});
+ assert.equal(model.one, 1);
+ assert.equal(model.collection, collection);
+ });
+
+ QUnit.test('preinitialize occurs before the model is set up', function(assert) {
+ assert.expect(6);
+ var Model = Backbone.Model.extend({
+
+ preinitialize: function() {
+ assert.equal(this.collection, undefined);
+ assert.equal(this.cid, undefined);
+ assert.equal(this.id, undefined);
+ }
+ });
+ var model = new Model({id: 'foo'}, {collection: collection});
+ assert.equal(model.collection, collection);
+ assert.equal(model.id, 'foo');
+ assert.notEqual(model.cid, undefined);
+ });
+
QUnit.test('parse can return null', function(assert) {
assert.expect(1);
var Model = Backbone.Model.extend({
@@ -1415,4 +1445,4 @@
assert.equal(model.id, 3);
});
-})();
+})(QUnit);
diff --git a/vendor/backbone/test/noconflict.js b/vendor/backbone/test/noconflict.js
index 9968f6887b..ab5d05f165 100644
--- a/vendor/backbone/test/noconflict.js
+++ b/vendor/backbone/test/noconflict.js
@@ -1,4 +1,4 @@
-(function() {
+(function(QUnit) {
QUnit.module('Backbone.noConflict');
@@ -10,4 +10,4 @@
assert.equal(window.Backbone, noconflictBackbone, 'Backbone is still pointing to the original Backbone');
});
-})();
+})(QUnit);
diff --git a/vendor/backbone/test/router.js b/vendor/backbone/test/router.js
index 13110c4511..5bcd7677d7 100644
--- a/vendor/backbone/test/router.js
+++ b/vendor/backbone/test/router.js
@@ -1,4 +1,4 @@
-(function() {
+(function(QUnit) {
var router = null;
var location = null;
@@ -28,7 +28,8 @@
'fragment',
'pathname',
'protocol'
- ));
+ ));
+
// In IE, anchor.pathname does not contain a leading slash though
// window.location.pathname does.
if (!/^\//.test(this.pathname)) this.pathname = '/' + this.pathname;
@@ -42,7 +43,7 @@
QUnit.module('Backbone.Router', {
- setup: function() {
+ beforeEach: function() {
location = new Location('http://example.com');
Backbone.history = _.extend(new Backbone.History, {location: location});
router = new Router({testing: 101});
@@ -53,7 +54,7 @@
Backbone.history.on('route', onRoute);
},
- teardown: function() {
+ afterEach: function() {
Backbone.history.stop();
Backbone.history.off('route', onRoute);
}
@@ -95,6 +96,10 @@
'*anything': 'anything'
},
+ preinitialize: function(options) {
+ this.testpreinit = 'foo';
+ },
+
initialize: function(options) {
this.testing = options.testing;
this.route('implicit', 'implicit');
@@ -121,19 +126,19 @@
this.charType = 'escaped';
},
- contacts: function(){
+ contacts: function() {
this.contact = 'index';
},
- newContact: function(){
+ newContact: function() {
this.contact = 'new';
},
- loadContact: function(){
+ loadContact: function() {
this.contact = 'load';
},
- optionalItem: function(arg){
+ optionalItem: function(arg) {
this.arg = arg !== void 0 ? arg : null;
},
@@ -181,6 +186,11 @@
assert.equal(router.testing, 101);
});
+ QUnit.test('preinitialize', function(assert) {
+ assert.expect(1);
+ assert.equal(router.testpreinit, 'foo');
+ });
+
QUnit.test('routes (simple)', function(assert) {
assert.expect(4);
location.replace('http://example.com#search/news');
@@ -234,10 +244,11 @@
assert.ok(Backbone.history.navigate('search/manhattan/p20', true));
});
- QUnit.test('route precedence via navigate', function(assert){
+ QUnit.test('route precedence via navigate', function(assert) {
assert.expect(6);
- // check both 0.9.x and backwards-compatibility options
- _.each([{trigger: true}, true], function( options ){
+
+ // Check both 0.9.x and backwards-compatibility options
+ _.each([{trigger: true}, true], function(options) {
Backbone.history.navigate('contacts', options);
assert.equal(router.contact, 'index');
Backbone.history.navigate('contacts/new', options);
@@ -249,7 +260,7 @@
QUnit.test('loadUrl is not called for identical routes.', function(assert) {
assert.expect(0);
- Backbone.history.loadUrl = function(){ assert.ok(false); };
+ Backbone.history.loadUrl = function() { assert.ok(false); };
location.replace('http://example.com#route');
Backbone.history.navigate('route');
Backbone.history.navigate('/route');
@@ -345,9 +356,9 @@
assert.strictEqual(router.path, 'c/d/e');
});
- QUnit.test("fires event when router doesn't have callback on it", function(assert) {
+ QUnit.test('fires event when router doesn\'t have callback on it', function(assert) {
assert.expect(1);
- router.on('route:noCallback', function(){ assert.ok(true); });
+ router.on('route:noCallback', function() { assert.ok(true); });
location.replace('http://example.com#noCallback');
Backbone.history.checkUrl();
});
@@ -536,8 +547,8 @@
Backbone.history = _.extend(new Backbone.History, {
location: location,
history: {
- pushState: function(){},
- replaceState: function(){}
+ pushState: function() {},
+ replaceState: function() {}
}
});
Backbone.history.start({root: 'root'});
@@ -551,8 +562,8 @@
Backbone.history = _.extend(new Backbone.History, {
location: location,
history: {
- pushState: function(){},
- replaceState: function(state, title, url){
+ pushState: function() {},
+ replaceState: function(state, title, url) {
assert.strictEqual(url, '/root/x/y');
}
}
@@ -570,8 +581,8 @@
Backbone.history = _.extend(new Backbone.History, {
location: location,
history: {
- pushState: function(){},
- replaceState: function(){}
+ pushState: function() {},
+ replaceState: function() {}
}
});
Backbone.history.start({root: ''});
@@ -625,8 +636,8 @@
Backbone.history = _.extend(new Backbone.History, {
location: location,
history: {
- pushState: function(){},
- replaceState: function(state, title, url){
+ pushState: function() {},
+ replaceState: function(state, title, url) {
assert.strictEqual(url, '/root/x/y?a=b');
}
}
@@ -641,8 +652,8 @@
assert.expect(1);
var MyRouter = Backbone.Router.extend({
routes: {'': 'empty'},
- empty: function(){},
- route: function(route){
+ empty: function() {},
+ route: function(route) {
assert.strictEqual(route, '');
}
});
@@ -655,7 +666,8 @@
assert.strictEqual(history.getFragment('fragment '), 'fragment');
});
- QUnit.test('#1820 - Leading slash and trailing space.', 1, function(assert) {
+ QUnit.test('#1820 - Leading slash and trailing space.', function(assert) {
+ assert.expect(1);
var history = new Backbone.History;
assert.strictEqual(history.getFragment('/fragment '), 'fragment');
});
@@ -670,7 +682,7 @@
assert.strictEqual(router.z, '123');
});
- QUnit.test("#2062 - Trigger 'route' event on router instance.", function(assert) {
+ QUnit.test('#2062 - Trigger "route" event on router instance.', function(assert) {
assert.expect(2);
router.on('route', function(name, args) {
assert.strictEqual(name, 'routeEvent');
@@ -709,8 +721,8 @@
Backbone.history = _.extend(new Backbone.History, {
location: location,
history: {
- pushState: function(){},
- replaceState: function(){ assert.ok(false); }
+ pushState: function() {},
+ replaceState: function() { assert.ok(false); }
}
});
Backbone.history.start({
@@ -726,8 +738,8 @@
Backbone.history = _.extend(new Backbone.History, {
location: location,
history: {
- pushState: function(){},
- replaceState: function(){}
+ pushState: function() {},
+ replaceState: function() {}
}
});
@@ -753,7 +765,7 @@
Backbone.history = _.extend(new Backbone.History, {
location: location,
history: {
- pushState: function(state, title, url){
+ pushState: function(state, title, url) {
assert.strictEqual(url, '/root');
}
}
@@ -785,7 +797,7 @@
Backbone.history = _.extend(new Backbone.History, {
location: location,
history: {
- pushState: function(state, title, url){
+ pushState: function(state, title, url) {
assert.strictEqual(url, '/root?x=1');
}
}
@@ -823,7 +835,7 @@
assert.expect(1);
var MyRouter = Backbone.Router.extend({
routes: {
- path: function(params){
+ path: function(params) {
assert.strictEqual(params, 'x=y%3Fz');
}
}
@@ -921,7 +933,7 @@
Backbone.history = _.extend(new Backbone.History, {location: location});
var MyRouter = Backbone.Router.extend({
routes: {'foo/:id/bar': 'foo'},
- foo: function(){},
+ foo: function() {},
execute: function(callback, args, name) {
assert.strictEqual(callback, this.foo);
assert.deepEqual(args, ['123', 'x=y']);
@@ -953,8 +965,8 @@
Backbone.history = _.extend(new Backbone.History, {
location: location,
history: {
- pushState: function(){ assert.ok(false); },
- replaceState: function(){ assert.ok(false); }
+ pushState: function() { assert.ok(false); },
+ replaceState: function() { assert.ok(false); }
}
});
Backbone.history.start({pushState: true});
@@ -991,14 +1003,14 @@
Backbone.history.start({root: '/root', pushState: true});
});
- QUnit.test("Paths that don't match the root should not match no root", function(assert) {
+ QUnit.test('Paths that don\'t match the root should not match no root', function(assert) {
assert.expect(0);
location.replace('http://example.com/foo');
Backbone.history.stop();
Backbone.history = _.extend(new Backbone.History, {location: location});
var MyRouter = Backbone.Router.extend({
routes: {
- foo: function(){
+ foo: function() {
assert.ok(false, 'should not match unless root matches');
}
}
@@ -1007,14 +1019,14 @@
Backbone.history.start({root: 'root', pushState: true});
});
- QUnit.test("Paths that don't match the root should not match roots of the same length", function(assert) {
+ QUnit.test('Paths that don\'t match the root should not match roots of the same length', function(assert) {
assert.expect(0);
location.replace('http://example.com/xxxx/foo');
Backbone.history.stop();
Backbone.history = _.extend(new Backbone.History, {location: location});
var MyRouter = Backbone.Router.extend({
routes: {
- foo: function(){
+ foo: function() {
assert.ok(false, 'should not match unless root matches');
}
}
@@ -1029,7 +1041,7 @@
Backbone.history.stop();
Backbone.history = _.extend(new Backbone.History, {location: location});
var MyRouter = Backbone.Router.extend({
- routes: {foo: function(){ assert.ok(true); }}
+ routes: {foo: function() { assert.ok(true); }}
});
var myRouter = new MyRouter;
Backbone.history.start({root: 'x+y.z', pushState: true});
@@ -1041,7 +1053,7 @@
Backbone.history.stop();
Backbone.history = _.extend(new Backbone.History, {location: location});
var MyRouter = Backbone.Router.extend({
- routes: {foo: function(){ assert.ok(true); }}
+ routes: {foo: function() { assert.ok(true); }}
});
var myRouter = new MyRouter;
Backbone.history.start({root: '®ooτ', pushState: true});
@@ -1053,10 +1065,17 @@
Backbone.history.stop();
Backbone.history = _.extend(new Backbone.History, {location: location});
var MyRouter = Backbone.Router.extend({
- routes: {'': function(){ assert.ok(true); }}
+ routes: {'': function() { assert.ok(true); }}
});
var myRouter = new MyRouter;
Backbone.history.start({root: '®ooτ', pushState: true});
});
-})();
+ QUnit.test('#4025 - navigate updates URL hash as is', function(assert) {
+ assert.expect(1);
+ var route = 'search/has%20space';
+ Backbone.history.navigate(route);
+ assert.strictEqual(location.hash, '#' + route);
+ });
+
+})(QUnit);
diff --git a/vendor/backbone/test/setup/environment.js b/vendor/backbone/test/setup/environment.js
index c2441ac771..6461b5bbdc 100644
--- a/vendor/backbone/test/setup/environment.js
+++ b/vendor/backbone/test/setup/environment.js
@@ -1,4 +1,4 @@
-(function() {
+(function(QUnit) {
var sync = Backbone.sync;
var ajax = Backbone.ajax;
@@ -14,7 +14,7 @@
var env = QUnit.config.current.testEnvironment;
// We never want to actually call these during tests.
- history.pushState = history.replaceState = function(){};
+ history.pushState = history.replaceState = function() {};
// Capture ajax settings for comparison.
Backbone.ajax = function(settings) {
@@ -42,4 +42,4 @@
history.replaceState = replaceState;
});
-})();
+})(QUnit);
diff --git a/vendor/backbone/test/sync.js b/vendor/backbone/test/sync.js
index 8813f15847..cd314a1855 100644
--- a/vendor/backbone/test/sync.js
+++ b/vendor/backbone/test/sync.js
@@ -1,4 +1,4 @@
-(function() {
+(function(QUnit) {
var Library = Backbone.Collection.extend({
url: function() { return '/library'; }
@@ -158,7 +158,7 @@
QUnit.test('Backbone.ajax', function(assert) {
assert.expect(1);
- Backbone.ajax = function(settings){
+ Backbone.ajax = function(settings) {
assert.strictEqual(settings.url, '/test');
};
var model = new Backbone.Model();
@@ -236,4 +236,4 @@
this.ajaxSettings.error({}, 'textStatus', 'errorThrown');
});
-})();
+})(QUnit);
diff --git a/vendor/backbone/test/view.js b/vendor/backbone/test/view.js
index faf3445ba7..13270c8400 100644
--- a/vendor/backbone/test/view.js
+++ b/vendor/backbone/test/view.js
@@ -1,13 +1,13 @@
-(function() {
+(function(QUnit) {
var view;
QUnit.module('Backbone.View', {
- beforeEach: function(assert) {
+ beforeEach: function() {
$('#qunit-fixture').append(
'
Test
'
- );
+ );
view = new Backbone.View({
id: 'test-view',
@@ -61,6 +61,28 @@
assert.strictEqual(new View().one, 1);
});
+ QUnit.test('preinitialize', function(assert) {
+ assert.expect(1);
+ var View = Backbone.View.extend({
+ preinitialize: function() {
+ this.one = 1;
+ }
+ });
+
+ assert.strictEqual(new View().one, 1);
+ });
+
+ QUnit.test('preinitialize occurs before the view is set up', function(assert) {
+ assert.expect(2);
+ var View = Backbone.View.extend({
+ preinitialize: function() {
+ assert.equal(this.el, undefined);
+ }
+ });
+ var _view = new View({});
+ assert.notEqual(_view.el, undefined);
+ });
+
QUnit.test('render', function(assert) {
assert.expect(1);
var myView = new Backbone.View;
@@ -72,8 +94,8 @@
var counter1 = 0, counter2 = 0;
var myView = new Backbone.View({el: '#testElement'});
- myView.increment = function(){ counter1++; };
- myView.$el.on('click', function(){ counter2++; });
+ myView.increment = function() { counter1++; };
+ myView.$el.on('click', function() { counter2++; });
var events = {'click h1': 'increment'};
@@ -129,11 +151,10 @@
assert.equal(myView.counter, 3);
});
-
QUnit.test('delegateEvents ignore undefined methods', function(assert) {
assert.expect(0);
var myView = new Backbone.View({el: ''});
- myView.delegateEvents({'click': 'undefinedMethod'});
+ myView.delegateEvents({click: 'undefinedMethod'});
myView.$el.trigger('click');
});
@@ -142,8 +163,8 @@
var counter1 = 0, counter2 = 0;
var myView = new Backbone.View({el: '#testElement'});
- myView.increment = function(){ counter1++; };
- myView.$el.on('click', function(){ counter2++; });
+ myView.increment = function() { counter1++; };
+ myView.$el.on('click', function() { counter2++; });
var events = {'click h1': 'increment'};
@@ -203,7 +224,7 @@
assert.expect(2);
var myView = new Backbone.View({el: '#testElement'});
myView.delegate('click', function() { assert.ok(true); });
- var handler = function(){ assert.ok(false); };
+ var handler = function() { assert.ok(false); };
myView.delegate('click', 'h1', handler);
myView.undelegate('click', 'h1', handler);
myView.$('h1').trigger('click');
@@ -405,8 +426,8 @@
assert.expect(0);
var View = Backbone.View.extend({
initialize: function() {
- this.listenTo(this.model, 'all x', function(){ assert.ok(false); });
- this.listenTo(this.collection, 'all x', function(){ assert.ok(false); });
+ this.listenTo(this.model, 'all x', function() { assert.ok(false); });
+ this.listenTo(this.collection, 'all x', function() { assert.ok(false); });
}
});
@@ -492,4 +513,4 @@
assert.notEqual($oldEl, myView.$el);
});
-})();
+})(QUnit);
diff --git a/vendor/underscore/test/arrays.js b/vendor/underscore/test/arrays.js
index 748edea4fa..319994aa19 100644
--- a/vendor/underscore/test/arrays.js
+++ b/vendor/underscore/test/arrays.js
@@ -15,6 +15,10 @@
result = _.map([[1, 2, 3], [1, 2, 3]], _.first);
assert.deepEqual(result, [1, 1], 'works well with _.map');
assert.equal(_.first(null), void 0, 'returns undefined when called on null');
+
+ Array.prototype[0] = 'boo';
+ assert.equal(_.first([]), void 0, 'return undefined when called on a empty array');
+ delete Array.prototype[0];
});
QUnit.test('head', function(assert) {
@@ -66,6 +70,10 @@
result = _.map([[1, 2, 3], [1, 2, 3]], _.last);
assert.deepEqual(result, [3, 3], 'works well with _.map');
assert.equal(_.last(null), void 0, 'returns undefined when called on null');
+
+ var arr = [];
+ arr[-1] = 'boo';
+ assert.equal(_.last(arr), void 0, 'return undefined when called on a empty array');
});
QUnit.test('compact', function(assert) {
diff --git a/vendor/underscore/test/collections.js b/vendor/underscore/test/collections.js
index 182f7a2183..76ed98c948 100644
--- a/vendor/underscore/test/collections.js
+++ b/vendor/underscore/test/collections.js
@@ -188,7 +188,7 @@
var prod = _.reduce([1, 2, 3, 4], function(memo, num){ return memo * num; });
assert.equal(prod, 24, 'can reduce via multiplication');
- assert.ok(_.reduce(null, _.noop, 138) === 138, 'handles a null (with initial value) properly');
+ assert.strictEqual(_.reduce(null, _.noop, 138), 138, 'handles a null (with initial value) properly');
assert.equal(_.reduce([], _.noop, void 0), void 0, 'undefined can be passed as a special case');
assert.equal(_.reduce([_], _.noop), _, 'collection of length one with no initial value returns the first item');
assert.equal(_.reduce([], _.noop), void 0, 'returns undefined when collection is empty and no initial value');
@@ -212,7 +212,7 @@
var sum = _.reduceRight({a: 1, b: 2, c: 3}, function(memo, num){ return memo + num; });
assert.equal(sum, 6, 'default initial value on object');
- assert.ok(_.reduceRight(null, _.noop, 138) === 138, 'handles a null (with initial value) properly');
+ assert.strictEqual(_.reduceRight(null, _.noop, 138), 138, 'handles a null (with initial value) properly');
assert.equal(_.reduceRight([_], _.noop), _, 'collection of length one with no initial value returns the first item');
assert.equal(_.reduceRight([], _.noop, void 0), void 0, 'undefined can be passed as a special case');
@@ -268,8 +268,8 @@
var list = [{a: 1, b: 2}, {a: 2, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}, {a: 2, b: 4}];
assert.deepEqual(_.find(list, {a: 1}), {a: 1, b: 2}, 'can be used as findWhere');
assert.deepEqual(_.find(list, {b: 4}), {a: 1, b: 4});
- assert.ok(!_.find(list, {c: 1}), 'undefined when not found');
- assert.ok(!_.find([], {c: 1}), 'undefined when searching empty list');
+ assert.notOk(_.find(list, {c: 1}), 'undefined when not found');
+ assert.notOk(_.find([], {c: 1}), 'undefined when searching empty list');
var result = _.find([1, 2, 3], function(num){ return num * 2 === 4; });
assert.equal(result, 2, 'found the first "2" and broke the loop');
@@ -348,25 +348,25 @@
QUnit.test('every', function(assert) {
assert.ok(_.every([], _.identity), 'the empty set');
assert.ok(_.every([true, true, true], _.identity), 'every true values');
- assert.ok(!_.every([true, false, true], _.identity), 'one false value');
+ assert.notOk(_.every([true, false, true], _.identity), 'one false value');
assert.ok(_.every([0, 10, 28], function(num){ return num % 2 === 0; }), 'even numbers');
- assert.ok(!_.every([0, 11, 28], function(num){ return num % 2 === 0; }), 'an odd number');
- assert.ok(_.every([1], _.identity) === true, 'cast to boolean - true');
- assert.ok(_.every([0], _.identity) === false, 'cast to boolean - false');
- assert.ok(!_.every([void 0, void 0, void 0], _.identity), 'works with arrays of undefined');
+ assert.notOk(_.every([0, 11, 28], function(num){ return num % 2 === 0; }), 'an odd number');
+ assert.strictEqual(_.every([1], _.identity), true, 'cast to boolean - true');
+ assert.strictEqual(_.every([0], _.identity), false, 'cast to boolean - false');
+ assert.notOk(_.every([void 0, void 0, void 0], _.identity), 'works with arrays of undefined');
var list = [{a: 1, b: 2}, {a: 2, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}];
- assert.ok(!_.every(list, {a: 1, b: 2}), 'Can be called with object');
+ assert.notOk(_.every(list, {a: 1, b: 2}), 'Can be called with object');
assert.ok(_.every(list, 'a'), 'String mapped to object property');
list = [{a: 1, b: 2}, {a: 2, b: 2, c: true}];
assert.ok(_.every(list, {b: 2}), 'Can be called with object');
- assert.ok(!_.every(list, 'c'), 'String mapped to object property');
+ assert.notOk(_.every(list, 'c'), 'String mapped to object property');
assert.ok(_.every({a: 1, b: 2, c: 3, d: 4}, _.isNumber), 'takes objects');
- assert.ok(!_.every({a: 1, b: 2, c: 3, d: 4}, _.isObject), 'takes objects');
+ assert.notOk(_.every({a: 1, b: 2, c: 3, d: 4}, _.isObject), 'takes objects');
assert.ok(_.every(['a', 'b', 'c', 'd'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
- assert.ok(!_.every(['a', 'b', 'c', 'd', 'f'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
+ assert.notOk(_.every(['a', 'b', 'c', 'd', 'f'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
});
QUnit.test('all', function(assert) {
@@ -374,29 +374,29 @@
});
QUnit.test('some', function(assert) {
- assert.ok(!_.some([]), 'the empty set');
- assert.ok(!_.some([false, false, false]), 'all false values');
+ assert.notOk(_.some([]), 'the empty set');
+ assert.notOk(_.some([false, false, false]), 'all false values');
assert.ok(_.some([false, false, true]), 'one true value');
assert.ok(_.some([null, 0, 'yes', false]), 'a string');
- assert.ok(!_.some([null, 0, '', false]), 'falsy values');
- assert.ok(!_.some([1, 11, 29], function(num){ return num % 2 === 0; }), 'all odd numbers');
+ assert.notOk(_.some([null, 0, '', false]), 'falsy values');
+ assert.notOk(_.some([1, 11, 29], function(num){ return num % 2 === 0; }), 'all odd numbers');
assert.ok(_.some([1, 10, 29], function(num){ return num % 2 === 0; }), 'an even number');
- assert.ok(_.some([1], _.identity) === true, 'cast to boolean - true');
- assert.ok(_.some([0], _.identity) === false, 'cast to boolean - false');
+ assert.strictEqual(_.some([1], _.identity), true, 'cast to boolean - true');
+ assert.strictEqual(_.some([0], _.identity), false, 'cast to boolean - false');
assert.ok(_.some([false, false, true]));
var list = [{a: 1, b: 2}, {a: 2, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}];
- assert.ok(!_.some(list, {a: 5, b: 2}), 'Can be called with object');
+ assert.notOk(_.some(list, {a: 5, b: 2}), 'Can be called with object');
assert.ok(_.some(list, 'a'), 'String mapped to object property');
list = [{a: 1, b: 2}, {a: 2, b: 2, c: true}];
assert.ok(_.some(list, {b: 2}), 'Can be called with object');
- assert.ok(!_.some(list, 'd'), 'String mapped to object property');
+ assert.notOk(_.some(list, 'd'), 'String mapped to object property');
assert.ok(_.some({a: '1', b: '2', c: '3', d: '4', e: 6}, _.isNumber), 'takes objects');
- assert.ok(!_.some({a: 1, b: 2, c: 3, d: 4}, _.isObject), 'takes objects');
+ assert.notOk(_.some({a: 1, b: 2, c: 3, d: 4}, _.isObject), 'takes objects');
assert.ok(_.some(['a', 'b', 'c', 'd'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
- assert.ok(!_.some(['x', 'y', 'z'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
+ assert.notOk(_.some(['x', 'y', 'z'], _.hasOwnProperty, {a: 1, b: 2, c: 3, d: 4}), 'context works');
});
QUnit.test('any', function(assert) {
@@ -408,11 +408,11 @@
assert.strictEqual(_.includes(val, 'hasOwnProperty'), false);
});
assert.strictEqual(_.includes([1, 2, 3], 2), true, 'two is in the array');
- assert.ok(!_.includes([1, 3, 9], 2), 'two is not in the array');
+ assert.notOk(_.includes([1, 3, 9], 2), 'two is not in the array');
assert.strictEqual(_.includes([5, 4, 3, 2, 1], 5, true), true, 'doesn\'t delegate to binary search');
- assert.ok(_.includes({moe: 1, larry: 3, curly: 9}, 3) === true, '_.includes on objects checks their values');
+ assert.strictEqual(_.includes({moe: 1, larry: 3, curly: 9}, 3), true, '_.includes on objects checks their values');
assert.ok(_([1, 2, 3]).includes(2), 'OO-style includes');
var numbers = [1, 2, 3, 1, 2, 3, 1, 2, 3];
@@ -549,7 +549,7 @@
assert.equal(-Infinity, _.max(void 0), 'can handle null/undefined');
assert.equal(-Infinity, _.max(null, _.identity), 'can handle null/undefined');
- assert.equal(3, _.max([1, 2, 3]), 'can perform a regular Math.max');
+ assert.equal(_.max([1, 2, 3]), 3, 'can perform a regular Math.max');
var neg = _.max([1, 2, 3], function(num){ return -num; });
assert.equal(neg, 1, 'can perform a computation-based max');
@@ -558,24 +558,24 @@
assert.equal(-Infinity, _.max([]), 'Maximum value of an empty array');
assert.equal(_.max({a: 'a'}), -Infinity, 'Maximum value of a non-numeric collection');
- assert.equal(299999, _.max(_.range(1, 300000)), 'Maximum value of a too-big array');
+ assert.equal(_.max(_.range(1, 300000)), 299999, 'Maximum value of a too-big array');
- assert.equal(3, _.max([1, 2, 3, 'test']), 'Finds correct max in array starting with num and containing a NaN');
- assert.equal(3, _.max(['test', 1, 2, 3]), 'Finds correct max in array starting with NaN');
+ assert.equal(_.max([1, 2, 3, 'test']), 3, 'Finds correct max in array starting with num and containing a NaN');
+ assert.equal(_.max(['test', 1, 2, 3]), 3, 'Finds correct max in array starting with NaN');
- assert.equal(3, _.max([1, 2, 3, null]), 'Finds correct max in array starting with num and containing a `null`');
- assert.equal(3, _.max([null, 1, 2, 3]), 'Finds correct max in array starting with a `null`');
+ assert.equal(_.max([1, 2, 3, null]), 3, 'Finds correct max in array starting with num and containing a `null`');
+ assert.equal(_.max([null, 1, 2, 3]), 3, 'Finds correct max in array starting with a `null`');
- assert.equal(3, _.max([1, 2, 3, '']), 'Finds correct max in array starting with num and containing an empty string');
- assert.equal(3, _.max(['', 1, 2, 3]), 'Finds correct max in array starting with an empty string');
+ assert.equal(_.max([1, 2, 3, '']), 3, 'Finds correct max in array starting with num and containing an empty string');
+ assert.equal(_.max(['', 1, 2, 3]), 3, 'Finds correct max in array starting with an empty string');
- assert.equal(3, _.max([1, 2, 3, false]), 'Finds correct max in array starting with num and containing a false');
- assert.equal(3, _.max([false, 1, 2, 3]), 'Finds correct max in array starting with a false');
+ assert.equal(_.max([1, 2, 3, false]), 3, 'Finds correct max in array starting with num and containing a false');
+ assert.equal(_.max([false, 1, 2, 3]), 3, 'Finds correct max in array starting with a false');
- assert.equal(4, _.max([0, 1, 2, 3, 4]), 'Finds correct max in array containing a zero');
- assert.equal(0, _.max([-3, -2, -1, 0]), 'Finds correct max in array containing negative numbers');
+ assert.equal(_.max([0, 1, 2, 3, 4]), 4, 'Finds correct max in array containing a zero');
+ assert.equal(_.max([-3, -2, -1, 0]), 0, 'Finds correct max in array containing negative numbers');
- assert.deepEqual([3, 6], _.map([[1, 2, 3], [4, 5, 6]], _.max), 'Finds correct max in array when mapping through multiple arrays');
+ assert.deepEqual(_.map([[1, 2, 3], [4, 5, 6]], _.max), [3, 6], 'Finds correct max in array when mapping through multiple arrays');
var a = {x: -Infinity};
var b = {x: -Infinity};
@@ -590,35 +590,35 @@
});
QUnit.test('min', function(assert) {
- assert.equal(Infinity, _.min(null), 'can handle null/undefined');
- assert.equal(Infinity, _.min(void 0), 'can handle null/undefined');
- assert.equal(Infinity, _.min(null, _.identity), 'can handle null/undefined');
+ assert.equal(_.min(null), Infinity, 'can handle null/undefined');
+ assert.equal(_.min(void 0), Infinity, 'can handle null/undefined');
+ assert.equal(_.min(null, _.identity), Infinity, 'can handle null/undefined');
- assert.equal(1, _.min([1, 2, 3]), 'can perform a regular Math.min');
+ assert.equal(_.min([1, 2, 3]), 1, 'can perform a regular Math.min');
var neg = _.min([1, 2, 3], function(num){ return -num; });
assert.equal(neg, 3, 'can perform a computation-based min');
- assert.equal(Infinity, _.min({}), 'Minimum value of an empty object');
- assert.equal(Infinity, _.min([]), 'Minimum value of an empty array');
+ assert.equal(_.min({}), Infinity, 'Minimum value of an empty object');
+ assert.equal(_.min([]), Infinity, 'Minimum value of an empty array');
assert.equal(_.min({a: 'a'}), Infinity, 'Minimum value of a non-numeric collection');
- assert.deepEqual([1, 4], _.map([[1, 2, 3], [4, 5, 6]], _.min), 'Finds correct min in array when mapping through multiple arrays');
+ assert.deepEqual(_.map([[1, 2, 3], [4, 5, 6]], _.min), [1, 4], 'Finds correct min in array when mapping through multiple arrays');
var now = new Date(9999999999);
var then = new Date(0);
assert.equal(_.min([now, then]), then);
- assert.equal(1, _.min(_.range(1, 300000)), 'Minimum value of a too-big array');
+ assert.equal(_.min(_.range(1, 300000)), 1, 'Minimum value of a too-big array');
- assert.equal(1, _.min([1, 2, 3, 'test']), 'Finds correct min in array starting with num and containing a NaN');
- assert.equal(1, _.min(['test', 1, 2, 3]), 'Finds correct min in array starting with NaN');
+ assert.equal(_.min([1, 2, 3, 'test']), 1, 'Finds correct min in array starting with num and containing a NaN');
+ assert.equal(_.min(['test', 1, 2, 3]), 1, 'Finds correct min in array starting with NaN');
- assert.equal(1, _.min([1, 2, 3, null]), 'Finds correct min in array starting with num and containing a `null`');
- assert.equal(1, _.min([null, 1, 2, 3]), 'Finds correct min in array starting with a `null`');
+ assert.equal(_.min([1, 2, 3, null]), 1, 'Finds correct min in array starting with num and containing a `null`');
+ assert.equal(_.min([null, 1, 2, 3]), 1, 'Finds correct min in array starting with a `null`');
- assert.equal(0, _.min([0, 1, 2, 3, 4]), 'Finds correct min in array containing a zero');
- assert.equal(-3, _.min([-3, -2, -1, 0]), 'Finds correct min in array containing negative numbers');
+ assert.equal(_.min([0, 1, 2, 3, 4]), 0, 'Finds correct min in array containing a zero');
+ assert.equal(_.min([-3, -2, -1, 0]), -3, 'Finds correct min in array containing negative numbers');
var a = {x: Infinity};
var b = {x: Infinity};
@@ -692,7 +692,7 @@
assert.deepEqual(grouped['5'], ['three', 'seven', 'eight']);
var context = {};
- _.groupBy([{}], function(){ assert.ok(this === context); }, context);
+ _.groupBy([{}], function(){ assert.strictEqual(this, context); }, context);
grouped = _.groupBy([4.2, 6.1, 6.4], function(num) {
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
@@ -701,7 +701,7 @@
assert.equal(grouped.hasOwnProperty.length, 2);
var array = [{}];
- _.groupBy(array, function(value, index, obj){ assert.ok(obj === array); });
+ _.groupBy(array, function(value, index, obj){ assert.strictEqual(obj, array); });
array = [1, 2, 1, 2, 3];
grouped = _.groupBy(array);
@@ -747,7 +747,7 @@
assert.equal(grouped['5'], 3);
var context = {};
- _.countBy([{}], function(){ assert.ok(this === context); }, context);
+ _.countBy([{}], function(){ assert.strictEqual(this, context); }, context);
grouped = _.countBy([4.2, 6.1, 6.4], function(num) {
return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor';
@@ -756,7 +756,7 @@
assert.equal(grouped.hasOwnProperty, 2);
var array = [{}];
- _.countBy(array, function(value, index, obj){ assert.ok(obj === array); });
+ _.countBy(array, function(value, index, obj){ assert.strictEqual(obj, array); });
array = [1, 2, 1, 2, 3];
grouped = _.countBy(array);
@@ -797,10 +797,10 @@
});
QUnit.test('toArray', function(assert) {
- assert.ok(!_.isArray(arguments), 'arguments object is not an array');
+ assert.notOk(_.isArray(arguments), 'arguments object is not an array');
assert.ok(_.isArray(_.toArray(arguments)), 'arguments object converted into array');
var a = [1, 2, 3];
- assert.ok(_.toArray(a) !== a, 'array is cloned');
+ assert.notStrictEqual(_.toArray(a), a, 'array is cloned');
assert.deepEqual(_.toArray(a), [1, 2, 3], 'cloned array contains same elements');
var numbers = _.toArray({one: 1, two: 2, three: 3});
@@ -882,7 +882,7 @@
assert.deepEqual(_.map(elementChildren, 'id'), ['id1', 'id2']);
assert.deepEqual(_.map(parent.childNodes, 'nodeType'), [1, 3, 1]);
- assert.ok(!_.every(parent.childNodes, _.isElement));
+ assert.notOk(_.every(parent.childNodes, _.isElement));
assert.ok(_.some(parent.childNodes, _.isElement));
function compareNode(node) {
diff --git a/vendor/underscore/test/cross-document.js b/vendor/underscore/test/cross-document.js
index cb68a3d9b8..bc3ab77f10 100644
--- a/vendor/underscore/test/cross-document.js
+++ b/vendor/underscore/test/cross-document.js
@@ -35,7 +35,7 @@
QUnit.test('isEqual', function(assert) {
- assert.ok(!_.isEqual(iNumber, 101));
+ assert.notOk(_.isEqual(iNumber, 101));
assert.ok(_.isEqual(iNumber, 100));
// Objects from another frame.
@@ -46,13 +46,13 @@
});
QUnit.test('isEmpty', function(assert) {
- assert.ok(!_([iNumber]).isEmpty(), '[1] is not empty');
- assert.ok(!_.isEmpty(iArray), '[] is empty');
+ assert.notOk(_([iNumber]).isEmpty(), '[1] is not empty');
+ assert.notOk(_.isEmpty(iArray), '[] is empty');
assert.ok(_.isEmpty(iObject), '{} is empty');
});
QUnit.test('isElement', function(assert) {
- assert.ok(!_.isElement('div'), 'strings are not dom elements');
+ assert.notOk(_.isElement('div'), 'strings are not dom elements');
assert.ok(_.isElement(document.body), 'the body tag is a DOM element');
assert.ok(_.isElement(iElement), 'even from another frame');
});
@@ -113,12 +113,12 @@
if (typeof ActiveXObject != 'undefined') {
QUnit.test('IE host objects', function(assert) {
var xml = new ActiveXObject('Msxml2.DOMDocument.3.0');
- assert.ok(!_.isNumber(xml));
- assert.ok(!_.isBoolean(xml));
- assert.ok(!_.isNaN(xml));
- assert.ok(!_.isFunction(xml));
- assert.ok(!_.isNull(xml));
- assert.ok(!_.isUndefined(xml));
+ assert.notOk(_.isNumber(xml));
+ assert.notOk(_.isBoolean(xml));
+ assert.notOk(_.isNaN(xml));
+ assert.notOk(_.isFunction(xml));
+ assert.notOk(_.isNull(xml));
+ assert.notOk(_.isUndefined(xml));
});
QUnit.test('#1621 IE 11 compat mode DOM elements are not functions', function(assert) {
diff --git a/vendor/underscore/test/functions.js b/vendor/underscore/test/functions.js
index f696bd648d..f73f5d382b 100644
--- a/vendor/underscore/test/functions.js
+++ b/vendor/underscore/test/functions.js
@@ -180,7 +180,7 @@
var done = assert.async();
var delayed = false;
_.delay(function(){ delayed = true; }, 100);
- setTimeout(function(){ assert.ok(!delayed, "didn't delay the function quite yet"); }, 50);
+ setTimeout(function(){ assert.notOk(delayed, "didn't delay the function quite yet"); }, 50);
setTimeout(function(){ assert.ok(delayed, 'delayed the function'); done(); }, 150);
});
@@ -694,6 +694,43 @@
assert.deepEqual(_.toArray(cb(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)), _.range(1, 11));
});
+ // Test custom iteratee
+ var builtinIteratee = _.iteratee;
+ _.iteratee = function(value) {
+ // RegEx values return a function that returns the number of matches
+ if (_.isRegExp(value)) return function(obj) {
+ return (obj.match(value) || []).length;
+ };
+ return value;
+ };
+
+ var collection = ['foo', 'bar', 'bbiz'];
+
+ // Test all methods that claim to be transformed through `_.iteratee`
+ assert.deepEqual(_.countBy(collection, /b/g), {0: 1, 1: 1, 2: 1});
+ assert.equal(_.every(collection, /b/g), false);
+ assert.deepEqual(_.filter(collection, /b/g), ['bar', 'bbiz']);
+ assert.equal(_.find(collection, /b/g), 'bar');
+ assert.equal(_.findIndex(collection, /b/g), 1);
+ assert.equal(_.findKey(collection, /b/g), 1);
+ assert.equal(_.findLastIndex(collection, /b/g), 2);
+ assert.deepEqual(_.groupBy(collection, /b/g), {0: ['foo'], 1: ['bar'], 2: ['bbiz']});
+ assert.deepEqual(_.indexBy(collection, /b/g), {0: 'foo', 1: 'bar', 2: 'bbiz'});
+ assert.deepEqual(_.map(collection, /b/g), [0, 1, 2]);
+ assert.equal(_.max(collection, /b/g), 'bbiz');
+ assert.equal(_.min(collection, /b/g), 'foo');
+ assert.deepEqual(_.partition(collection, /b/g), [['bar', 'bbiz'], ['foo']]);
+ assert.deepEqual(_.reject(collection, /b/g), ['foo']);
+ assert.equal(_.some(collection, /b/g), true);
+ assert.deepEqual(_.sortBy(collection, /b/g), ['foo', 'bar', 'bbiz']);
+ assert.equal(_.sortedIndex(collection, 'blah', /b/g), 1);
+ assert.deepEqual(_.uniq(collection, /b/g), ['foo', 'bar', 'bbiz']);
+
+ var objCollection = {a: 'foo', b: 'bar', c: 'bbiz'};
+ assert.deepEqual(_.mapObject(objCollection, /b/g), {a: 0, b: 1, c: 2});
+
+ // Restore the builtin iteratee
+ _.iteratee = builtinIteratee;
});
QUnit.test('restArgs', function(assert) {
diff --git a/vendor/underscore/test/objects.js b/vendor/underscore/test/objects.js
index fa1d9e3e3e..aaa1db94d5 100644
--- a/vendor/underscore/test/objects.js
+++ b/vendor/underscore/test/objects.js
@@ -123,7 +123,7 @@
subObj.c = 'd';
assert.deepEqual(_.extend({}, subObj), {a: 'b', c: 'd'}, 'extend copies all properties from source');
_.extend(subObj, {});
- assert.ok(!subObj.hasOwnProperty('a'), "extend does not convert destination object's 'in' properties to 'own' properties");
+ assert.notOk(subObj.hasOwnProperty('a'), "extend does not convert destination object's 'in' properties to 'own' properties");
try {
result = {};
@@ -205,7 +205,7 @@
return this[key] === 3 && this === instance;
}, instance), {c: 3}, 'function is given context');
- assert.ok(!_.has(_.pick({}, 'foo'), 'foo'), 'does not set own property if property not in object');
+ assert.notOk(_.has(_.pick({}, 'foo'), 'foo'), 'does not set own property if property not in object');
_.pick(data, function(value, key, obj) {
assert.equal(obj, data, 'passes same object as third parameter of iteratee');
});
@@ -309,7 +309,7 @@
Child.prototype.foo = 'foo';
var created = _.create(Child.prototype, new Child);
- assert.ok(!created.hasOwnProperty('foo'), 'should only add own properties');
+ assert.notOk(created.hasOwnProperty('foo'), 'should only add own properties');
});
QUnit.test('isEqual', function(assert) {
@@ -326,10 +326,10 @@
assert.ok(_.isEqual(null, null), '`null` is equal to `null`');
assert.ok(_.isEqual(), '`undefined` is equal to `undefined`');
- assert.ok(!_.isEqual(0, -0), '`0` is not equal to `-0`');
- assert.ok(!_.isEqual(-0, 0), 'Commutative equality is implemented for `0` and `-0`');
- assert.ok(!_.isEqual(null, void 0), '`null` is not equal to `undefined`');
- assert.ok(!_.isEqual(void 0, null), 'Commutative equality is implemented for `null` and `undefined`');
+ assert.notOk(_.isEqual(0, -0), '`0` is not equal to `-0`');
+ assert.notOk(_.isEqual(-0, 0), 'Commutative equality is implemented for `0` and `-0`');
+ assert.notOk(_.isEqual(null, void 0), '`null` is not equal to `undefined`');
+ assert.notOk(_.isEqual(void 0, null), 'Commutative equality is implemented for `null` and `undefined`');
// String object and primitive comparisons.
assert.ok(_.isEqual('Curly', 'Curly'), 'Identical string primitives are equal');
@@ -337,76 +337,76 @@
assert.ok(_.isEqual(new String('Curly'), 'Curly'), 'String primitives and their corresponding object wrappers are equal');
assert.ok(_.isEqual('Curly', new String('Curly')), 'Commutative equality is implemented for string objects and primitives');
- assert.ok(!_.isEqual('Curly', 'Larry'), 'String primitives with different values are not equal');
- assert.ok(!_.isEqual(new String('Curly'), new String('Larry')), 'String objects with different primitive values are not equal');
- assert.ok(!_.isEqual(new String('Curly'), {toString: function(){ return 'Curly'; }}), 'String objects and objects with a custom `toString` method are not equal');
+ assert.notOk(_.isEqual('Curly', 'Larry'), 'String primitives with different values are not equal');
+ assert.notOk(_.isEqual(new String('Curly'), new String('Larry')), 'String objects with different primitive values are not equal');
+ assert.notOk(_.isEqual(new String('Curly'), {toString: function(){ return 'Curly'; }}), 'String objects and objects with a custom `toString` method are not equal');
// Number object and primitive comparisons.
assert.ok(_.isEqual(75, 75), 'Identical number primitives are equal');
assert.ok(_.isEqual(new Number(75), new Number(75)), 'Number objects with identical primitive values are equal');
assert.ok(_.isEqual(75, new Number(75)), 'Number primitives and their corresponding object wrappers are equal');
assert.ok(_.isEqual(new Number(75), 75), 'Commutative equality is implemented for number objects and primitives');
- assert.ok(!_.isEqual(new Number(0), -0), '`new Number(0)` and `-0` are not equal');
- assert.ok(!_.isEqual(0, new Number(-0)), 'Commutative equality is implemented for `new Number(0)` and `-0`');
+ assert.notOk(_.isEqual(new Number(0), -0), '`new Number(0)` and `-0` are not equal');
+ assert.notOk(_.isEqual(0, new Number(-0)), 'Commutative equality is implemented for `new Number(0)` and `-0`');
- assert.ok(!_.isEqual(new Number(75), new Number(63)), 'Number objects with different primitive values are not equal');
- assert.ok(!_.isEqual(new Number(63), {valueOf: function(){ return 63; }}), 'Number objects and objects with a `valueOf` method are not equal');
+ assert.notOk(_.isEqual(new Number(75), new Number(63)), 'Number objects with different primitive values are not equal');
+ assert.notOk(_.isEqual(new Number(63), {valueOf: function(){ return 63; }}), 'Number objects and objects with a `valueOf` method are not equal');
// Comparisons involving `NaN`.
assert.ok(_.isEqual(NaN, NaN), '`NaN` is equal to `NaN`');
assert.ok(_.isEqual(new Number(NaN), NaN), 'Object(`NaN`) is equal to `NaN`');
- assert.ok(!_.isEqual(61, NaN), 'A number primitive is not equal to `NaN`');
- assert.ok(!_.isEqual(new Number(79), NaN), 'A number object is not equal to `NaN`');
- assert.ok(!_.isEqual(Infinity, NaN), '`Infinity` is not equal to `NaN`');
+ assert.notOk(_.isEqual(61, NaN), 'A number primitive is not equal to `NaN`');
+ assert.notOk(_.isEqual(new Number(79), NaN), 'A number object is not equal to `NaN`');
+ assert.notOk(_.isEqual(Infinity, NaN), '`Infinity` is not equal to `NaN`');
// Boolean object and primitive comparisons.
assert.ok(_.isEqual(true, true), 'Identical boolean primitives are equal');
assert.ok(_.isEqual(new Boolean, new Boolean), 'Boolean objects with identical primitive values are equal');
assert.ok(_.isEqual(true, new Boolean(true)), 'Boolean primitives and their corresponding object wrappers are equal');
assert.ok(_.isEqual(new Boolean(true), true), 'Commutative equality is implemented for booleans');
- assert.ok(!_.isEqual(new Boolean(true), new Boolean), 'Boolean objects with different primitive values are not equal');
+ assert.notOk(_.isEqual(new Boolean(true), new Boolean), 'Boolean objects with different primitive values are not equal');
// Common type coercions.
- assert.ok(!_.isEqual(new Boolean(false), true), '`new Boolean(false)` is not equal to `true`');
- assert.ok(!_.isEqual('75', 75), 'String and number primitives with like values are not equal');
- assert.ok(!_.isEqual(new Number(63), new String(63)), 'String and number objects with like values are not equal');
- assert.ok(!_.isEqual(75, '75'), 'Commutative equality is implemented for like string and number values');
- assert.ok(!_.isEqual(0, ''), 'Number and string primitives with like values are not equal');
- assert.ok(!_.isEqual(1, true), 'Number and boolean primitives with like values are not equal');
- assert.ok(!_.isEqual(new Boolean(false), new Number(0)), 'Boolean and number objects with like values are not equal');
- assert.ok(!_.isEqual(false, new String('')), 'Boolean primitives and string objects with like values are not equal');
- assert.ok(!_.isEqual(12564504e5, new Date(2009, 9, 25)), 'Dates and their corresponding numeric primitive values are not equal');
+ assert.notOk(_.isEqual(new Boolean(false), true), '`new Boolean(false)` is not equal to `true`');
+ assert.notOk(_.isEqual('75', 75), 'String and number primitives with like values are not equal');
+ assert.notOk(_.isEqual(new Number(63), new String(63)), 'String and number objects with like values are not equal');
+ assert.notOk(_.isEqual(75, '75'), 'Commutative equality is implemented for like string and number values');
+ assert.notOk(_.isEqual(0, ''), 'Number and string primitives with like values are not equal');
+ assert.notOk(_.isEqual(1, true), 'Number and boolean primitives with like values are not equal');
+ assert.notOk(_.isEqual(new Boolean(false), new Number(0)), 'Boolean and number objects with like values are not equal');
+ assert.notOk(_.isEqual(false, new String('')), 'Boolean primitives and string objects with like values are not equal');
+ assert.notOk(_.isEqual(12564504e5, new Date(2009, 9, 25)), 'Dates and their corresponding numeric primitive values are not equal');
// Dates.
assert.ok(_.isEqual(new Date(2009, 9, 25), new Date(2009, 9, 25)), 'Date objects referencing identical times are equal');
- assert.ok(!_.isEqual(new Date(2009, 9, 25), new Date(2009, 11, 13)), 'Date objects referencing different times are not equal');
- assert.ok(!_.isEqual(new Date(2009, 11, 13), {
+ assert.notOk(_.isEqual(new Date(2009, 9, 25), new Date(2009, 11, 13)), 'Date objects referencing different times are not equal');
+ assert.notOk(_.isEqual(new Date(2009, 11, 13), {
getTime: function(){
return 12606876e5;
}
}), 'Date objects and objects with a `getTime` method are not equal');
- assert.ok(!_.isEqual(new Date('Curly'), new Date('Curly')), 'Invalid dates are not equal');
+ assert.notOk(_.isEqual(new Date('Curly'), new Date('Curly')), 'Invalid dates are not equal');
// Functions.
- assert.ok(!_.isEqual(First, Second), 'Different functions with identical bodies and source code representations are not equal');
+ assert.notOk(_.isEqual(First, Second), 'Different functions with identical bodies and source code representations are not equal');
// RegExps.
assert.ok(_.isEqual(/(?:)/gim, /(?:)/gim), 'RegExps with equivalent patterns and flags are equal');
assert.ok(_.isEqual(/(?:)/gi, /(?:)/ig), 'Flag order is not significant');
- assert.ok(!_.isEqual(/(?:)/g, /(?:)/gi), 'RegExps with equivalent patterns and different flags are not equal');
- assert.ok(!_.isEqual(/Moe/gim, /Curly/gim), 'RegExps with different patterns and equivalent flags are not equal');
- assert.ok(!_.isEqual(/(?:)/gi, /(?:)/g), 'Commutative equality is implemented for RegExps');
- assert.ok(!_.isEqual(/Curly/g, {source: 'Larry', global: true, ignoreCase: false, multiline: false}), 'RegExps and RegExp-like objects are not equal');
+ assert.notOk(_.isEqual(/(?:)/g, /(?:)/gi), 'RegExps with equivalent patterns and different flags are not equal');
+ assert.notOk(_.isEqual(/Moe/gim, /Curly/gim), 'RegExps with different patterns and equivalent flags are not equal');
+ assert.notOk(_.isEqual(/(?:)/gi, /(?:)/g), 'Commutative equality is implemented for RegExps');
+ assert.notOk(_.isEqual(/Curly/g, {source: 'Larry', global: true, ignoreCase: false, multiline: false}), 'RegExps and RegExp-like objects are not equal');
// Empty arrays, array-like objects, and object literals.
assert.ok(_.isEqual({}, {}), 'Empty object literals are equal');
assert.ok(_.isEqual([], []), 'Empty array literals are equal');
assert.ok(_.isEqual([{}], [{}]), 'Empty nested arrays and objects are equal');
- assert.ok(!_.isEqual({length: 0}, []), 'Array-like objects and arrays are not equal.');
- assert.ok(!_.isEqual([], {length: 0}), 'Commutative equality is implemented for array-like objects');
+ assert.notOk(_.isEqual({length: 0}, []), 'Array-like objects and arrays are not equal.');
+ assert.notOk(_.isEqual([], {length: 0}), 'Commutative equality is implemented for array-like objects');
- assert.ok(!_.isEqual({}, []), 'Object literals and array literals are not equal');
- assert.ok(!_.isEqual([], {}), 'Commutative equality is implemented for objects and arrays');
+ assert.notOk(_.isEqual({}, []), 'Object literals and array literals are not equal');
+ assert.notOk(_.isEqual([], {}), 'Commutative equality is implemented for objects and arrays');
// Arrays with primitive and object values.
assert.ok(_.isEqual([1, 'Larry', true], [1, 'Larry', true]), 'Arrays containing identical primitives are equal');
@@ -424,14 +424,14 @@
// Array elements and properties.
assert.ok(_.isEqual(a, b), 'Arrays containing equivalent elements and different non-numeric properties are equal');
a.push('White Rocks');
- assert.ok(!_.isEqual(a, b), 'Arrays of different lengths are not equal');
+ assert.notOk(_.isEqual(a, b), 'Arrays of different lengths are not equal');
a.push('East Boulder');
b.push('Gunbarrel Ranch', 'Teller Farm');
- assert.ok(!_.isEqual(a, b), 'Arrays of identical lengths containing different elements are not equal');
+ assert.notOk(_.isEqual(a, b), 'Arrays of identical lengths containing different elements are not equal');
// Sparse arrays.
assert.ok(_.isEqual(Array(3), Array(3)), 'Sparse arrays of identical lengths are equal');
- assert.ok(!_.isEqual(Array(3), Array(6)), 'Sparse arrays of different lengths are not equal when both are empty');
+ assert.notOk(_.isEqual(Array(3), Array(6)), 'Sparse arrays of different lengths are not equal when both are empty');
var sparse = [];
sparse[1] = 5;
@@ -440,11 +440,11 @@
// Simple objects.
assert.ok(_.isEqual({a: 'Curly', b: 1, c: true}, {a: 'Curly', b: 1, c: true}), 'Objects containing identical primitives are equal');
assert.ok(_.isEqual({a: /Curly/g, b: new Date(2009, 11, 13)}, {a: /Curly/g, b: new Date(2009, 11, 13)}), 'Objects containing equivalent members are equal');
- assert.ok(!_.isEqual({a: 63, b: 75}, {a: 61, b: 55}), 'Objects of identical sizes with different values are not equal');
- assert.ok(!_.isEqual({a: 63, b: 75}, {a: 61, c: 55}), 'Objects of identical sizes with different property names are not equal');
- assert.ok(!_.isEqual({a: 1, b: 2}, {a: 1}), 'Objects of different sizes are not equal');
- assert.ok(!_.isEqual({a: 1}, {a: 1, b: 2}), 'Commutative equality is implemented for objects');
- assert.ok(!_.isEqual({x: 1, y: void 0}, {x: 1, z: 2}), 'Objects with identical keys and different values are not equivalent');
+ assert.notOk(_.isEqual({a: 63, b: 75}, {a: 61, b: 55}), 'Objects of identical sizes with different values are not equal');
+ assert.notOk(_.isEqual({a: 63, b: 75}, {a: 61, c: 55}), 'Objects of identical sizes with different property names are not equal');
+ assert.notOk(_.isEqual({a: 1, b: 2}, {a: 1}), 'Objects of different sizes are not equal');
+ assert.notOk(_.isEqual({a: 1}, {a: 1, b: 2}), 'Commutative equality is implemented for objects');
+ assert.notOk(_.isEqual({x: 1, y: void 0}, {x: 1, z: 2}), 'Objects with identical keys and different values are not equivalent');
// `A` contains nested objects and arrays.
a = {
@@ -479,9 +479,9 @@
// Instances.
assert.ok(_.isEqual(new First, new First), 'Object instances are equal');
- assert.ok(!_.isEqual(new First, new Second), 'Objects with different constructors and identical own properties are not equal');
- assert.ok(!_.isEqual({value: 1}, new First), 'Object instances and objects sharing equivalent properties are not equal');
- assert.ok(!_.isEqual({value: 2}, new Second), 'The prototype chain of objects should not be examined');
+ assert.notOk(_.isEqual(new First, new Second), 'Objects with different constructors and identical own properties are not equal');
+ assert.notOk(_.isEqual({value: 1}, new First), 'Object instances and objects sharing equivalent properties are not equal');
+ assert.notOk(_.isEqual({value: 2}, new Second), 'The prototype chain of objects should not be examined');
// Circular Arrays.
(a = []).push(a);
@@ -492,13 +492,13 @@
assert.ok(_.isEqual(a, b), 'Arrays containing circular references and equivalent properties are equal');
a.push('Shemp');
b.push('Curly');
- assert.ok(!_.isEqual(a, b), 'Arrays containing circular references and different properties are not equal');
+ assert.notOk(_.isEqual(a, b), 'Arrays containing circular references and different properties are not equal');
// More circular arrays #767.
a = ['everything is checked but', 'this', 'is not'];
a[1] = a;
b = ['everything is checked but', ['this', 'array'], 'is not'];
- assert.ok(!_.isEqual(a, b), 'Comparison of circular references with non-circular references are not equal');
+ assert.notOk(_.isEqual(a, b), 'Comparison of circular references with non-circular references are not equal');
// Circular Objects.
a = {abc: null};
@@ -511,13 +511,13 @@
assert.ok(_.isEqual(a, b), 'Objects containing circular references and equivalent properties are equal');
a.def = new Number(75);
b.def = new Number(63);
- assert.ok(!_.isEqual(a, b), 'Objects containing circular references and different properties are not equal');
+ assert.notOk(_.isEqual(a, b), 'Objects containing circular references and different properties are not equal');
// More circular objects #767.
a = {everything: 'is checked', but: 'this', is: 'not'};
a.but = a;
b = {everything: 'is checked', but: {that: 'object'}, is: 'not'};
- assert.ok(!_.isEqual(a, b), 'Comparison of circular references with non-circular object references are not equal');
+ assert.notOk(_.isEqual(a, b), 'Comparison of circular references with non-circular object references are not equal');
// Cyclic Structures.
a = [{abc: null}];
@@ -530,7 +530,7 @@
assert.ok(_.isEqual(a, b), 'Cyclic structures containing equivalent properties are equal');
a[0].def = new String('Larry');
b[0].def = new String('Curly');
- assert.ok(!_.isEqual(a, b), 'Cyclic structures containing different properties are not equal');
+ assert.notOk(_.isEqual(a, b), 'Cyclic structures containing different properties are not equal');
// Complex Circular References.
a = {foo: {b: {foo: {c: {foo: null}}}}};
@@ -540,7 +540,7 @@
assert.ok(_.isEqual(a, b), 'Cyclic structures with nested and identically-named properties are equal');
// Chaining.
- assert.ok(!_.isEqual(_({x: 1, y: void 0}).chain(), _({x: 1, z: 2}).chain()), 'Chained objects containing different values are not equal');
+ assert.notOk(_.isEqual(_({x: 1, y: void 0}).chain(), _({x: 1, z: 2}).chain()), 'Chained objects containing different values are not equal');
a = _({x: 1, y: 2}).chain();
b = _({x: 1, y: 2}).chain();
@@ -576,15 +576,15 @@
});
QUnit.test('isEmpty', function(assert) {
- assert.ok(!_([1]).isEmpty(), '[1] is not empty');
+ assert.notOk(_([1]).isEmpty(), '[1] is not empty');
assert.ok(_.isEmpty([]), '[] is empty');
- assert.ok(!_.isEmpty({one: 1}), '{one: 1} is not empty');
+ assert.notOk(_.isEmpty({one: 1}), '{one: 1} is not empty');
assert.ok(_.isEmpty({}), '{} is empty');
assert.ok(_.isEmpty(new RegExp('')), 'objects with prototype properties are empty');
assert.ok(_.isEmpty(null), 'null is empty');
assert.ok(_.isEmpty(), 'undefined is empty');
assert.ok(_.isEmpty(''), 'the empty string is empty');
- assert.ok(!_.isEmpty('moe'), 'but other strings are not');
+ assert.notOk(_.isEmpty('moe'), 'but other strings are not');
var obj = {one: 1};
delete obj.one;
@@ -592,27 +592,27 @@
var args = function(){ return arguments; };
assert.ok(_.isEmpty(args()), 'empty arguments object is empty');
- assert.ok(!_.isEmpty(args('')), 'non-empty arguments object is not empty');
+ assert.notOk(_.isEmpty(args('')), 'non-empty arguments object is not empty');
// covers collecting non-enumerable properties in IE < 9
var nonEnumProp = {toString: 5};
- assert.ok(!_.isEmpty(nonEnumProp), 'non-enumerable property is not empty');
+ assert.notOk(_.isEmpty(nonEnumProp), 'non-enumerable property is not empty');
});
if (typeof document === 'object') {
QUnit.test('isElement', function(assert) {
- assert.ok(!_.isElement('div'), 'strings are not dom elements');
+ assert.notOk(_.isElement('div'), 'strings are not dom elements');
assert.ok(_.isElement(testElement), 'an element is a DOM element');
});
}
QUnit.test('isArguments', function(assert) {
var args = (function(){ return arguments; }(1, 2, 3));
- assert.ok(!_.isArguments('string'), 'a string is not an arguments object');
- assert.ok(!_.isArguments(_.isArguments), 'a function is not an arguments object');
+ assert.notOk(_.isArguments('string'), 'a string is not an arguments object');
+ assert.notOk(_.isArguments(_.isArguments), 'a function is not an arguments object');
assert.ok(_.isArguments(args), 'but the arguments object is an arguments object');
- assert.ok(!_.isArguments(_.toArray(args)), 'but not when it\'s converted into an array');
- assert.ok(!_.isArguments([1, 2, 3]), 'and not vanilla arrays.');
+ assert.notOk(_.isArguments(_.toArray(args)), 'but not when it\'s converted into an array');
+ assert.notOk(_.isArguments([1, 2, 3]), 'and not vanilla arrays.');
});
QUnit.test('isObject', function(assert) {
@@ -622,24 +622,24 @@
assert.ok(_.isObject(testElement), 'and DOM element');
}
assert.ok(_.isObject(function() {}), 'and functions');
- assert.ok(!_.isObject(null), 'but not null');
- assert.ok(!_.isObject(void 0), 'and not undefined');
- assert.ok(!_.isObject('string'), 'and not string');
- assert.ok(!_.isObject(12), 'and not number');
- assert.ok(!_.isObject(true), 'and not boolean');
+ assert.notOk(_.isObject(null), 'but not null');
+ assert.notOk(_.isObject(void 0), 'and not undefined');
+ assert.notOk(_.isObject('string'), 'and not string');
+ assert.notOk(_.isObject(12), 'and not number');
+ assert.notOk(_.isObject(true), 'and not boolean');
assert.ok(_.isObject(new String('string')), 'but new String()');
});
QUnit.test('isArray', function(assert) {
- assert.ok(!_.isArray(void 0), 'undefined vars are not arrays');
- assert.ok(!_.isArray(arguments), 'the arguments object is not an array');
+ assert.notOk(_.isArray(void 0), 'undefined vars are not arrays');
+ assert.notOk(_.isArray(arguments), 'the arguments object is not an array');
assert.ok(_.isArray([1, 2, 3]), 'but arrays are');
});
QUnit.test('isString', function(assert) {
var obj = new String('I am a string object');
if (testElement) {
- assert.ok(!_.isString(testElement), 'an element is not a string');
+ assert.notOk(_.isString(testElement), 'an element is not a string');
}
assert.ok(_.isString([1, 2, 3].join(', ')), 'but strings are');
assert.strictEqual(_.isString('I am a string literal'), true, 'string literals are');
@@ -648,9 +648,9 @@
});
QUnit.test('isSymbol', function(assert) {
- assert.ok(!_.isSymbol(0), 'numbers are not symbols');
- assert.ok(!_.isSymbol(''), 'strings are not symbols');
- assert.ok(!_.isSymbol(_.isSymbol), 'functions are not symbols');
+ assert.notOk(_.isSymbol(0), 'numbers are not symbols');
+ assert.notOk(_.isSymbol(''), 'strings are not symbols');
+ assert.notOk(_.isSymbol(_.isSymbol), 'functions are not symbols');
if (typeof Symbol === 'function') {
assert.ok(_.isSymbol(Symbol()), 'symbols are symbols');
assert.ok(_.isSymbol(Symbol('description')), 'described symbols are symbols');
@@ -659,43 +659,43 @@
});
QUnit.test('isNumber', function(assert) {
- assert.ok(!_.isNumber('string'), 'a string is not a number');
- assert.ok(!_.isNumber(arguments), 'the arguments object is not a number');
- assert.ok(!_.isNumber(void 0), 'undefined is not a number');
+ assert.notOk(_.isNumber('string'), 'a string is not a number');
+ assert.notOk(_.isNumber(arguments), 'the arguments object is not a number');
+ assert.notOk(_.isNumber(void 0), 'undefined is not a number');
assert.ok(_.isNumber(3 * 4 - 7 / 10), 'but numbers are');
assert.ok(_.isNumber(NaN), 'NaN *is* a number');
assert.ok(_.isNumber(Infinity), 'Infinity is a number');
- assert.ok(!_.isNumber('1'), 'numeric strings are not numbers');
+ assert.notOk(_.isNumber('1'), 'numeric strings are not numbers');
});
QUnit.test('isBoolean', function(assert) {
- assert.ok(!_.isBoolean(2), 'a number is not a boolean');
- assert.ok(!_.isBoolean('string'), 'a string is not a boolean');
- assert.ok(!_.isBoolean('false'), 'the string "false" is not a boolean');
- assert.ok(!_.isBoolean('true'), 'the string "true" is not a boolean');
- assert.ok(!_.isBoolean(arguments), 'the arguments object is not a boolean');
- assert.ok(!_.isBoolean(void 0), 'undefined is not a boolean');
- assert.ok(!_.isBoolean(NaN), 'NaN is not a boolean');
- assert.ok(!_.isBoolean(null), 'null is not a boolean');
+ assert.notOk(_.isBoolean(2), 'a number is not a boolean');
+ assert.notOk(_.isBoolean('string'), 'a string is not a boolean');
+ assert.notOk(_.isBoolean('false'), 'the string "false" is not a boolean');
+ assert.notOk(_.isBoolean('true'), 'the string "true" is not a boolean');
+ assert.notOk(_.isBoolean(arguments), 'the arguments object is not a boolean');
+ assert.notOk(_.isBoolean(void 0), 'undefined is not a boolean');
+ assert.notOk(_.isBoolean(NaN), 'NaN is not a boolean');
+ assert.notOk(_.isBoolean(null), 'null is not a boolean');
assert.ok(_.isBoolean(true), 'but true is');
assert.ok(_.isBoolean(false), 'and so is false');
});
QUnit.test('isMap', function(assert) {
- assert.ok(!_.isMap('string'), 'a string is not a map');
- assert.ok(!_.isMap(2), 'a number is not a map');
- assert.ok(!_.isMap({}), 'an object is not a map');
- assert.ok(!_.isMap(false), 'a boolean is not a map');
- assert.ok(!_.isMap(void 0), 'undefined is not a map');
- assert.ok(!_.isMap([1, 2, 3]), 'an array is not a map');
+ assert.notOk(_.isMap('string'), 'a string is not a map');
+ assert.notOk(_.isMap(2), 'a number is not a map');
+ assert.notOk(_.isMap({}), 'an object is not a map');
+ assert.notOk(_.isMap(false), 'a boolean is not a map');
+ assert.notOk(_.isMap(void 0), 'undefined is not a map');
+ assert.notOk(_.isMap([1, 2, 3]), 'an array is not a map');
if (typeof Set === 'function') {
- assert.ok(!_.isMap(new Set()), 'a set is not a map');
+ assert.notOk(_.isMap(new Set()), 'a set is not a map');
}
if (typeof WeakSet === 'function') {
- assert.ok(!_.isMap(new WeakSet()), 'a weakset is not a map');
+ assert.notOk(_.isMap(new WeakSet()), 'a weakset is not a map');
}
if (typeof WeakMap === 'function') {
- assert.ok(!_.isMap(new WeakMap()), 'a weakmap is not a map');
+ assert.notOk(_.isMap(new WeakMap()), 'a weakmap is not a map');
}
if (typeof Map === 'function') {
var keyString = 'a string';
@@ -706,20 +706,20 @@
});
QUnit.test('isWeakMap', function(assert) {
- assert.ok(!_.isWeakMap('string'), 'a string is not a weakmap');
- assert.ok(!_.isWeakMap(2), 'a number is not a weakmap');
- assert.ok(!_.isWeakMap({}), 'an object is not a weakmap');
- assert.ok(!_.isWeakMap(false), 'a boolean is not a weakmap');
- assert.ok(!_.isWeakMap(void 0), 'undefined is not a weakmap');
- assert.ok(!_.isWeakMap([1, 2, 3]), 'an array is not a weakmap');
+ assert.notOk(_.isWeakMap('string'), 'a string is not a weakmap');
+ assert.notOk(_.isWeakMap(2), 'a number is not a weakmap');
+ assert.notOk(_.isWeakMap({}), 'an object is not a weakmap');
+ assert.notOk(_.isWeakMap(false), 'a boolean is not a weakmap');
+ assert.notOk(_.isWeakMap(void 0), 'undefined is not a weakmap');
+ assert.notOk(_.isWeakMap([1, 2, 3]), 'an array is not a weakmap');
if (typeof Set === 'function') {
- assert.ok(!_.isWeakMap(new Set()), 'a set is not a weakmap');
+ assert.notOk(_.isWeakMap(new Set()), 'a set is not a weakmap');
}
if (typeof WeakSet === 'function') {
- assert.ok(!_.isWeakMap(new WeakSet()), 'a weakset is not a weakmap');
+ assert.notOk(_.isWeakMap(new WeakSet()), 'a weakset is not a weakmap');
}
if (typeof Map === 'function') {
- assert.ok(!_.isWeakMap(new Map()), 'a map is not a weakmap');
+ assert.notOk(_.isWeakMap(new Map()), 'a map is not a weakmap');
}
if (typeof WeakMap === 'function') {
var keyObj = {}, obj = new WeakMap();
@@ -729,20 +729,20 @@
});
QUnit.test('isSet', function(assert) {
- assert.ok(!_.isSet('string'), 'a string is not a set');
- assert.ok(!_.isSet(2), 'a number is not a set');
- assert.ok(!_.isSet({}), 'an object is not a set');
- assert.ok(!_.isSet(false), 'a boolean is not a set');
- assert.ok(!_.isSet(void 0), 'undefined is not a set');
- assert.ok(!_.isSet([1, 2, 3]), 'an array is not a set');
+ assert.notOk(_.isSet('string'), 'a string is not a set');
+ assert.notOk(_.isSet(2), 'a number is not a set');
+ assert.notOk(_.isSet({}), 'an object is not a set');
+ assert.notOk(_.isSet(false), 'a boolean is not a set');
+ assert.notOk(_.isSet(void 0), 'undefined is not a set');
+ assert.notOk(_.isSet([1, 2, 3]), 'an array is not a set');
if (typeof Map === 'function') {
- assert.ok(!_.isSet(new Map()), 'a map is not a set');
+ assert.notOk(_.isSet(new Map()), 'a map is not a set');
}
if (typeof WeakMap === 'function') {
- assert.ok(!_.isSet(new WeakMap()), 'a weakmap is not a set');
+ assert.notOk(_.isSet(new WeakMap()), 'a weakmap is not a set');
}
if (typeof WeakSet === 'function') {
- assert.ok(!_.isSet(new WeakSet()), 'a weakset is not a set');
+ assert.notOk(_.isSet(new WeakSet()), 'a weakset is not a set');
}
if (typeof Set === 'function') {
var obj = new Set();
@@ -753,20 +753,20 @@
QUnit.test('isWeakSet', function(assert) {
- assert.ok(!_.isWeakSet('string'), 'a string is not a weakset');
- assert.ok(!_.isWeakSet(2), 'a number is not a weakset');
- assert.ok(!_.isWeakSet({}), 'an object is not a weakset');
- assert.ok(!_.isWeakSet(false), 'a boolean is not a weakset');
- assert.ok(!_.isWeakSet(void 0), 'undefined is not a weakset');
- assert.ok(!_.isWeakSet([1, 2, 3]), 'an array is not a weakset');
+ assert.notOk(_.isWeakSet('string'), 'a string is not a weakset');
+ assert.notOk(_.isWeakSet(2), 'a number is not a weakset');
+ assert.notOk(_.isWeakSet({}), 'an object is not a weakset');
+ assert.notOk(_.isWeakSet(false), 'a boolean is not a weakset');
+ assert.notOk(_.isWeakSet(void 0), 'undefined is not a weakset');
+ assert.notOk(_.isWeakSet([1, 2, 3]), 'an array is not a weakset');
if (typeof Map === 'function') {
- assert.ok(!_.isWeakSet(new Map()), 'a map is not a weakset');
+ assert.notOk(_.isWeakSet(new Map()), 'a map is not a weakset');
}
if (typeof WeakMap === 'function') {
- assert.ok(!_.isWeakSet(new WeakMap()), 'a weakmap is not a weakset');
+ assert.notOk(_.isWeakSet(new WeakMap()), 'a weakmap is not a weakset');
}
if (typeof Set === 'function') {
- assert.ok(!_.isWeakSet(new Set()), 'a set is not a weakset');
+ assert.notOk(_.isWeakSet(new Set()), 'a set is not a weakset');
}
if (typeof WeakSet === 'function') {
var obj = new WeakSet();
@@ -776,19 +776,19 @@
});
QUnit.test('isFunction', function(assert) {
- assert.ok(!_.isFunction(void 0), 'undefined vars are not functions');
- assert.ok(!_.isFunction([1, 2, 3]), 'arrays are not functions');
- assert.ok(!_.isFunction('moe'), 'strings are not functions');
+ assert.notOk(_.isFunction(void 0), 'undefined vars are not functions');
+ assert.notOk(_.isFunction([1, 2, 3]), 'arrays are not functions');
+ assert.notOk(_.isFunction('moe'), 'strings are not functions');
assert.ok(_.isFunction(_.isFunction), 'but functions are');
assert.ok(_.isFunction(function(){}), 'even anonymous ones');
if (testElement) {
- assert.ok(!_.isFunction(testElement), 'elements are not functions');
+ assert.notOk(_.isFunction(testElement), 'elements are not functions');
}
var nodelist = typeof document != 'undefined' && document.childNodes;
if (nodelist) {
- assert.ok(!_.isFunction(nodelist));
+ assert.notOk(_.isFunction(nodelist));
}
});
@@ -806,65 +806,68 @@
}
QUnit.test('isDate', function(assert) {
- assert.ok(!_.isDate(100), 'numbers are not dates');
- assert.ok(!_.isDate({}), 'objects are not dates');
+ assert.notOk(_.isDate(100), 'numbers are not dates');
+ assert.notOk(_.isDate({}), 'objects are not dates');
assert.ok(_.isDate(new Date()), 'but dates are');
});
QUnit.test('isRegExp', function(assert) {
- assert.ok(!_.isRegExp(_.identity), 'functions are not RegExps');
+ assert.notOk(_.isRegExp(_.identity), 'functions are not RegExps');
assert.ok(_.isRegExp(/identity/), 'but RegExps are');
});
QUnit.test('isFinite', function(assert) {
- assert.ok(!_.isFinite(void 0), 'undefined is not finite');
- assert.ok(!_.isFinite(null), 'null is not finite');
- assert.ok(!_.isFinite(NaN), 'NaN is not finite');
- assert.ok(!_.isFinite(Infinity), 'Infinity is not finite');
- assert.ok(!_.isFinite(-Infinity), '-Infinity is not finite');
+ assert.notOk(_.isFinite(void 0), 'undefined is not finite');
+ assert.notOk(_.isFinite(null), 'null is not finite');
+ assert.notOk(_.isFinite(NaN), 'NaN is not finite');
+ assert.notOk(_.isFinite(Infinity), 'Infinity is not finite');
+ assert.notOk(_.isFinite(-Infinity), '-Infinity is not finite');
assert.ok(_.isFinite('12'), 'Numeric strings are numbers');
- assert.ok(!_.isFinite('1a'), 'Non numeric strings are not numbers');
- assert.ok(!_.isFinite(''), 'Empty strings are not numbers');
+ assert.notOk(_.isFinite('1a'), 'Non numeric strings are not numbers');
+ assert.notOk(_.isFinite(''), 'Empty strings are not numbers');
var obj = new Number(5);
assert.ok(_.isFinite(obj), 'Number instances can be finite');
assert.ok(_.isFinite(0), '0 is finite');
assert.ok(_.isFinite(123), 'Ints are finite');
assert.ok(_.isFinite(-12.44), 'Floats are finite');
if (typeof Symbol === 'function') {
- assert.ok(!_.isFinite(Symbol()), 'symbols are not numbers');
- assert.ok(!_.isFinite(Symbol('description')), 'described symbols are not numbers');
- assert.ok(!_.isFinite(Object(Symbol())), 'boxed symbols are not numbers');
+ assert.notOk(_.isFinite(Symbol()), 'symbols are not numbers');
+ assert.notOk(_.isFinite(Symbol('description')), 'described symbols are not numbers');
+ assert.notOk(_.isFinite(Object(Symbol())), 'boxed symbols are not numbers');
}
});
QUnit.test('isNaN', function(assert) {
- assert.ok(!_.isNaN(void 0), 'undefined is not NaN');
- assert.ok(!_.isNaN(null), 'null is not NaN');
- assert.ok(!_.isNaN(0), '0 is not NaN');
- assert.ok(!_.isNaN(new Number(0)), 'wrapped 0 is not NaN');
+ assert.notOk(_.isNaN(void 0), 'undefined is not NaN');
+ assert.notOk(_.isNaN(null), 'null is not NaN');
+ assert.notOk(_.isNaN(0), '0 is not NaN');
+ assert.notOk(_.isNaN(new Number(0)), 'wrapped 0 is not NaN');
assert.ok(_.isNaN(NaN), 'but NaN is');
assert.ok(_.isNaN(new Number(NaN)), 'wrapped NaN is still NaN');
+ if (typeof Symbol !== 'undefined'){
+ assert.notOk(_.isNaN(Symbol()), 'symbol is not NaN');
+ }
});
QUnit.test('isNull', function(assert) {
- assert.ok(!_.isNull(void 0), 'undefined is not null');
- assert.ok(!_.isNull(NaN), 'NaN is not null');
+ assert.notOk(_.isNull(void 0), 'undefined is not null');
+ assert.notOk(_.isNull(NaN), 'NaN is not null');
assert.ok(_.isNull(null), 'but null is');
});
QUnit.test('isUndefined', function(assert) {
- assert.ok(!_.isUndefined(1), 'numbers are defined');
- assert.ok(!_.isUndefined(null), 'null is defined');
- assert.ok(!_.isUndefined(false), 'false is defined');
- assert.ok(!_.isUndefined(NaN), 'NaN is defined');
+ assert.notOk(_.isUndefined(1), 'numbers are defined');
+ assert.notOk(_.isUndefined(null), 'null is defined');
+ assert.notOk(_.isUndefined(false), 'false is defined');
+ assert.notOk(_.isUndefined(NaN), 'NaN is defined');
assert.ok(_.isUndefined(), 'nothing is undefined');
assert.ok(_.isUndefined(void 0), 'undefined is undefined');
});
QUnit.test('isError', function(assert) {
- assert.ok(!_.isError(1), 'numbers are not Errors');
- assert.ok(!_.isError(null), 'null is not an Error');
- assert.ok(!_.isError(Error), 'functions are not Errors');
+ assert.notOk(_.isError(1), 'numbers are not Errors');
+ assert.notOk(_.isError(null), 'null is not an Error');
+ assert.notOk(_.isError(Error), 'functions are not Errors');
assert.ok(_.isError(new Error()), 'Errors are Errors');
assert.ok(_.isError(new EvalError()), 'EvalErrors are Errors');
assert.ok(_.isError(new RangeError()), 'RangeErrors are Errors');
@@ -893,13 +896,13 @@
QUnit.test('has', function(assert) {
var obj = {foo: 'bar', func: function(){}};
assert.ok(_.has(obj, 'foo'), 'has() checks that the object has a property.');
- assert.ok(!_.has(obj, 'baz'), "has() returns false if the object doesn't have the property.");
+ assert.notOk(_.has(obj, 'baz'), "has() returns false if the object doesn't have the property.");
assert.ok(_.has(obj, 'func'), 'has() works for functions too.');
obj.hasOwnProperty = null;
assert.ok(_.has(obj, 'foo'), 'has() works even when the hasOwnProperty method is deleted.');
var child = {};
child.prototype = obj;
- assert.ok(!_.has(child, 'foo'), 'has() does not check the prototype chain for a property.');
+ assert.notOk(_.has(child, 'foo'), 'has() does not check the prototype chain for a property.');
assert.strictEqual(_.has(null, 'foo'), false, 'has() returns false for null');
assert.strictEqual(_.has(void 0, 'foo'), false, 'has() returns false for undefined');
});
@@ -958,8 +961,8 @@
assert.equal(_.matcher({})(null), true, 'Empty spec called with null object returns true');
assert.equal(_.matcher({a: 1})(null), false, 'Non-empty spec called with null object returns false');
- assert.ok(_.find(stooges, _.matcher({hair: false})) === curly, 'returns a predicate that can be used by finding functions.');
- assert.ok(_.find(stooges, _.matcher(moe)) === moe, 'can be used to locate an object exists in a collection.');
+ assert.strictEqual(_.find(stooges, _.matcher({hair: false})), curly, 'returns a predicate that can be used by finding functions.');
+ assert.strictEqual(_.find(stooges, _.matcher(moe)), moe, 'can be used to locate an object exists in a collection.');
assert.deepEqual(_.filter([null, void 0], _.matcher({a: 1})), [], 'Do not throw on null values.');
assert.deepEqual(_.filter([null, void 0], _.matcher(null)), [null, void 0], 'null matches null');
diff --git a/vendor/underscore/test/utility.js b/vendor/underscore/test/utility.js
index fbd54df31c..6a81e8735e 100644
--- a/vendor/underscore/test/utility.js
+++ b/vendor/underscore/test/utility.js
@@ -52,8 +52,8 @@
QUnit.test('#750 - Return _ instance.', function(assert) {
assert.expect(2);
var instance = _([]);
- assert.ok(_(instance) === instance);
- assert.ok(new _(instance) === instance);
+ assert.strictEqual(_(instance), instance);
+ assert.strictEqual(new _(instance), instance);
});
QUnit.test('identity', function(assert) {
@@ -137,11 +137,12 @@
});
QUnit.test('mixin', function(assert) {
- _.mixin({
+ var ret = _.mixin({
myReverse: function(string) {
return string.split('').reverse().join('');
}
});
+ assert.equal(ret, _, 'returns the _ object to facilitate chaining');
assert.equal(_.myReverse('panacea'), 'aecanap', 'mixed in a function to _');
assert.equal(_('champ').myReverse(), 'pmahc', 'mixed in a function to the OOP wrapper');
});
@@ -188,7 +189,7 @@
var str = 'some string & another string & yet another';
var escaped = _.escape(str);
- assert.ok(escaped.indexOf('&') !== -1, 'handles & aka &');
+ assert.notStrictEqual(escaped.indexOf('&'), -1, 'handles & aka &');
assert.equal(_.unescape(str), str, 'can unescape &');
});
@@ -370,9 +371,9 @@
});
QUnit.test('#547 - _.templateSettings is unchanged by custom settings.', function(assert) {
- assert.ok(!_.templateSettings.variable);
+ assert.notOk(_.templateSettings.variable);
_.template('', {}, {variable: 'x'});
- assert.ok(!_.templateSettings.variable);
+ assert.notOk(_.templateSettings.variable);
});
QUnit.test('#556 - undefined template variables.', function(assert) {
@@ -397,11 +398,11 @@
assert.expect(2);
var count = 0;
var template = _.template('<%= f() %>');
- template({f: function(){ assert.ok(!count++); }});
+ template({f: function(){ assert.notOk(count++); }});
var countEscaped = 0;
var templateEscaped = _.template('<%- f() %>');
- templateEscaped({f: function(){ assert.ok(!countEscaped++); }});
+ templateEscaped({f: function(){ assert.notOk(countEscaped++); }});
});
QUnit.test('#746 - _.template settings are not modified.', function(assert) {
diff --git a/vendor/underscore/underscore.js b/vendor/underscore/underscore.js
index bddfdc9f12..4a0cf6e73c 100644
--- a/vendor/underscore/underscore.js
+++ b/vendor/underscore/underscore.js
@@ -84,18 +84,23 @@
};
};
+ var builtinIteratee;
+
// An internal function to generate callbacks that can be applied to each
// element in a collection, returning the desired result — either `identity`,
// an arbitrary callback, a property matcher, or a property accessor.
var cb = function(value, context, argCount) {
+ if (_.iteratee !== builtinIteratee) return _.iteratee(value, context);
if (value == null) return _.identity;
if (_.isFunction(value)) return optimizeCb(value, context, argCount);
if (_.isObject(value)) return _.matcher(value);
return _.property(value);
};
- // An external wrapper for the internal callback generator.
- _.iteratee = function(value, context) {
+ // External wrapper for our callback generator. Users may customize
+ // `_.iteratee` if they want additional predicate/iteratee shorthand styles.
+ // This abstraction hides the internal-only argCount argument.
+ _.iteratee = builtinIteratee = function(value, context) {
return cb(value, context, Infinity);
};
@@ -439,7 +444,7 @@
// Keep surrogate pair characters together
return obj.match(reStrSymbol);
}
- if (isArrayLike(obj)) return _.map(obj);
+ if (isArrayLike(obj)) return _.map(obj, _.identity);
return _.values(obj);
};
@@ -462,7 +467,7 @@
// values in the array. Aliased as `head` and `take`. The **guard** check
// allows it to work with `_.map`.
_.first = _.head = _.take = function(array, n, guard) {
- if (array == null) return void 0;
+ if (array == null || array.length < 1) return void 0;
if (n == null || guard) return array[0];
return _.initial(array, array.length - n);
};
@@ -477,7 +482,7 @@
// Get the last element of an array. Passing **n** will return the last N
// values in the array.
_.last = function(array, n, guard) {
- if (array == null) return void 0;
+ if (array == null || array.length < 1) return void 0;
if (n == null || guard) return array[array.length - 1];
return _.rest(array, Math.max(0, array.length - n));
};
@@ -491,7 +496,7 @@
// Trim out all falsy values from an array.
_.compact = function(array) {
- return _.filter(array);
+ return _.filter(array, Boolean);
};
// Internal implementation of a recursive `flatten` function.
@@ -1094,7 +1099,7 @@
return result;
});
- // Return a copy of the object without the blacklisted properties.
+ // Return a copy of the object without the blacklisted properties.
_.omit = restArgs(function(obj, keys) {
var iteratee = keys[0], context;
if (_.isFunction(iteratee)) {
@@ -1403,7 +1408,7 @@
return new Date().getTime();
};
- // List of HTML entities for escaping.
+ // List of HTML entities for escaping.
var escapeMap = {
'&': '&',
'<': '<',
@@ -1568,6 +1573,7 @@
return chainResult(this, func.apply(_, args));
};
});
+ return _;
};
// Add all of the Underscore functions to the wrapper object.
@@ -1602,7 +1608,7 @@
_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
_.prototype.toString = function() {
- return '' + this._wrapped;
+ return String(this._wrapped);
};
// AMD registration happens at the end for compatibility with AMD loaders