diff --git a/.markdown-doctest-setup.js b/.markdown-doctest-setup.js index b525cfd5c8..4c9a22235e 100644 --- a/.markdown-doctest-setup.js +++ b/.markdown-doctest-setup.js @@ -1,3 +1,7 @@ +'use strict'; + +delete global['__core-js_shared__']; + var _ = require('./lodash.js'); function mockQuery() { @@ -41,4 +45,4 @@ module.exports = { 'process': process, 'setImmediate': setImmediate } -} +}; diff --git a/README.md b/README.md index 514bc309a2..601e41b5c9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# lodash v4.12.0 +# lodash v4.13.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.12.0/.github/CONTRIBUTING.md) | +[Contributing](https://github.com/lodash/lodash/blob/4.13.0/.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.12.0/LICENSE) & supports [modern environments](#support).
+Lodash is released under the [MIT license](https://raw.githubusercontent.com/lodash/lodash/4.13.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.12.0/dist/lodash.core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.12.0/dist/lodash.core.min.js)) - * [Full build](https://raw.githubusercontent.com/lodash/lodash/4.12.0/dist/lodash.js) ([~22 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.12.0/dist/lodash.min.js)) + * [Core build](https://raw.githubusercontent.com/lodash/lodash/4.13.0/dist/lodash.core.js) ([~4 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.13.0/dist/lodash.core.min.js)) + * [Full build](https://raw.githubusercontent.com/lodash/lodash/4.13.0/dist/lodash.js) ([~22 kB gzipped](https://raw.githubusercontent.com/lodash/lodash/4.13.0/dist/lodash.min.js)) * [CDN copies](https://www.jsdelivr.com/projects/lodash) ## Why Lodash? @@ -43,4 +43,4 @@ Lodash is available in a [variety of builds](https://lodash.com/custom-builds) & * [lodash](https://www.npmjs.com/package/lodash) & [per method packages](https://www.npmjs.com/browse/keyword/lodash-modularized) * [lodash-amd](https://www.npmjs.com/package/lodash-amd) * [lodash-es](https://www.npmjs.com/package/lodash-es) & [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash) - * [lodash/fp](https://github.com/lodash/lodash/tree/4.12.0-npm/fp) + * [lodash/fp](https://github.com/lodash/lodash/tree/4.13.0-npm/fp) diff --git a/dist/lodash.core.js b/dist/lodash.core.js index 954cdcf20f..b2f6900f5a 100644 --- a/dist/lodash.core.js +++ b/dist/lodash.core.js @@ -1,6 +1,7 @@ /** * @license - * lodash + * lodash (Custom Build) + * Build: `lodash core -o ./dist/lodash.core.js` * Copyright jQuery Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -12,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.12.0'; + var VERSION = '4.13.0'; /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; @@ -46,9 +47,6 @@ var reUnescapedHtml = /[&<>"'`]/g, reHasUnescapedHtml = RegExp(reUnescapedHtml.source); - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; - /** Used to map characters to HTML entities. */ var htmlEscapes = { '&': '&', @@ -59,48 +57,23 @@ '`': '`' }; - /** Used to determine if values are of the language type `Object`. */ - var objectTypes = { - 'function': true, - 'object': true - }; - /** Detect free variable `exports`. */ - var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) - ? exports - : undefined; + var freeExports = typeof exports == 'object' && exports; /** Detect free variable `module`. */ - var freeModule = (objectTypes[typeof module] && module && !module.nodeType) - ? module - : undefined; - - /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = (freeModule && freeModule.exports === freeExports) - ? freeExports - : undefined; + var freeModule = freeExports && typeof module == 'object' && module; /** Detect free variable `global` from Node.js. */ - var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); + var freeGlobal = checkGlobal(typeof global == 'object' && global); /** Detect free variable `self`. */ - var freeSelf = checkGlobal(objectTypes[typeof self] && self); - - /** Detect free variable `window`. */ - var freeWindow = checkGlobal(objectTypes[typeof window] && window); + var freeSelf = checkGlobal(typeof self == 'object' && self); /** Detect `this` as the global object. */ - var thisGlobal = checkGlobal(objectTypes[typeof this] && this); + var thisGlobal = checkGlobal(typeof this == 'object' && this); - /** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ - var root = freeGlobal || - ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || - freeSelf || thisGlobal || Function('return this')(); + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || thisGlobal || Function('return this')(); /*--------------------------------------------------------------------------*/ @@ -118,27 +91,26 @@ } /** - * The base implementation of methods like `_.find` and `_.findKey`, without - * support for iteratee shorthands, which iterates over `collection` using - * `eachFunc`. + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. * * @private - * @param {Array|Object} collection The collection to search. + * @param {Array} array The array to search. * @param {Function} predicate The function invoked per iteration. - * @param {Function} eachFunc The function to iterate over `collection`. - * @param {boolean} [retKey] Specify returning the key of the found element - * instead of the element itself. - * @returns {*} Returns the found element or its key, else `undefined`. + * @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 value, else `-1`. */ - function baseFind(collection, predicate, eachFunc, retKey) { - var result; - eachFunc(collection, function(value, key, collection) { - if (predicate(value, key, collection)) { - result = retKey ? key : value; - return false; + function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; } - }); - return result; + } + return -1; } /** @@ -163,25 +135,6 @@ return accumulator; } - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; - } - /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names @@ -227,33 +180,8 @@ * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ - function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; - } - - /** - * Converts `iterator` to an array. - * - * @private - * @param {Object} iterator The iterator to convert. - * @returns {Array} Returns the converted array. - */ - function iteratorToArray(iterator) { - var data, - result = []; - - while (!(data = iterator.next()).done) { - result.push(data.value); - } - return result; + function isHostObject() { + return false; } /*--------------------------------------------------------------------------*/ @@ -279,11 +207,7 @@ var oldDash = root._; /** Built-in value references. */ - var Reflect = root.Reflect, - Symbol = root.Symbol, - Uint8Array = root.Uint8Array, - enumerate = Reflect ? Reflect.enumerate : undefined, - objectCreate = Object.create, + var objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ @@ -368,19 +292,21 @@ * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, * `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, * `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, - * `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, - * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, - * `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`, - * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, - * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`, - * `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`, - * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`, - * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, - * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, - * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toFinite`, - * `toInteger`, `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, - * `toString`, `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, - * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words` + * `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` * * @name _ * @constructor @@ -726,7 +652,7 @@ } stack.push([object, other]); if (isSameTag && !objIsObj) { - var result = (objIsArr || isTypedArray(object)) + var result = (objIsArr) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); stack.pop(); @@ -800,13 +726,6 @@ return result; } - // Fallback for IE < 9 with es6-shim. - if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) { - baseKeysIn = function(object) { - return iteratorToArray(enumerate(object)); - }; - } - /** * The base implementation of `_.lt` which doesn't coerce arguments to numbers. * @@ -1369,23 +1288,6 @@ */ var getLength = baseProperty('length'); - /** - * Creates an array of index keys for `object` values of arrays, - * `arguments` objects, and strings, otherwise `null` is returned. - * - * @private - * @param {Object} object The object to query. - * @returns {Array|null} Returns index keys, else `null`. - */ - function indexKeys(object) { - var length = object ? object.length : undefined; - if (isLength(length) && - (isArray(object) || isString(object) || isArguments(object))) { - return baseTimes(length, String); - } - return null; - } - /** * Checks if `value` is a flattenable `arguments` object or array. * @@ -1397,35 +1299,6 @@ return isArray(value) || isArguments(value); } - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length); - } - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; - } - /** * Converts `value` to a string key if it's not a string or symbol. * @@ -1492,6 +1365,54 @@ : []; } + /** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * @static + * @memberOf _ + * @since 1.1.0 + * @category Array + * @param {Array} array The array to search. + * @param {Array|Function|Object|string} [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`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(o) { return o.user == 'barney'; }); + * // => 0 + * + * // The `_.matches` iteratee shorthand. + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // The `_.matchesProperty` iteratee shorthand. + * _.findIndex(users, ['active', false]); + * // => 0 + * + * // The `_.property` iteratee shorthand. + * _.findIndex(users, 'active'); + * // => 2 + */ + function findIndex(array, predicate, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, baseIteratee(predicate, 3), index); + } + /** * Flattens `array` a single level deep. * @@ -1873,6 +1794,7 @@ * @param {Array|Object} collection The collection to search. * @param {Array|Function|Object|string} [predicate=_.identity] * The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. * @returns {*} Returns the matched element, else `undefined`. * @example * @@ -1897,8 +1819,10 @@ * _.find(users, 'active'); * // => object for 'barney' */ - function find(collection, predicate) { - return baseFind(collection, baseIteratee(predicate), baseEach); + function find(collection, predicate, fromIndex) { + collection = isArrayLike(collection) ? collection : values(collection); + var index = findIndex(collection, predicate, fromIndex); + return index > -1 ? collection[index] : undefined; } /** @@ -2182,7 +2106,7 @@ * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * - * **Note:** Unlike native `Function#bind` this method doesn't set the "length" + * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" * property of bound functions. * * @static @@ -2993,7 +2917,7 @@ /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on + * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static @@ -3301,25 +3225,7 @@ * _.keys('hi'); * // => ['0', '1'] */ - function keys(object) { - var isProto = isPrototype(object); - if (!(isProto || isArrayLike(object))) { - return baseKeys(object); - } - var indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - for (var key in object) { - if (hasOwnProperty.call(object, key) && - !(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(isProto && key == 'constructor')) { - result.push(key); - } - } - return result; - } + var keys = baseKeys; /** * Creates an array of the own and inherited enumerable property names of `object`. @@ -3344,25 +3250,7 @@ * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ - function keysIn(object) { - var index = -1, - isProto = isPrototype(object), - props = baseKeysIn(object), - propsLength = props.length, - indexes = indexKeys(object), - skipIndexes = !!indexes, - result = indexes || [], - length = result.length; - - while (++index < propsLength) { - var key = props[index]; - if (!(skipIndexes && (key == 'length' || isIndex(key, length))) && - !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; - } + var keysIn = baseKeysIn; /** * Creates an object composed of the picked `object` properties. @@ -3510,7 +3398,7 @@ * * var object = { 'user': 'fred' }; * - * _.identity(object) === object; + * console.log(_.identity(object) === object); * // => true */ function identity(value) { @@ -3682,8 +3570,7 @@ } /** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. + * A method that returns `undefined`. * * @static * @memberOf _ @@ -3691,10 +3578,8 @@ * @category Util * @example * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true + * _.times(2, _.noop); + * // => [undefined, undefined] */ function noop() { // No operation performed. @@ -3900,7 +3785,7 @@ // 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. - (freeWindow || freeSelf || {})._ = lodash; + (freeSelf || {})._ = lodash; // Some AMD build optimizers like r.js check for condition patterns like the following: if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { @@ -3911,11 +3796,9 @@ }); } // Check for `exports` after `define` in case a build optimizer adds an `exports` object. - else if (freeExports && freeModule) { + else if (freeModule) { // Export for Node.js. - if (moduleExports) { - (freeModule.exports = lodash)._ = lodash; - } + (freeModule.exports = lodash)._ = lodash; // Export for CommonJS support. freeExports._ = lodash; } diff --git a/dist/lodash.core.min.js b/dist/lodash.core.min.js index d33dffd07e..f8e40b6d3a 100644 --- a/dist/lodash.core.min.js +++ b/dist/lodash.core.min.js @@ -1,28 +1,28 @@ /** * @license - * lodash lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE + * lodash (Custom Build) /license | Underscore.js 1.8.3 underscorejs.org/LICENSE + * Build: `lodash core -o ./dist/lodash.core.js` */ -;(function(){function n(n,t){return n.push.apply(n,t),n}function t(n,t,r){var e;return r(n,function(n,r,u){return t(n,r,u)?(e=n,false):void 0}),e}function r(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function e(n,t){return O(t,function(t){return n[t]})}function u(n){return n&&n.Object===Object?n:null}function o(n){return gn[n]}function i(n){var t=false;if(null!=n&&typeof n.toString!="function")try{t=!!(n+"")}catch(r){}return t}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===pn)||(u=En[r],u=(n===u||n!==n&&u!==u)&&!kn.call(e,r)),u?t:n}function l(n){return nn(n)?Bn(n):{}}function p(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(pn,r)},t)}function s(n,t){var r=true;return zn(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)?r>1?y(f,r-1,e,u,o):n(o,f):u||(o[o.length]=f)}return o}function g(n,t){return n&&Cn(n,t,on)}function b(n,t){return v(t,function(t){return Y(n[t])})}function _(n,t){return n>t}function d(n,t,r,e,u){return n===t?true:null==n||null==t||!nn(n)&&!tn(t)?n!==n&&t!==t:j(n,t,d,r,e,u)}function j(n,t,r,e,u,o){var c=Vn(n),f=Vn(t),a="[object Array]",l="[object Array]"; -c||(a=Sn.call(n),a="[object Arguments]"==a?"[object Object]":a),f||(l=Sn.call(t),l="[object Arguments]"==l?"[object Object]":l);var p="[object Object]"==a&&!i(n),f="[object Object]"==l&&!i(t),l=a==l;o||(o=[]);var s=V(o,function(t){return t[0]===n});return s&&s[1]?s[1]==t:(o.push([n,t]),l&&!p?(r=c||isTypedArray(n)?$(n,t,r,e,u,o):q(n,t,a),o.pop(),r):2&u||(c=p&&kn.call(n,"__wrapped__"),a=f&&kn.call(t,"__wrapped__"),!c&&!a)?l?(r=z(n,t,r,e,u,o),o.pop(),r):false:(c=c?n.value():n,t=a?t.value():t,r=r(c,t,e,u,o), -o.pop(),r))}function m(n){return typeof n=="function"?n:null==n?an:(typeof n=="object"?A:k)(n)}function w(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function x(n,t){return t>n}function O(n,t){var r=-1,e=X(n)?Array(n.length):[];return zn(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function A(n){var t=on(n);return function(r){var e=t.length;if(null==r)return!e;for(r=Object(r);e--;){var u=t[e];if(!(u in r&&d(n[u],r[u],pn,3)))return false}return true}}function E(n,t){return n=Object(n),K(t,function(t,r){ -return r in n&&(t[r]=n[r]),t},{})}function k(n){return function(t){return null==t?pn:t[n]}}function N(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]:pn,o=n.length>3&&typeof o=="function"?(u--,o):pn;for(t=Object(t);++ei))return false;for(var c=-1,f=true,a=1&u?[]:pn;++c-1&&0==n%1&&t>n}function M(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||En); -}function P(n){return n&&n.length?n[0]:pn}function U(n,t,r){var e=n?n.length:0;r=typeof r=="number"?0>r?qn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rarguments.length,zn)}function L(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Hn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=pn),r}} -function Q(n){var t;if(typeof n!="function")throw new TypeError("Expected a function");return t=qn(t===pn?n.length-1:Hn(t),0),function(){for(var r=arguments,e=-1,u=qn(r.length-t,0),o=Array(u);++e-1&&0==n%1&&9007199254740991>=n}function nn(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function tn(n){return!!n&&typeof n=="object"}function rn(n){return typeof n=="number"||tn(n)&&"[object Number]"==Sn.call(n)}function en(n){return typeof n=="string"||!Vn(n)&&tn(n)&&"[object String]"==Sn.call(n)}function un(n){return typeof n=="string"?n:null==n?"":n+""}function on(n){var t=M(n);if(!t&&!X(n))return $n(Object(n));var r,e=C(n),u=!!e,e=e||[],o=e.length; -for(r in n)!kn.call(n,r)||u&&("length"==r||J(r,o))||t&&"constructor"==r||e.push(r);return e}function cn(n){for(var t=-1,r=M(n),e=w(n),u=e.length,o=C(n),i=!!o,o=o||[],c=o.length;++t"'`]/g,vn=RegExp(hn.source),yn=/^(?:0|[1-9]\d*)$/,gn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},bn={"function":true,object:true},_n=bn[typeof exports]&&exports&&!exports.nodeType?exports:pn,dn=bn[typeof module]&&module&&!module.nodeType?module:pn,jn=dn&&dn.exports===_n?_n:pn,mn=u(bn[typeof self]&&self),wn=u(bn[typeof window]&&window),xn=u(bn[typeof this]&&this),On=u(_n&&dn&&typeof global=="object"&&global)||wn!==(xn&&xn.window)&&wn||mn||xn||Function("return this")(),An=Array.prototype,En=Object.prototype,kn=En.hasOwnProperty,Nn=0,Sn=En.toString,Tn=On._,Fn=On.Reflect,Rn=Fn?Fn.a:pn,Bn=Object.create,Dn=En.propertyIsEnumerable,In=On.isFinite,$n=Object.keys,qn=Math.max; -f.prototype=l(c.prototype),f.prototype.constructor=f;var zn=function(n,t){return function(r,e){if(null==r)return r;if(!X(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++oe||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}),k("value"))},c.tap=function(n,t){return t(n),n},c.thru=function(n,t){return t(n)},c.toArray=function(n){return X(n)?n.length?S(n):[]:fn(n)},c.values=fn,c.extend=Qn,ln(c,c),c.clone=function(n){return nn(n)?Vn(n)?S(n):R(n,on(n)):n},c.escape=function(n){return(n=un(n))&&vn.test(n)?n.replace(hn,o):n},c.every=function(n,t,r){return t=r?pn:t,s(n,m(t))},c.find=V,c.forEach=H,c.has=function(n,t){return null!=n&&kn.call(n,t); -},c.head=P,c.identity=an,c.indexOf=U,c.isArguments=W,c.isArray=Vn,c.isBoolean=function(n){return true===n||false===n||tn(n)&&"[object Boolean]"==Sn.call(n)},c.isDate=function(n){return tn(n)&&"[object Date]"==Sn.call(n)},c.isEmpty=function(n){return X(n)&&(Vn(n)||en(n)||Y(n.splice)||W(n))?!n.length:!on(n).length},c.isEqual=function(n,t){return d(n,t)},c.isFinite=function(n){return typeof n=="number"&&In(n)},c.isFunction=Y,c.isNaN=function(n){return rn(n)&&n!=+n},c.isNull=function(n){return null===n},c.isNumber=rn, -c.isObject=nn,c.isRegExp=function(n){return nn(n)&&"[object RegExp]"==Sn.call(n)},c.isString=en,c.isUndefined=function(n){return n===pn},c.last=function(n){var t=n?n.length:0;return t?n[t-1]:pn},c.max=function(n){return n&&n.length?h(n,an,_):pn},c.min=function(n){return n&&n.length?h(n,an,x):pn},c.noConflict=function(){return On._===this&&(On._=Tn),this},c.noop=function(){},c.reduce=K,c.result=function(n,t,r){return t=null==n?pn:n[t],t===pn&&(t=r),Y(t)?t.call(n):t},c.size=function(n){return null==n?0:(n=X(n)?n:on(n), -n.length)},c.some=function(n,t,r){return t=r?pn:t,T(n,m(t))},c.uniqueId=function(n){var t=++Nn;return un(n)+t},c.each=H,c.first=P,ln(c,function(){var n={};return g(c,function(t,r){kn.call(c.prototype,r)||(n[r]=t)}),n}(),{chain:false}),c.VERSION="4.12.0",zn("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?String.prototype:An)[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(Vn(u)?u:[],n)}return this[r](function(r){return t.apply(Vn(r)?r:[],n)})}}),c.prototype.toJSON=c.prototype.valueOf=c.prototype.value=function(){return F(this.__wrapped__,this.__actions__)},(wn||mn||{})._=c,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){return c}):_n&&dn?(jn&&((dn.exports=c)._=c),_n._=c):On._=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){return On(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 fn[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===en)||(u=vn[r],u=(n===u||n!==n&&u!==u)&&!yn.call(e,r)),u?t:n}function l(n){return Q(n)?jn(n):{}}function p(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(en,r)},t)}function s(n,t){var r=true;return En(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&&An(n,r,t)}function g(n,t){return v(t,function(t){return L(n[t])})}function _(n,t){return n>t}function j(n,t,r,e,u){return n===t?true:null==n||null==t||!Q(n)&&!W(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=gn.call(n),f="[object Arguments]"==f?"[object Object]":f), +c||(a=gn.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=J(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&&yn.call(n,"__wrapped__"),f=c&&yn.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?tn:(typeof n=="object"?E:w)(n); +}function O(n,t){return t>n}function x(n,t){var r=-1,e=K(n)?Array(n.length):[];return En(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],en,3)))return false}return true}}function A(n,t){return n=Object(n),P(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function w(n){return function(t){return null==t?en: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]:en,o=n.length>3&&typeof o=="function"?(u--, +o):en;for(t=Object(t);++ei))return false;for(var c=-1,f=true,a=1&u?[]:en;++cr?xn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++rr&&(r=xn(u+r,0)),t=m(t),u=e.length,r+=-1;++r-1?n[e]:en}function M(n,t){return En(n,m(t))}function P(n,t,r){return e(n,m(t),r,3>arguments.length,En)}function U(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=en),r}}function V(n){var t;if(typeof n!="function")throw new TypeError("Expected a function");return t=xn(t===en?n.length-1:Bn(t),0),function(){for(var r=arguments,e=-1,u=xn(r.length-t,0),o=Array(u);++e-1&&0==t%1&&9007199254740991>=t),t&&!L(n)}function L(n){return n=Q(n)?gn.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n}function Q(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function W(n){return!!n&&typeof n=="object"}function X(n){return typeof n=="number"||W(n)&&"[object Number]"==gn.call(n)}function Y(n){return typeof n=="string"||!Tn(n)&&W(n)&&"[object String]"==gn.call(n)}function Z(n){return typeof n=="string"?n:null==n?"":n+""}function nn(n){ +return n?u(n,t(n)):[]}function tn(n){return n}function rn(n,e,u){var o=t(e),i=g(e,o);null!=u||Q(e)&&(i.length||!o.length)||(u=e,e=n,n=this,i=g(e,t(e)));var c=!(Q(u)&&"chain"in u&&!u.chain),f=L(n);return En(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 en,un=1/0,on=/[&<>"'`]/g,cn=RegExp(on.source),fn={ +"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},an=typeof exports=="object"&&exports,ln=an&&typeof module=="object"&&module,pn=o(typeof self=="object"&&self),sn=o(typeof global=="object"&&global)||pn||o(typeof this=="object"&&this)||Function("return this")(),hn=Array.prototype,vn=Object.prototype,yn=vn.hasOwnProperty,bn=0,gn=vn.toString,_n=sn._,jn=Object.create,dn=vn.propertyIsEnumerable,mn=sn.isFinite,On=Object.keys,xn=Math.max;f.prototype=l(c.prototype),f.prototype.constructor=f; +var En=function(n,t){return function(r,e){if(null==r)return r;if(!K(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++oe||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 K(n)?n.length?N(n):[]:nn(n)},c.values=nn,c.extend=In,rn(c,c),c.clone=function(n){return Q(n)?Tn(n)?N(n):T(n,t(n)):n},c.escape=function(n){return(n=Z(n))&&cn.test(n)?n.replace(on,i):n},c.every=function(n,t,r){return t=r?en:t,s(n,m(t))},c.find=J,c.forEach=M,c.has=function(n,t){return null!=n&&yn.call(n,t)},c.head=C,c.identity=tn,c.indexOf=G,c.isArguments=H,c.isArray=Tn,c.isBoolean=function(n){return true===n||false===n||W(n)&&"[object Boolean]"==gn.call(n); +},c.isDate=function(n){return W(n)&&"[object Date]"==gn.call(n)},c.isEmpty=function(n){return K(n)&&(Tn(n)||Y(n)||L(n.splice)||H(n))?!n.length:!t(n).length},c.isEqual=function(n,t){return j(n,t)},c.isFinite=function(n){return typeof n=="number"&&mn(n)},c.isFunction=L,c.isNaN=function(n){return X(n)&&n!=+n},c.isNull=function(n){return null===n},c.isNumber=X,c.isObject=Q,c.isRegExp=function(n){return Q(n)&&"[object RegExp]"==gn.call(n)},c.isString=Y,c.isUndefined=function(n){return n===en},c.last=function(n){ +var t=n?n.length:0;return t?n[t-1]:en},c.max=function(n){return n&&n.length?h(n,tn,_):en},c.min=function(n){return n&&n.length?h(n,tn,O):en},c.noConflict=function(){return sn._===this&&(sn._=_n),this},c.noop=function(){},c.reduce=P,c.result=function(n,t,r){return t=null==n?en:n[t],t===en&&(t=r),L(t)?t.call(n):t},c.size=function(n){return null==n?0:(n=K(n)?n:t(n),n.length)},c.some=function(n,t,r){return t=r?en:t,S(n,m(t))},c.uniqueId=function(n){var t=++bn;return Z(n)+t},c.each=M,c.first=C,rn(c,function(){ +var n={};return b(c,function(t,r){yn.call(c.prototype,r)||(n[r]=t)}),n}(),{chain:false}),c.VERSION="4.13.0",En("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?String.prototype:hn)[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__)},(pn||{})._=c,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){return c}):ln?((ln.exports=c)._=c,an._=c):sn._=c}).call(this); \ No newline at end of file diff --git a/dist/lodash.fp.js b/dist/lodash.fp.js index 99e48c8d51..1dcc9005ac 100644 --- a/dist/lodash.fp.js +++ b/dist/lodash.fp.js @@ -636,12 +636,13 @@ return /******/ (function(modules) { // webpackBootstrap ], '3': [ 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith', - 'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'invokeArgs', - 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth', 'mergeWith', - 'orderBy', 'padChars', 'padCharsEnd', 'padCharsStart', 'pullAllBy', - 'pullAllWith', 'reduce', 'reduceRight', 'replace', 'set', 'slice', - 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', - 'update', 'xorBy', 'xorWith', 'zipWith' + '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' @@ -662,10 +663,14 @@ return /******/ (function(modules) { // webpackBootstrap '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, @@ -700,7 +705,11 @@ return /******/ (function(modules) { // webpackBootstrap exports.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], @@ -712,7 +721,11 @@ return /******/ (function(modules) { // webpackBootstrap '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] }; @@ -787,9 +800,16 @@ return /******/ (function(modules) { // webpackBootstrap exports.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', @@ -836,7 +856,6 @@ return /******/ (function(modules) { // webpackBootstrap 'range': true, 'rangeRight': true, 'subtract': true, - 'without': true, 'zip': true, 'zipObject': true }; diff --git a/dist/lodash.fp.min.js b/dist/lodash.fp.min.js index 979fae372e..59affc3188 100644 --- a/dist/lodash.fp.min.js +++ b/dist/lodash.fp.min.js @@ -1,16 +1,17 @@ !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,d){function f(t,e){e=F(e);for(var r=-1,n=e.length,i=n-1,a=M(Object(t)),o=a;null!=o&&++r1&&(E||!p.skipRearg[t])&&(r=L(r,p.methodRearg[t]||p.aryRearg[e])),I.cap&&(o?r=m(r,o):a&&(r=g(r,a))),(b||I.curry&&e>1)&&(b&&console.log(b,t),r=q(r,e)),!1}}),!r}),r||(r=n),r==e&&(r=b?q(r,1):function(){return e.apply(this,arguments)}),r.convert=y(t,e),p.placeholder[t]&&(W=!0,r.placeholder=e.placeholder=O),r}var W,R="function"==typeof e,A=e===Object(e);if(A&&(d=r,r=e,e=void 0),null==r)throw new TypeError;d||(d={});var I={cap:"cap"in d?d.cap:!0,curry:"curry"in d?d.curry:!0,fixed:"fixed"in d?d.fixed:!0, -immutable:"immutable"in d?d.immutable:!0,rearg:"rearg"in d?d.rearg:!0},b="curry"in d&&d.curry,k="fixed"in d&&d.fixed,E="rearg"in d&&d.rearg,O=R?r:c,B=R?r.runInContext():void 0,j=R?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},C=j.ary,w=j.assign,M=j.clone,q=j.curry,P=j.forEach,S=j.isArray,z=j.isFunction,K=j.keys,L=j.rearg,D=j.spread,F=j.toPath,T=K(p.aryMethod),_={ -castArray:function(t){return function(){var e=arguments[0];return S(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 I.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(!z(r))return t(r,Object(e));var n=[];return P(K(e),function(t){z(e[t])&&n.push([t,r.prototype[t]])}),t(r,Object(e)),P(n,function(t){var e=t[1];z(e)?r.prototype[t[0]]=e:delete r.prototype[t[0]]; -}),r}},runInContext:function(e){return function(r){return u(t,e(r),d)}}};if(!A)return x(e,r);var N=r,V=[];return P(T,function(t){P(p.aryMethod[t],function(t){var e=N[p.remap[t]||t];e&&V.push([t,x(t,e)])})}),P(K(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])}}),P(V,function(t){N[t[0]]=t[1]}),N.convert=h,W&&(N.placeholder=O),P(K(N),function(t){P(p.realToAlias[t]||[],function(e){N[e]=N[t]})}),N}var p=r(2),l=p.mutate,c=r(3); +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"], -3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","getOr","inRange","intersectionBy","intersectionWith","invokeArgs","invokeArgsMap","isEqualWith","isMatchWith","flatMapDepth","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,findIndex:1,findKey:1,findLast:1,findLastIndex: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],getOr:[2,1,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],updateWith:[3,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",getOr:"get",invokeArgs:"invoke",invokeArgsMap:"invokeMap",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,without:!0,zip:!0,zipObject:!0}},function(t,e){t.exports={}}])}); \ No newline at end of file +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 diff --git a/dist/lodash.js b/dist/lodash.js index 4bcb6ca88c..3fef2c8e86 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -12,7 +12,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.12.0'; + var VERSION = '4.13.0'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -116,7 +116,7 @@ /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g; /** * Used to match `RegExp` @@ -249,7 +249,7 @@ 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', - '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' + '_', 'isFinite', 'parseInt', 'setTimeout' ]; /** Used to make template sourceURLs easier to identify. */ @@ -328,12 +328,6 @@ '`': '`' }; - /** Used to determine if values are of the language type `Object`. */ - var objectTypes = { - 'function': true, - 'object': true - }; - /** Used to escape characters for inclusion in compiled string literals. */ var stringEscapes = { '\\': '\\', @@ -349,41 +343,25 @@ freeParseInt = parseInt; /** Detect free variable `exports`. */ - var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) - ? exports - : undefined; + var freeExports = typeof exports == 'object' && exports; /** Detect free variable `module`. */ - var freeModule = (objectTypes[typeof module] && module && !module.nodeType) - ? module - : undefined; + var freeModule = freeExports && typeof module == 'object' && module; /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = (freeModule && freeModule.exports === freeExports) - ? freeExports - : undefined; + var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `global` from Node.js. */ - var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); + var freeGlobal = checkGlobal(typeof global == 'object' && global); /** Detect free variable `self`. */ - var freeSelf = checkGlobal(objectTypes[typeof self] && self); - - /** Detect free variable `window`. */ - var freeWindow = checkGlobal(objectTypes[typeof window] && window); + var freeSelf = checkGlobal(typeof self == 'object' && self); /** Detect `this` as the global object. */ - var thisGlobal = checkGlobal(objectTypes[typeof this] && this); + var thisGlobal = checkGlobal(typeof this == 'object' && this); - /** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ - var root = freeGlobal || - ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || - freeSelf || thisGlobal || Function('return this')(); + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || thisGlobal || Function('return this')(); /*--------------------------------------------------------------------------*/ @@ -439,7 +417,7 @@ * A specialized version of `baseAggregator` for arrays. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. @@ -447,7 +425,7 @@ */ function arrayAggregator(array, setter, iteratee, accumulator) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { var value = array[index]; @@ -461,13 +439,13 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { if (iteratee(array[index], index, array) === false) { @@ -482,12 +460,12 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEachRight(array, iteratee) { - var length = array.length; + var length = array ? array.length : 0; while (length--) { if (iteratee(array[length], length, array) === false) { @@ -502,14 +480,14 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. */ function arrayEvery(array, predicate) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { if (!predicate(array[index], index, array)) { @@ -524,13 +502,13 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, - length = array.length, + length = array ? array.length : 0, resIndex = 0, result = []; @@ -548,26 +526,27 @@ * specifying an index to search from. * * @private - * @param {Array} array The array to search. + * @param {Array} [array] The array to search. * @param {*} target The value to search for. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludes(array, value) { - return !!array.length && baseIndexOf(array, value, 0) > -1; + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; } /** * This function is like `arrayIncludes` except that it accepts a comparator. * * @private - * @param {Array} array The array to search. + * @param {Array} [array] The array to search. * @param {*} target The value to search for. * @param {Function} comparator The comparator invoked per element. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludesWith(array, value, comparator) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { if (comparator(value, array[index])) { @@ -582,13 +561,13 @@ * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, - length = array.length, + length = array ? array.length : 0, result = Array(length); while (++index < length) { @@ -621,7 +600,7 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as @@ -630,7 +609,7 @@ */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, - length = array.length; + length = array ? array.length : 0; if (initAccum && length) { accumulator = array[++index]; @@ -646,7 +625,7 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the last element of `array` as @@ -654,7 +633,7 @@ * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initAccum) { - var length = array.length; + var length = array ? array.length : 0; if (initAccum && length) { accumulator = array[--length]; } @@ -669,14 +648,14 @@ * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { if (predicate(array[index], index, array)) { @@ -687,23 +666,21 @@ } /** - * The base implementation of methods like `_.find` and `_.findKey`, without - * support for iteratee shorthands, which iterates over `collection` using - * `eachFunc`. + * The base implementation of methods like `_.findKey` and `_.findLastKey`, + * without support for iteratee shorthands, which iterates over `collection` + * using `eachFunc`. * * @private * @param {Array|Object} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. - * @param {boolean} [retKey] Specify returning the key of the found element - * instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ - function baseFind(collection, predicate, eachFunc, retKey) { + function baseFindKey(collection, predicate, eachFunc) { var result; eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { - result = retKey ? key : value; + result = key; return false; } }); @@ -717,12 +694,13 @@ * @private * @param {Array} array The array to search. * @param {Function} predicate The function invoked per iteration. + * @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 value, else `-1`. */ - function baseFindIndex(array, predicate, fromRight) { + function baseFindIndex(array, predicate, fromIndex, fromRight) { var length = array.length, - index = fromRight ? length : -1; + index = fromIndex + (fromRight ? 1 : -1); while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { @@ -1029,6 +1007,18 @@ return '\\' + stringEscapes[chr]; } + /** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function getValue(object, key) { + return object == null ? undefined : object[key]; + } + /** * Gets the index at which the first occurrence of `NaN` is found in `array`. * @@ -1040,7 +1030,7 @@ */ function indexOfNaN(array, fromIndex, fromRight) { var length = array.length, - index = fromIndex + (fromRight ? 0 : -1); + index = fromIndex + (fromRight ? 1 : -1); while ((fromRight ? index-- : ++index < length)) { var other = array[index]; @@ -1231,10 +1221,10 @@ * lodash.isFunction(lodash.bar); * // => true * - * // Use `context` to mock `Date#getTime` use in `_.now`. - * var mock = _.runInContext({ + * // Use `context` to stub `Date#getTime` use in `_.now`. + * var stubbed = _.runInContext({ * 'Date': function() { - * return { 'getTime': getTimeMock }; + * return { 'getTime': stubGetTime }; * } * }); * @@ -1256,6 +1246,15 @@ objectProto = context.Object.prototype, stringProto = context.String.prototype; + /** Used to detect overreaching core-js shims. */ + var coreJsData = context['__core-js_shared__']; + + /** Used to detect methods masquerading as native. */ + var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; + }()); + /** Used to resolve the decompiled source of functions. */ var funcToString = context.Function.prototype.toString; @@ -1289,15 +1288,16 @@ Reflect = context.Reflect, Symbol = context.Symbol, Uint8Array = context.Uint8Array, - clearTimeout = context.clearTimeout, enumerate = Reflect ? Reflect.enumerate : undefined, getOwnPropertySymbols = Object.getOwnPropertySymbols, iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined, objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, - setTimeout = context.setTimeout, splice = arrayProto.splice; + /** Built-in method references that are mockable. */ + var 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, @@ -1419,19 +1419,21 @@ * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, * `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, * `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, - * `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, - * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, - * `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`, - * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, - * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`, - * `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`, - * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`, - * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, - * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, - * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toFinite`, - * `toInteger`, `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, - * `toString`, `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, - * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words` + * `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` * * @name _ * @constructor @@ -2732,7 +2734,7 @@ * The base implementation of `_.has` without support for deep paths. * * @private - * @param {Object} object The object to query. + * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ @@ -2740,20 +2742,21 @@ // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, // that are composed entirely of index properties, return `false` for // `hasOwnProperty` checks of them. - return hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null); + return object != null && + (hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototype(object) === null)); } /** * The base implementation of `_.hasIn` without support for deep paths. * * @private - * @param {Object} object The object to query. + * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { - return key in Object(object); + return object != null && key in Object(object); } /** @@ -3007,6 +3010,22 @@ return true; } + /** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); + } + /** * The base implementation of `_.iteratee`. * @@ -3375,6 +3394,9 @@ length = values.length, seen = array; + if (array === values) { + values = copyArray(values); + } if (iteratee) { seen = arrayMap(array, baseUnary(iteratee)); } @@ -4890,7 +4912,7 @@ var func = Math[methodName]; return function(number, precision) { number = toNumber(number); - precision = toInteger(precision); + precision = nativeMin(toInteger(precision), 292); if (precision) { // Shift with exponential notation to avoid floating-point issues. // See [MDN](https://mdn.io/round#Examples) for more details. @@ -5371,11 +5393,14 @@ * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { - var result = toPairs(object), + var result = keys(object), length = result.length; while (length--) { - result[length][2] = isStrictComparable(result[length][1]); + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; } return result; } @@ -5389,8 +5414,8 @@ * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = object[key]; - return isNative(value) ? value : undefined; + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; } /** @@ -5419,9 +5444,7 @@ // Fallback for IE < 11. if (!getOwnPropertySymbols) { - getSymbols = function() { - return []; - }; + getSymbols = stubArray; } /** @@ -5753,6 +5776,26 @@ return !!data && func === data[0]; } + /** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ + function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); + } + + /** + * Checks if `func` is capable of being masked. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `func` is maskable, else `false`. + */ + var isMaskable = !coreJsData ? stubFalse : isFunction; + /** * Checks if `value` is likely a prototype object. * @@ -6149,8 +6192,8 @@ * @see _.without, _.xor * @example * - * _.difference([3, 2, 1], [4, 2]); - * // => [3, 1] + * _.difference([2, 1], [2, 3]); + * // => [1] */ var difference = rest(function(array, values) { return isArrayLikeObject(array) @@ -6175,8 +6218,8 @@ * @returns {Array} Returns the new array of filtered values. * @example * - * _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor); - * // => [3.1, 1.3] + * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2] * * // The `_.property` iteratee shorthand. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); @@ -6428,6 +6471,7 @@ * @param {Array} array The array to search. * @param {Array|Function|Object|string} [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`. * @example * @@ -6452,10 +6496,16 @@ * _.findIndex(users, 'active'); * // => 2 */ - function findIndex(array, predicate) { - return (array && array.length) - ? baseFindIndex(array, getIteratee(predicate, 3)) - : -1; + function findIndex(array, predicate, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, getIteratee(predicate, 3), index); } /** @@ -6469,6 +6519,7 @@ * @param {Array} array The array to search. * @param {Array|Function|Object|string} [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`. * @example * @@ -6493,10 +6544,19 @@ * _.findLastIndex(users, 'active'); * // => 0 */ - function findLastIndex(array, predicate) { - return (array && array.length) - ? baseFindIndex(array, getIteratee(predicate, 3), true) - : -1; + function findLastIndex(array, predicate, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = length - 1; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = fromIndex < 0 + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); + } + return baseFindIndex(array, getIteratee(predicate, 3), index, true); } /** @@ -6643,11 +6703,11 @@ if (!length) { return -1; } - fromIndex = toInteger(fromIndex); - if (fromIndex < 0) { - fromIndex = nativeMax(length + fromIndex, 0); + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); } - return baseIndexOf(array, value, fromIndex); + return baseIndexOf(array, value, index); } /** @@ -6682,7 +6742,7 @@ * @returns {Array} Returns the new array of intersecting values. * @example * - * _.intersection([2, 1], [4, 2], [1, 2]); + * _.intersection([2, 1], [2, 3]); * // => [2] */ var intersection = rest(function(arrays) { @@ -6708,7 +6768,7 @@ * @returns {Array} Returns the new array of intersecting values. * @example * - * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); * // => [2.1] * * // The `_.property` iteratee shorthand. @@ -6838,7 +6898,7 @@ ) + 1; } if (value !== value) { - return indexOfNaN(array, index, true); + return indexOfNaN(array, index - 1, true); } while (index--) { if (array[index] === value) { @@ -6849,7 +6909,7 @@ } /** - * Gets the element at `n` index of `array`. If `n` is negative, the nth + * Gets the element at index `n` of `array`. If `n` is negative, the nth * element from the end is returned. * * @static @@ -6890,11 +6950,11 @@ * @returns {Array} Returns `array`. * @example * - * var array = [1, 2, 3, 1, 2, 3]; + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; * - * _.pull(array, 2, 3); + * _.pull(array, 'a', 'c'); * console.log(array); - * // => [1, 1] + * // => ['b', 'b'] */ var pull = rest(pullAll); @@ -6912,11 +6972,11 @@ * @returns {Array} Returns `array`. * @example * - * var array = [1, 2, 3, 1, 2, 3]; + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; * - * _.pullAll(array, [2, 3]); + * _.pullAll(array, ['a', 'c']); * console.log(array); - * // => [1, 1] + * // => ['b', 'b'] */ function pullAll(array, values) { return (array && array.length && values && values.length) @@ -6998,14 +7058,14 @@ * @returns {Array} Returns the new array of removed elements. * @example * - * var array = [5, 10, 15, 20]; - * var evens = _.pullAt(array, 1, 3); + * var array = ['a', 'b', 'c', 'd']; + * var pulled = _.pullAt(array, [1, 3]); * * console.log(array); - * // => [5, 15] + * // => ['a', 'c'] * - * console.log(evens); - * // => [10, 20] + * console.log(pulled); + * // => ['b', 'd'] */ var pullAt = rest(function(array, indexes) { indexes = baseFlatten(indexes, 1); @@ -7145,9 +7205,6 @@ * * _.sortedIndex([30, 50], 40); * // => 1 - * - * _.sortedIndex([4, 5], 4); - * // => 0 */ function sortedIndex(array, value) { return baseSortedIndex(array, value); @@ -7170,13 +7227,13 @@ * into `array`. * @example * - * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * var objects = [{ 'x': 4 }, { 'x': 5 }]; * - * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); - * // => 1 + * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 0 * * // The `_.property` iteratee shorthand. - * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); * // => 0 */ function sortedIndexBy(array, value, iteratee) { @@ -7196,8 +7253,8 @@ * @returns {number} Returns the index of the matched value, else `-1`. * @example * - * _.sortedIndexOf([1, 1, 2, 2], 2); - * // => 2 + * _.sortedIndexOf([4, 5, 5, 5, 6], 5); + * // => 1 */ function sortedIndexOf(array, value) { var length = array ? array.length : 0; @@ -7225,8 +7282,8 @@ * into `array`. * @example * - * _.sortedLastIndex([4, 5], 4); - * // => 1 + * _.sortedLastIndex([4, 5, 5, 5, 6], 5); + * // => 4 */ function sortedLastIndex(array, value) { return baseSortedIndex(array, value, true); @@ -7249,8 +7306,13 @@ * into `array`. * @example * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 1 + * * // The `_.property` iteratee shorthand. - * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); * // => 1 */ function sortedLastIndexBy(array, value, iteratee) { @@ -7270,7 +7332,7 @@ * @returns {number} Returns the index of the matched value, else `-1`. * @example * - * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); * // => 3 */ function sortedLastIndexOf(array, value) { @@ -7510,8 +7572,8 @@ * @returns {Array} Returns the new array of combined values. * @example * - * _.union([2, 1], [4, 2], [1, 2]); - * // => [2, 1, 4] + * _.union([2], [1, 2]); + * // => [2, 1] */ var union = rest(function(arrays) { return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); @@ -7533,8 +7595,8 @@ * @returns {Array} Returns the new array of combined values. * @example * - * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); - * // => [2.1, 1.2, 4.3] + * _.unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] * * // The `_.property` iteratee shorthand. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); @@ -7641,7 +7703,7 @@ * @returns {Array} Returns the new duplicate free array. * @example * - * 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 }]; * * _.uniqWith(objects, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] @@ -7736,7 +7798,7 @@ * @see _.difference, _.xor * @example * - * _.without([1, 2, 1, 3], 1, 2); + * _.without([2, 1, 2, 3], 1, 2); * // => [3] */ var without = rest(function(array, values) { @@ -7760,8 +7822,8 @@ * @see _.difference, _.without * @example * - * _.xor([2, 1], [4, 2]); - * // => [1, 4] + * _.xor([2, 1], [2, 3]); + * // => [1, 3] */ var xor = rest(function(arrays) { return baseXor(arrayFilter(arrays, isArrayLikeObject)); @@ -7783,8 +7845,8 @@ * @returns {Array} Returns the new array of filtered values. * @example * - * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); - * // => [1.2, 4.3] + * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2, 3.4] * * // The `_.property` iteratee shorthand. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); @@ -8017,9 +8079,6 @@ * * _(object).at(['a[0].b.c', 'a[1]']).value(); * // => [3, 4] - * - * _(['a', 'b', 'c']).at(0, 2).value(); - * // => ['a', 'c'] */ var wrapperAt = rest(function(paths) { paths = baseFlatten(paths, 1); @@ -8282,6 +8341,7 @@ * _.countBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': 1, '6': 2 } * + * // The `_.property` iteratee shorthand. * _.countBy(['one', 'two', 'three'], 'length'); * // => { '3': 2, '5': 1 } */ @@ -8387,6 +8447,7 @@ * @param {Array|Object} collection The collection to search. * @param {Array|Function|Object|string} [predicate=_.identity] * The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. * @returns {*} Returns the matched element, else `undefined`. * @example * @@ -8411,13 +8472,10 @@ * _.find(users, 'active'); * // => object for 'barney' */ - function find(collection, predicate) { - predicate = getIteratee(predicate, 3); - if (isArray(collection)) { - var index = baseFindIndex(collection, predicate); - return index > -1 ? collection[index] : undefined; - } - return baseFind(collection, predicate, baseEach); + function find(collection, predicate, fromIndex) { + collection = isArrayLike(collection) ? collection : values(collection); + var index = findIndex(collection, predicate, fromIndex); + return index > -1 ? collection[index] : undefined; } /** @@ -8431,6 +8489,7 @@ * @param {Array|Object} collection The collection to search. * @param {Array|Function|Object|string} [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`. * @example * @@ -8439,13 +8498,10 @@ * }); * // => 3 */ - function findLast(collection, predicate) { - predicate = getIteratee(predicate, 3); - if (isArray(collection)) { - var index = baseFindIndex(collection, predicate, true); - return index > -1 ? collection[index] : undefined; - } - return baseFind(collection, predicate, baseEachRight); + function findLast(collection, predicate, fromIndex) { + collection = isArrayLike(collection) ? collection : values(collection); + var index = findLastIndex(collection, predicate, fromIndex); + return index > -1 ? collection[index] : undefined; } /** @@ -9203,7 +9259,6 @@ * @static * @memberOf _ * @since 2.4.0 - * @type {Function} * @category Date * @returns {number} Returns the timestamp. * @example @@ -9211,9 +9266,11 @@ * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred function to be invoked. + * // => Logs the number of milliseconds it took for the deferred invocation. */ - var now = Date.now; + function now() { + return Date.now(); + } /*------------------------------------------------------------------------*/ @@ -9317,7 +9374,7 @@ * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * - * **Note:** Unlike native `Function#bind` this method doesn't set the "length" + * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" * property of bound functions. * * @static @@ -9557,7 +9614,7 @@ maxWait, result, timerId, - lastCallTime = 0, + lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, @@ -9608,7 +9665,7 @@ // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. - return (!lastCallTime || (timeSinceLastCall >= wait) || + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } @@ -9622,7 +9679,6 @@ } function trailingEdge(time) { - clearTimeout(timerId); timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been @@ -9635,11 +9691,8 @@ } function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); - } - lastCallTime = lastInvokeTime = 0; - lastArgs = lastThis = timerId = undefined; + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { @@ -9660,7 +9713,6 @@ } if (maxing) { // Handle invocations in a tight loop. - clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } @@ -9884,7 +9936,7 @@ * * var func = _.overArgs(function(x, y) { * return [x, y]; - * }, square, doubled); + * }, [square, doubled]); * * func(9, 3); * // => [81, 6] @@ -10001,7 +10053,7 @@ * * var rearged = _.rearg(function(a, b, c) { * return [a, b, c]; - * }, 2, 0, 1); + * }, [2, 0, 1]); * * rearged('b', 'c', 'a') * // => ['a', 'b', 'c'] @@ -10640,7 +10692,7 @@ * _.isBuffer(new Uint8Array(2)); * // => false */ - var isBuffer = !Buffer ? constant(false) : function(value) { + var isBuffer = !Buffer ? stubFalse : function(value) { return value instanceof Buffer; }; @@ -11140,7 +11192,15 @@ } /** - * Checks if `value` is a native function. + * 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`. * * @static * @memberOf _ @@ -11158,11 +11218,10 @@ * // => false */ function isNative(value) { - if (!isObject(value)) { - return false; + if (isMaskable(value)) { + throw new Error('This method is not supported with `core-js`. Try https://github.com/es-shims.'); } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); + return baseIsNative(value); } /** @@ -11624,7 +11683,7 @@ /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on + * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static @@ -11978,9 +12037,6 @@ * * _.at(object, ['a[0].b.c', 'a[1]']); * // => [3, 4] - * - * _.at(['a', 'b', 'c'], 0, 2); - * // => ['a', 'c'] */ var at = rest(function(object, paths) { return baseAt(object, baseFlatten(paths, 1)); @@ -12113,7 +12169,7 @@ * // => 'barney' */ function findKey(object, predicate) { - return baseFind(object, getIteratee(predicate, 3), baseForOwn, true); + return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); } /** @@ -12153,7 +12209,7 @@ * // => 'pebbles' */ function findLastKey(object, predicate) { - return baseFind(object, getIteratee(predicate, 3), baseForOwnRight, true); + return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); } /** @@ -13012,15 +13068,16 @@ * An alternative to `_.reduce`; this method transforms `object` to a new * `accumulator` object which is the result of running each of its own * enumerable string keyed properties thru `iteratee`, with each invocation - * potentially mutating the `accumulator` object. The iteratee is invoked - * with four arguments: (accumulator, value, key, object). Iteratee functions - * may exit iteration early by explicitly returning `false`. + * potentially mutating the `accumulator` object. If `accumulator` is not + * provided, a new object with the same `[[Prototype]]` will be used. The + * iteratee is invoked with four arguments: (accumulator, value, key, object). + * Iteratee functions may exit iteration early by explicitly returning `false`. * * @static * @memberOf _ * @since 1.3.0 * @category Object - * @param {Array|Object} object The object to iterate over. + * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The custom accumulator value. * @returns {*} Returns the accumulated value. @@ -13442,7 +13499,7 @@ * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search from. + * @param {number} [position=string.length] The position to search up to. * @returns {boolean} Returns `true` if `string` ends with `target`, * else `false`. * @example @@ -14527,7 +14584,7 @@ * } * }; * - * _.bindAll(view, 'onClick'); + * _.bindAll(view, ['onClick']); * jQuery(element).on('click', view.onClick); * // => Logs 'clicked docs' when clicked. */ @@ -14608,7 +14665,7 @@ * { 'user': 'fred', 'age': 40 } * ]; * - * _.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) })); + * _.filter(users, _.conforms({ 'age': function(n) { return n > 38; } })); * // => [{ 'user': 'fred', 'age': 40 }] */ function conforms(source) { @@ -14626,10 +14683,12 @@ * @returns {Function} Returns the new constant function. * @example * - * var object = { 'user': 'fred' }; - * var getter = _.constant(object); + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] * - * getter() === object; + * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { @@ -14656,7 +14715,7 @@ * return n * n; * } * - * var addSquare = _.flow(_.add, square); + * var addSquare = _.flow([_.add, square]); * addSquare(1, 2); * // => 9 */ @@ -14679,7 +14738,7 @@ * return n * n; * } * - * var addSquare = _.flowRight(square, _.add); + * var addSquare = _.flowRight([square, _.add]); * addSquare(1, 2); * // => 9 */ @@ -14698,7 +14757,7 @@ * * var object = { 'user': 'fred' }; * - * _.identity(object) === object; + * console.log(_.identity(object) === object); * // => true */ function identity(value) { @@ -14959,8 +15018,7 @@ } /** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. + * A method that returns `undefined`. * * @static * @memberOf _ @@ -14968,17 +15026,15 @@ * @category Util * @example * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true + * _.times(2, _.noop); + * // => [undefined, undefined] */ function noop() { // No operation performed. } /** - * Creates a function that gets the argument at `n` index. If `n` is negative, + * Creates a function that gets the argument at index `n`. If `n` is negative, * the nth argument from the end is returned. * * @static @@ -15017,7 +15073,7 @@ * @returns {Function} Returns the new function. * @example * - * var func = _.over(Math.max, Math.min); + * var func = _.over([Math.max, Math.min]); * * func(1, 2, 3, 4); * // => [4, 1] @@ -15037,7 +15093,7 @@ * @returns {Function} Returns the new function. * @example * - * var func = _.overEvery(Boolean, isFinite); + * var func = _.overEvery([Boolean, isFinite]); * * func('1'); * // => true @@ -15063,7 +15119,7 @@ * @returns {Function} Returns the new function. * @example * - * var func = _.overSome(Boolean, isFinite); + * var func = _.overSome([Boolean, isFinite]); * * func('1'); * // => true @@ -15210,6 +15266,101 @@ */ var rangeRight = createRange(true); + /** + * A method that returns a new empty array. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Array} Returns the new empty array. + * @example + * + * var arrays = _.times(2, _.stubArray); + * + * console.log(arrays); + * // => [[], []] + * + * console.log(arrays[0] === arrays[1]); + * // => false + */ + function stubArray() { + return []; + } + + /** + * A method that returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ + function stubFalse() { + return false; + } + + /** + * A method that returns a new empty object. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Object} Returns the new empty object. + * @example + * + * var objects = _.times(2, _.stubObject); + * + * console.log(objects); + * // => [{}, {}] + * + * console.log(objects[0] === objects[1]); + * // => false + */ + function stubObject() { + return {}; + } + + /** + * A method that returns an empty string. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {string} Returns the empty string. + * @example + * + * _.times(2, _.stubString); + * // => ['', ''] + */ + function stubString() { + return ''; + } + + /** + * A method that returns `true`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `true`. + * @example + * + * _.times(2, _.stubTrue); + * // => [true, true] + */ + function stubTrue() { + return true; + } + /** * Invokes the iteratee `n` times, returning an array of the results of * each invocation. The iteratee is invoked with one argument; (index). @@ -15226,8 +15377,8 @@ * _.times(3, String); * // => ['0', '1', '2'] * - * _.times(4, _.constant(true)); - * // => [true, true, true, true] + * _.times(4, _.constant(0)); + * // => [0, 0, 0, 0] */ function times(n, iteratee) { n = toInteger(n); @@ -15263,15 +15414,6 @@ * * _.toPath('a[0].b.c'); * // => ['a', '0', 'b', 'c'] - * - * var path = ['a', 'b', 'c'], - * newPath = _.toPath(path); - * - * console.log(newPath); - * // => ['a', 'b', 'c'] - * - * console.log(path === newPath); - * // => false */ function toPath(value) { if (isArray(value)) { @@ -15910,6 +16052,11 @@ lodash.meanBy = meanBy; lodash.min = min; lodash.minBy = minBy; + lodash.stubArray = stubArray; + lodash.stubFalse = stubFalse; + lodash.stubObject = stubObject; + lodash.stubString = stubString; + lodash.stubTrue = stubTrue; lodash.multiply = multiply; lodash.nth = nth; lodash.noConflict = noConflict; @@ -16216,7 +16363,7 @@ // 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. - (freeWindow || freeSelf || {})._ = _; + (freeSelf || {})._ = _; // Some AMD build optimizers like r.js check for condition patterns like the following: if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { @@ -16227,11 +16374,9 @@ }); } // Check for `exports` after `define` in case a build optimizer adds an `exports` object. - else if (freeExports && freeModule) { + else if (freeModule) { // Export for Node.js. - if (moduleExports) { - (freeModule.exports = _)._ = _; - } + (freeModule.exports = _)._ = _; // Export for CommonJS support. freeExports._ = _; } diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 9f27fc1b75..66f11d87c6 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -2,124 +2,126 @@ * @license * lodash lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE */ -;(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.length;++u=t?t:r), -n!==T&&(t=t>=n?t:n)),t}function nn(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(!Ue(t))return t;if(o=ai(t)){if(c=Tr(t),!n)return cr(t,c)}else{var a=Pr(t),l="[object Function]"==a||"[object GeneratorFunction]"==a;if(li(t))return er(t,n);if("[object Object]"==a||"[object Arguments]"==a||l&&!i){if(C(t))return i?t:{};if(c=qr(l?{}:t),!n)return lr(t,Qt(c,t))}else{if(!Ct[a])return i?t:{};c=Vr(t,a,nn,n)}}if(f||(f=new Zt),i=f.get(t))return i;if(f.set(t,c),!o)var s=r?vn(t,nu,Nr):nu(t); -return u(s||t,function(u,o){s&&(o=u,u=t[o]),Kt(c,o,nn(u,n,r,e,o,t,f))}),c}function rn(t){var n=nu(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 en(t){return Ue(t)?zu(t):{}}function un(t,n,r){if(typeof t!="function")throw new du("Expected a function");return Du(function(){t.apply(T,r)},n)}function on(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 $t(n));t:for(;++u0&&r(f)?n>1?ln(f,n-1,r,e,u):s(u,f):e||(u[u.length]=f)}return u}function sn(t,n){return t&&bo(t,n,nu)}function hn(t,n){return t&&xo(t,n,nu)}function pn(t,n){return f(n,function(n){return Me(t[n])})}function _n(t,n){n=Qr(n,t)?[n]:nr(n);for(var r=0,e=n.length;null!=t&&e>r;)t=t[ue(n[r++])];return r&&r==e?t:T}function vn(t,n,r){return n=n(t),ai(t)?n:s(n,r(t))}function gn(t,n){return t>n}function dn(t,n){return wu.call(t,n)||typeof t=="object"&&n in t&&null===Pu(Object(t)); -}function yn(t,n){return n in Object(t)}function bn(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=Ku(p.length,s),f[i]=!r&&(n||u>=120&&p.length>=120)?new $t(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 xn(t,n,r){var e={};return sn(t,function(t,u,o){n(e,r(t),u,o); -}),e}function jn(t,n,e){return Qr(n,t)||(n=nr(n),t=ee(t,n),n=le(n)),n=null==t?t:t[ue(n)],null==n?T:r(n,t,e)}function wn(t,n,r,e,u){if(t===n)n=true;else if(null==t||null==n||!Ue(t)&&!De(n))n=t!==t&&n!==n;else t:{var o=ai(t),i=ai(n),f="[object Array]",c="[object Array]";o||(f=Pr(t),f="[object Arguments]"==f?"[object Object]":f),i||(c=Pr(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 Zt),n=o||qe(t)?Lr(t,n,wn,r,e,u):Mr(t,n,f,wn,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 Zt),n=wn(t,n,r,e,u);break t}if(c)n:if(u||(u=new Zt),o=2&e,f=nu(t),i=f.length,c=nu(n).length,i==c||o){for(a=i;a--;){var l=f[a];if(!(o?l in n:dn(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 En(t,n){var r=-1,e=We(t)?Array(t.length):[];return go(t,function(t,u,o){e[++r]=n(t,u,o)}),e}function In(t){var n=Fr(t);return 1==n.length&&n[0][2]?ne(n[0][0],n[0][1]):function(r){return r===t||mn(r,t,n)}}function Sn(t,n){return Qr(t)&&n===n&&!Ue(n)?ne(ue(t),n):function(r){ -var e=Xe(r,t);return e===T&&e===n?tu(r,t):wn(n,e,T,3)}}function Rn(t,n,r,e,o){if(t!==n){if(!ai(n)&&!qe(n))var i=ru(n);u(i||n,function(u,f){if(i&&(f=u,u=n[f]),Ue(u)){o||(o=new Zt);var c=f,a=o,l=t[c],s=n[c],h=a.get(s);if(h)Vt(t,c,h);else{var h=e?e(l,s,c+"",t,n,a):T,p=h===T;p&&(h=s,ai(s)||qe(s)?ai(l)?h=l:Be(l)?h=cr(l):(p=false,h=nn(s,true)):Ne(s)||Re(s)?Re(l)?h=He(l):!Ue(l)||r&&Me(l)?(p=false,h=nn(s,true)):h=l:p=false),a.set(s,h),p&&Rn(h,s,r,e,a),a["delete"](s),Vt(t,c,h)}}else c=e?e(t[f],u,f+"",t,n,o):T,c===T&&(c=u), -Vt(t,f,c)})}}function Wn(t,n){var r=t.length;return r?(n+=0>n?r:0,Yr(n,r)?t[n]:T):void 0}function Bn(t,n,r){var e=-1;return n=l(n.length?n:[cu],O(Ur())),t=En(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 Ln(t,n){return t=Object(t),h(n,function(n,r){return r in t&&(n[r]=t[r]),n},{})}function Mn(t,n){for(var r=-1,e=vn(t,ru,Oo),u=e.length,o={};++rn||n>9007199254740991)return r;do n%2&&(r+=t),(n=Nu(n/2))&&(t+=t);while(n);return r}function Nn(t,n,r,e){n=Qr(n,t)?[n]:nr(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&&!Te(i)&&(r?n>=i:n>i)?e=o+1:u=o}return u}return qn(t,n,cu,r)}function qn(t,n,r,e){n=r(n);for(var u=0,o=t?t.length:0,i=n!==n,f=null===n,c=Te(n),a=n===T;o>u;){var l=Nu((u+o)/2),s=r(t[l]),h=s!==T,p=null===s,_=s===s,v=Te(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 Ku(o,4294967294)}function Vn(t,n){for(var r=-1,e=t.length,u=0,o=[];++r=200){if(u=n?null:wo(t))return F(u);i=false,u=E,l=new $t}else l=n?[]:f;t:for(;++ee?n[e]:T);return i}function tr(t){return Be(t)?t:[]}function nr(t){return ai(t)?t:Eo(t)}function rr(t,n,r){var e=t.length;return r=r===T?e:r,!n&&r>=e?t:Pn(t,n,r)}function er(t,n){if(n)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function ur(t){var n=new t.constructor(t.byteLength);return new Wu(n).set(new Wu(t)),n}function or(t,n){if(t!==n){var r=t!==T,e=null===t,u=t===t,o=Te(t),i=n!==T,f=null===n,c=n===n,a=Te(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 ir(t,n,r,e){var u=-1,o=t.length,i=r.length,f=-1,c=n.length,a=Vu(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 fr(t,n,r,e){var u=-1,o=t.length,i=-1,f=r.length,c=-1,a=n.length,l=Vu(o-f,0),s=Array(l+a);for(e=!e;++uu)&&(s[l+r[i]]=t[u++]); -return s}function cr(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&&Hr(r[0],r[1],i)&&(o=3>u?T:o, -u=1),n=Object(n);++ei&&f[0]!==a&&f[i-1]!==a?[]:D(f,a),i-=c.length,e>i?Sr(t,n,jr,u.placeholder,T,f,c,T,T,e-i):r(this&&this!==Jt&&this instanceof u?o:t,this,f)}var o=yr(t);return u}function xr(t){return Ie(function(n){n=ln(n,1);var r=n.length,e=r,u=kt.prototype.thru;for(t&&n.reverse();e--;){var o=n[e]; -if(typeof o!="function")throw new du("Expected a function");if(u&&!i&&"wrapper"==Cr(o))var i=new kt([],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=D(y,j),Sr(t,n,jr,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=Ku(f.length,x),m=cr(y);w--;){var A=f[w];y[w]=Yr(A,x)?m[A]:T}}else v&&d>1&&y.reverse();return s&&d>c&&(y.length=c),this&&this!==Jt&&this instanceof l&&(b=g||yr(b)),b.apply(j,y)}var s=128&n,h=1&n,p=2&n,_=24&n,v=512&n,g=p?T:yr(t); -return l}function wr(t,n){return function(r,e){return xn(r,t,n(e))}}function mr(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=Gn(n),r=Gn(r)):(n=Kn(n),r=Kn(r)),e=t(n,r)}return e}}function Ar(t){return Ie(function(n){return n=1==n.length&&ai(n[0])?l(n[0],O(Ur())):l(ln(n,1,Jr),O(Ur())),Ie(function(e){var u=this;return t(n,function(t){return r(t,u,e)})})})}function Or(t,n){n=n===T?" ":Gn(n);var r=n.length;return 2>r?r?$n(n,t):n:(r=$n(n,$u(t/N(n))), -Wt.test(n)?rr(r.match(St),0,t).join(""):r.slice(0,t))}function kr(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!==Jt&&this instanceof o?f:t;++an?1:-1:Ye(e)||0;var u=-1;r=Vu($u((r-n)/(e||1)),0);for(var o=Array(r);r--;)o[t?r:++u]=n, -n+=e;return o}}function Ir(t){return function(n,r){return typeof n=="string"&&typeof r=="string"||(n=Ye(n),r=Ye(r)),t(n,r)}}function Sr(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),Xr(t)&&ko(r,n),r.placeholder=e,r}function Rr(t){var n=vu[t];return function(t,r){if(t=Ye(t),r=Ge(r)){var e=(Qe(t)+"e").split("e"),e=n(e[0]+"e"+(+e[1]+r)),e=(Qe(e)+"e").split("e");return+(e[0]+"e"+(+e[1]-r))}return n(t); -}}function Wr(t){return function(n){var r=Pr(n);return"[object Map]"==r?U(n):"[object Set]"==r?$(n):A(n,t(n))}}function Br(t,n,r,e,u,o,i,f){var c=2&n;if(!c&&typeof t!="function")throw new du("Expected a function");var a=e?e.length:0;if(a||(n&=-97,e=u=T),i=i===T?i:Vu(Ge(i),0),f=f===T?f:Ge(f),a-=u?u.length:0,64&n){var l=e,s=u;e=u=T}var h=c?T:mo(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?ir(e,r,h[4]):r,o[4]=e?D(o[3],"__lodash_placeholder__"):h[4]),(r=h[5])&&(e=o[5],o[5]=e?fr(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]:Ku(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:Vu(o[9]-a,0),!f&&24&n&&(n&=-25),(h?jo:ko)(n&&1!=n?8==n||16==n?br(t,n,f):32!=n&&33!=n||u.length?jr.apply(T,o):kr(t,n,r,e):vr(t,n,r),o)}function Lr(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 $t:T;for(o.set(t,n);++c-1&&0==t%1&&n>t}function Hr(t,n,r){if(!Ue(r))return false;var e=typeof n;return("number"==e?We(r)&&Yr(n,r.length):"string"==e&&n in r)?Se(r[n],t):false}function Qr(t,n){if(ai(t))return false;var r=typeof t;return"number"==r||"symbol"==r||"boolean"==r||null==t||Te(t)?true:ut.test(t)||!et.test(t)||null!=n&&t in Object(n); -}function Xr(t){var n=Cr(t),r=At[n];return typeof r=="function"&&n in zt.prototype?t===r?true:(n=mo(r),!!n&&t===n[0]):false}function te(t){var n=t&&t.constructor;return t===(typeof n=="function"&&n.prototype||bu)}function ne(t,n){return function(r){return null==r?false:r[t]===n&&(n!==T||t in Object(r))}}function re(t,n,r,e,u,o){return Ue(t)&&Ue(n)&&Rn(t,n,T,re,o.set(n,t)),t}function ee(t,n){return 1==n.length?t:_n(t,Pn(n,0,-1))}function ue(t){if(typeof t=="string"||Te(t))return t;var n=t+"";return"0"==n&&1/t==-q?"-0":n; -}function oe(t){if(null!=t){try{return ju.call(t)}catch(n){}return t+""}return""}function ie(t){if(t instanceof zt)return t.clone();var n=new kt(t.__wrapped__,t.__chain__);return n.__actions__=cr(t.__actions__),n.__index__=t.__index__,n.__values__=t.__values__,n}function fe(t,n,r){var e=t?t.length:0;return e?(n=r||n===T?1:Ge(n),Pn(t,0>n?0:n,e)):[]}function ce(t,n,r){var e=t?t.length:0;return e?(n=r||n===T?1:Ge(n),n=e-n,Pn(t,0,0>n?0:n)):[]}function ae(t){return t&&t.length?t[0]:T}function le(t){var n=t?t.length:0; -return n?t[n-1]:T}function se(t,n){return t&&t.length&&n&&n.length?Un(t,n):t}function he(t){return t?Hu.call(t):t}function pe(t){if(!t||!t.length)return[];var n=0;return t=f(t,function(t){return Be(t)?(n=Vu(t.length,n),true):void 0}),m(n,function(n){return l(t,Cn(n))})}function _e(t,n){if(!t||!t.length)return[];var e=pe(t);return null==n?e:l(e,function(t){return r(n,T,t)})}function ve(t){return t=At(t),t.__chain__=true,t}function ge(t,n){return n(t)}function de(){return this}function ye(t,n){return(ai(t)?u:go)(t,Ur(n,3)); -}function be(t,n){return(ai(t)?o:yo)(t,Ur(n,3))}function xe(t,n){return(ai(t)?l:En)(t,Ur(n,3))}function je(t,n,r){var e=-1,u=Ve(t),o=u.length,i=o-1;for(n=(r?Hr(t,n,r):n===T)?1:tn(Ge(n),0,o);++e=t&&(n=T),r}}function Ae(t,n,r){ -return n=r?T:n,t=Br(t,8,T,T,T,T,T,n),t.placeholder=Ae.placeholder,t}function Oe(t,n,r){return n=r?T:n,t=Br(t,16,T,T,T,T,T,n),t.placeholder=Oe.placeholder,t}function ke(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||r>=n||0>r||g&&t>=l}function o(){var t=Qo();if(u(t))return i(t);var r;r=t-_,t=n-(t-p),r=g?Ku(t,l-r):t,h=Du(o,r)}function i(t){return Bu(h),h=T,d&&c?e(t):(c=a=T,s)}function f(){var t=Qo(),r=u(t);if(c=arguments,a=this,p=t,r){if(h===T)return _=t=p, -h=Du(o,n),v?e(t):s;if(g)return Bu(h),h=Du(o,n),e(p)}return h===T&&(h=Du(o,n)),s}var c,a,l,s,h,p=0,_=0,v=false,g=false,d=true;if(typeof t!="function")throw new du("Expected a function");return n=Ye(n)||0,Ue(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Vu(Ye(r.maxWait)||0,n):l,d="trailing"in r?!!r.trailing:d),f.cancel=function(){h!==T&&Bu(h),p=_=0,c=a=h=T},f.flush=function(){return h===T?s:i(Qo())},f}function Ee(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 du("Expected a function");return r.cache=new(Ee.Cache||Ft),r}function Ie(t,n){if(typeof t!="function")throw new du("Expected a function");return n=Vu(n===T?t.length-1:Ge(n),0),function(){for(var e=arguments,u=-1,o=Vu(e.length-n,0),i=Array(o);++u-1&&0==t%1&&9007199254740991>=t}function Ue(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function De(t){return!!t&&typeof t=="object"}function Fe(t){return Ue(t)?(Me(t)||C(t)?Eu:yt).test(oe(t)):false}function $e(t){return typeof t=="number"||De(t)&&"[object Number]"==Ou.call(t)}function Ne(t){return!De(t)||"[object Object]"!=Ou.call(t)||C(t)?false:(t=Pu(Object(t)),null===t?true:(t=wu.call(t,"constructor")&&t.constructor,typeof t=="function"&&t instanceof t&&ju.call(t)==Au)); -}function Pe(t){return Ue(t)&&"[object RegExp]"==Ou.call(t)}function Ze(t){return typeof t=="string"||!ai(t)&&De(t)&&"[object String]"==Ou.call(t)}function Te(t){return typeof t=="symbol"||De(t)&&"[object Symbol]"==Ou.call(t)}function qe(t){return De(t)&&ze(t.length)&&!!Mt[Ou.call(t)]}function Ve(t){if(!t)return[];if(We(t))return Ze(t)?t.match(St):cr(t);if(Cu&&t[Cu])return z(t[Cu]());var n=Pr(t);return("[object Map]"==n?U:"[object Set]"==n?F:eu)(t)}function Ke(t){return t?(t=Ye(t),t===q||t===-q?1.7976931348623157e308*(0>t?-1:1):t===t?t:0):0===t?t:0; -}function Ge(t){t=Ke(t);var n=t%1;return t===t?n?t-n:t:0}function Je(t){return t?tn(Ge(t),0,4294967295):0}function Ye(t){if(typeof t=="number")return t;if(Te(t))return V;if(Ue(t)&&(t=Me(t.valueOf)?t.valueOf():t,t=Ue(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)?Pt(t.slice(2),n?2:8):gt.test(t)?V:+t}function He(t){return ar(t,ru(t))}function Qe(t){return null==t?"":Gn(t)}function Xe(t,n,r){return t=null==t?T:_n(t,n),t===T?r:t}function tu(t,n){ -return null!=t&&Zr(t,n,yn)}function nu(t){var n=te(t);if(!n&&!We(t))return qu(Object(t));var r,e=Kr(t),u=!!e,e=e||[],o=e.length;for(r in t)!dn(t,r)||u&&("length"==r||Yr(r,o))||n&&"constructor"==r||e.push(r);return e}function ru(t){for(var n=-1,r=te(t),e=On(t),u=e.length,o=Kr(t),i=!!o,o=o||[],f=o.length;++nt?false:(t==n.length-1?n.pop():Fu.call(n,t,1),true)},Dt.prototype.get=function(t){ -var n=this.__data__;return t=Gt(n,t),0>t?T:n[t][1]},Dt.prototype.has=function(t){return-1e?r.push([t,n]):r[e][1]=n,this},Ft.prototype.clear=function(){this.__data__={hash:new Ut,map:new(to||Dt),string:new Ut}},Ft.prototype["delete"]=function(t){return Dr(this,t)["delete"](t)},Ft.prototype.get=function(t){return Dr(this,t).get(t)},Ft.prototype.has=function(t){return Dr(this,t).has(t)},Ft.prototype.set=function(t,n){ -return Dr(this,t).set(t,n),this},$t.prototype.add=$t.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},$t.prototype.has=function(t){return this.__data__.has(t)},Zt.prototype.clear=function(){this.__data__=new Dt},Zt.prototype["delete"]=function(t){return this.__data__["delete"](t)},Zt.prototype.get=function(t){return this.__data__.get(t)},Zt.prototype.has=function(t){return this.__data__.has(t)},Zt.prototype.set=function(t,n){var r=this.__data__;return r instanceof Dt&&200==r.__data__.length&&(r=this.__data__=new Ft(r.__data__)), -r.set(t,n),this};var go=pr(sn),yo=pr(hn,true),bo=_r(),xo=_r(true);Lu&&!Uu.call({valueOf:1},"valueOf")&&(On=function(t){return z(Lu(t))});var jo=oo?function(t,n){return oo.set(t,n),t}:cu,wo=ro&&1/F(new ro([,-0]))[1]==q?function(t){return new ro(t)}:su,mo=oo?function(t){return oo.get(t)}:su,Ao=Cn("length");Mu||(Nr=function(){return[]});var Oo=Mu?function(t){for(var n=[];t;)s(n,Nr(t)),t=Pu(Object(t));return n}:Nr;(Xu&&"[object DataView]"!=Pr(new Xu(new ArrayBuffer(1)))||to&&"[object Map]"!=Pr(new to)||no&&"[object Promise]"!=Pr(no.resolve())||ro&&"[object Set]"!=Pr(new ro)||eo&&"[object WeakMap]"!=Pr(new eo))&&(Pr=function(t){ -var n=Ou.call(t);if(t=(t="[object Object]"==n?t.constructor:T)?oe(t):T)switch(t){case co:return"[object DataView]";case ao:return"[object Map]";case lo:return"[object Promise]";case so:return"[object Set]";case ho:return"[object WeakMap]"}return n});var ko=function(){var t=0,n=0;return function(r,e){var u=Qo(),o=16-(u-n);if(n=u,o>0){if(150<=++t)return r}else t=0;return jo(r,e)}}(),Eo=Ee(function(t){var n=[];return Qe(t).replace(ot,function(t,r,e,u){n.push(e?u.replace(ht,"$1"):r||t)}),n}),Io=Ie(function(t,n){ -return Be(t)?on(t,ln(n,1,Be,true)):[]}),So=Ie(function(t,n){var r=le(n);return Be(r)&&(r=T),Be(t)?on(t,ln(n,1,Be,true),Ur(r)):[]}),Ro=Ie(function(t,n){var r=le(n);return Be(r)&&(r=T),Be(t)?on(t,ln(n,1,Be,true),T,r):[]}),Wo=Ie(function(t){var n=l(t,tr);return n.length&&n[0]===t[0]?bn(n):[]}),Bo=Ie(function(t){var n=le(t),r=l(t,tr);return n===le(r)?n=T:r.pop(),r.length&&r[0]===t[0]?bn(r,Ur(n)):[]}),Lo=Ie(function(t){var n=le(t),r=l(t,tr);return n===le(r)?n=T:r.pop(),r.length&&r[0]===t[0]?bn(r,T,n):[]}),Mo=Ie(se),Co=Ie(function(t,n){ -n=ln(n,1);var r=t?t.length:0,e=Xt(t,n);return Dn(t,l(n,function(t){return Yr(t,r)?+t:t}).sort(or)),e}),zo=Ie(function(t){return Jn(ln(t,1,Be,true))}),Uo=Ie(function(t){var n=le(t);return Be(n)&&(n=T),Jn(ln(t,1,Be,true),Ur(n))}),Do=Ie(function(t){var n=le(t);return Be(n)&&(n=T),Jn(ln(t,1,Be,true),T,n)}),Fo=Ie(function(t,n){return Be(t)?on(t,n):[]}),$o=Ie(function(t){return Qn(f(t,Be))}),No=Ie(function(t){var n=le(t);return Be(n)&&(n=T),Qn(f(t,Be),Ur(n))}),Po=Ie(function(t){var n=le(t);return Be(n)&&(n=T), -Qn(f(t,Be),T,n)}),Zo=Ie(pe),To=Ie(function(t){var n=t.length,n=n>1?t[n-1]:T,n=typeof n=="function"?(t.pop(),n):T;return _e(t,n)}),qo=Ie(function(t){function n(n){return Xt(n,t)}t=ln(t,1);var r=t.length,e=r?t[0]:0,u=this.__wrapped__;return!(r>1||this.__actions__.length)&&u instanceof zt&&Yr(e)?(u=u.slice(e,+e+(r?1:0)),u.__actions__.push({func:ge,args:[n],thisArg:T}),new kt(u,this.__chain__).thru(function(t){return r&&!t.length&&t.push(T),t})):this.thru(n)}),Vo=sr(function(t,n,r){wu.call(t,r)?++t[r]:t[r]=1; -}),Ko=sr(function(t,n,r){wu.call(t,r)?t[r].push(n):t[r]=[n]}),Go=Ie(function(t,n,e){var u=-1,o=typeof n=="function",i=Qr(n),f=We(t)?Array(t.length):[];return go(t,function(t){var c=o?n:i&&null!=t?t[n]:T;f[++u]=c?r(c,t,e):jn(t,n,e)}),f}),Jo=sr(function(t,n,r){t[r]=n}),Yo=sr(function(t,n,r){t[r?0:1].push(n)},function(){return[[],[]]}),Ho=Ie(function(t,n){if(null==t)return[];var r=n.length;return r>1&&Hr(t,n[0],n[1])?n=[]:r>2&&Hr(n[0],n[1],n[2])&&(n=[n[0]]),n=1==n.length&&ai(n[0])?n[0]:ln(n,1,Jr),Bn(t,n,[]); -}),Qo=pu.now,Xo=Ie(function(t,n,r){var e=1;if(r.length)var u=D(r,zr(Xo)),e=32|e;return Br(t,e,n,r,u)}),ti=Ie(function(t,n,r){var e=3;if(r.length)var u=D(r,zr(ti)),e=32|e;return Br(n,e,t,r,u)}),ni=Ie(function(t,n){return un(t,1,n)}),ri=Ie(function(t,n,r){return un(t,Ye(n)||0,r)});Ee.Cache=Ft;var ei=Ie(function(t,n){n=1==n.length&&ai(n[0])?l(n[0],O(Ur())):l(ln(n,1,Jr),O(Ur()));var e=n.length;return Ie(function(u){for(var o=-1,i=Ku(u.length,e);++o=n}),ai=Array.isArray,li=Iu?function(t){return t instanceof Iu}:fu(false),si=Ir(kn),hi=Ir(function(t,n){return n>=t}),pi=hr(function(t,n){if(io||te(n)||We(n))ar(n,nu(n),t);else for(var r in n)wu.call(n,r)&&Kt(t,r,n[r])}),_i=hr(function(t,n){if(io||te(n)||We(n))ar(n,ru(n),t);else for(var r in n)Kt(t,r,n[r])}),vi=hr(function(t,n,r,e){ -ar(n,ru(n),t,e)}),gi=hr(function(t,n,r,e){ar(n,nu(n),t,e)}),di=Ie(function(t,n){return Xt(t,ln(n,1))}),yi=Ie(function(t){return t.push(T,Tt),r(vi,T,t)}),bi=Ie(function(t){return t.push(T,re),r(Ai,T,t)}),xi=wr(function(t,n,r){t[n]=r},fu(cu)),ji=wr(function(t,n,r){wu.call(t,n)?t[n].push(r):t[n]=[r]},Ur),wi=Ie(jn),mi=hr(function(t,n,r){Rn(t,n,r)}),Ai=hr(function(t,n,r,e){Rn(t,n,r,e)}),Oi=Ie(function(t,n){return null==t?{}:(n=l(ln(n,1),ue),Ln(t,on(vn(t,ru,Oo),n)))}),ki=Ie(function(t,n){return null==t?{}:Ln(t,l(ln(n,1),ue)); -}),Ei=Wr(nu),Ii=Wr(ru),Si=dr(function(t,n,r){return n=n.toLowerCase(),t+(r?uu(n):n)}),Ri=dr(function(t,n,r){return t+(r?"-":"")+n.toLowerCase()}),Wi=dr(function(t,n,r){return t+(r?" ":"")+n.toLowerCase()}),Bi=gr("toLowerCase"),Li=dr(function(t,n,r){return t+(r?"_":"")+n.toLowerCase()}),Mi=dr(function(t,n,r){return t+(r?" ":"")+zi(n)}),Ci=dr(function(t,n,r){return t+(r?" ":"")+n.toUpperCase()}),zi=gr("toUpperCase"),Ui=Ie(function(t,n){try{return r(t,T,n)}catch(e){return Le(e)?e:new _u(e)}}),Di=Ie(function(t,n){ -return u(ln(n,1),function(n){n=ue(n),t[n]=Xo(t[n],t)}),t}),Fi=xr(),$i=xr(true),Ni=Ie(function(t,n){return function(r){return jn(r,t,n)}}),Pi=Ie(function(t,n){return function(r){return jn(t,r,n)}}),Zi=Ar(l),Ti=Ar(i),qi=Ar(_),Vi=Er(),Ki=Er(true),Gi=mr(function(t,n){return t+n}),Ji=Rr("ceil"),Yi=mr(function(t,n){return t/n}),Hi=Rr("floor"),Qi=mr(function(t,n){return t*n}),Xi=Rr("round"),tf=mr(function(t,n){return t-n});return At.after=function(t,n){if(typeof n!="function")throw new du("Expected a function"); -return t=Ge(t),function(){return 1>--t?n.apply(this,arguments):void 0}},At.ary=we,At.assign=pi,At.assignIn=_i,At.assignInWith=vi,At.assignWith=gi,At.at=di,At.before=me,At.bind=Xo,At.bindAll=Di,At.bindKey=ti,At.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return ai(t)?t:[t]},At.chain=ve,At.chunk=function(t,n,r){if(n=(r?Hr(t,n,r):n===T)?1:Vu(Ge(n),0),r=t?t.length:0,!r||1>n)return[];for(var e=0,u=0,o=Array($u(r/n));r>e;)o[u++]=Pn(t,e,e+=n);return o},At.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:Ge(e),0>e&&(e+=u),e=r>e?0:Je(e);e>r;)t[r++]=n;return t},At.filter=function(t,n){return(ai(t)?f:an)(t,Ur(n,3))},At.flatMap=function(t,n){return ln(xe(t,n),1)},At.flatMapDeep=function(t,n){return ln(xe(t,n),q)},At.flatMapDepth=function(t,n,r){return r=r===T?1:Ge(r),ln(xe(t,n),r)},At.flatten=function(t){return t&&t.length?ln(t,1):[]},At.flattenDeep=function(t){return t&&t.length?ln(t,q):[]},At.flattenDepth=function(t,n){return t&&t.length?(n=n===T?1:Ge(n),ln(t,n)):[]; -},At.flip=function(t){return Br(t,512)},At.flow=Fi,At.flowRight=$i,At.fromPairs=function(t){for(var n=-1,r=t?t.length:0,e={};++n>>0,r?(t=Qe(t))&&(typeof n=="string"||null!=n&&!Pe(n))&&(n=Gn(n),""==n&&Wt.test(t))?rr(t.match(St),0,r):Qu.call(t,n,r):[]},At.spread=function(t,n){if(typeof t!="function")throw new du("Expected a function");return n=n===T?0:Vu(Ge(n),0),Ie(function(e){var u=e[n];return e=rr(e,0,n),u&&s(e,u),r(t,this,e)})},At.tail=function(t){return fe(t,1)},At.take=function(t,n,r){return t&&t.length?(n=r||n===T?1:Ge(n), -Pn(t,0,0>n?0:n)):[]},At.takeRight=function(t,n,r){var e=t?t.length:0;return e?(n=r||n===T?1:Ge(n),n=e-n,Pn(t,0>n?0:n,e)):[]},At.takeRightWhile=function(t,n){return t&&t.length?Yn(t,Ur(n,3),false,true):[]},At.takeWhile=function(t,n){return t&&t.length?Yn(t,Ur(n,3)):[]},At.tap=function(t,n){return n(t),t},At.throttle=function(t,n,r){var e=true,u=true;if(typeof t!="function")throw new du("Expected a function");return Ue(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ke(t,n,{leading:e,maxWait:n, -trailing:u})},At.thru=ge,At.toArray=Ve,At.toPairs=Ei,At.toPairsIn=Ii,At.toPath=function(t){return ai(t)?l(t,ue):Te(t)?[t]:cr(Eo(t))},At.toPlainObject=He,At.transform=function(t,n,r){var e=ai(t)||qe(t);if(n=Ur(n,4),null==r)if(e||Ue(t)){var o=t.constructor;r=e?ai(t)?new o:[]:Me(o)?en(Pu(Object(t))):{}}else r={};return(e?u:sn)(t,function(t,e,u){return n(r,t,e,u)}),r},At.unary=function(t){return we(t,1)},At.union=zo,At.unionBy=Uo,At.unionWith=Do,At.uniq=function(t){return t&&t.length?Jn(t):[]},At.uniqBy=function(t,n){ -return t&&t.length?Jn(t,Ur(n)):[]},At.uniqWith=function(t,n){return t&&t.length?Jn(t,T,n):[]},At.unset=function(t,n){var r;if(null==t)r=true;else{r=t;var e=n,e=Qr(e,r)?[e]:nr(e);r=ee(r,e),e=ue(le(e)),r=!(null!=r&&dn(r,e))||delete r[e]}return r},At.unzip=pe,At.unzipWith=_e,At.update=function(t,n,r){return null==t?t:Nn(t,n,(typeof r=="function"?r:cu)(_n(t,n)),void 0)},At.updateWith=function(t,n,r,e){return e=typeof e=="function"?e:T,null!=t&&(t=Nn(t,n,(typeof r=="function"?r:cu)(_n(t,n)),e)),t},At.values=eu, -At.valuesIn=function(t){return null==t?[]:k(t,ru(t))},At.without=Fo,At.words=iu,At.wrap=function(t,n){return n=null==n?cu:n,ui(n,t)},At.xor=$o,At.xorBy=No,At.xorWith=Po,At.zip=Zo,At.zipObject=function(t,n){return Xn(t||[],n||[],Kt)},At.zipObjectDeep=function(t,n){return Xn(t||[],n||[],Nn)},At.zipWith=To,At.entries=Ei,At.entriesIn=Ii,At.extend=_i,At.extendWith=vi,lu(At,At),At.add=Gi,At.attempt=Ui,At.camelCase=Si,At.capitalize=uu,At.ceil=Ji,At.clamp=function(t,n,r){return r===T&&(r=n,n=T),r!==T&&(r=Ye(r), -r=r===r?r:0),n!==T&&(n=Ye(n),n=n===n?n:0),tn(Ye(t),n,r)},At.clone=function(t){return nn(t,false,true)},At.cloneDeep=function(t){return nn(t,true,true)},At.cloneDeepWith=function(t,n){return nn(t,true,true,n)},At.cloneWith=function(t,n){return nn(t,false,true,n)},At.deburr=ou,At.divide=Yi,At.endsWith=function(t,n,r){t=Qe(t),n=Gn(n);var e=t.length;return r=r===T?e:tn(Ge(r),0,e),r-=n.length,r>=0&&t.indexOf(n,r)==r},At.eq=Se,At.escape=function(t){return(t=Qe(t))&&X.test(t)?t.replace(H,B):t},At.escapeRegExp=function(t){ -return(t=Qe(t))&&ft.test(t)?t.replace(it,"\\$&"):t},At.every=function(t,n,r){var e=ai(t)?i:fn;return r&&Hr(t,n,r)&&(n=T),e(t,Ur(n,3))},At.find=function(t,n){if(n=Ur(n,3),ai(t)){var r=g(t,n);return r>-1?t[r]:T}return v(t,n,go)},At.findIndex=function(t,n){return t&&t.length?g(t,Ur(n,3)):-1},At.findKey=function(t,n){return v(t,Ur(n,3),sn,true)},At.findLast=function(t,n){if(n=Ur(n,3),ai(t)){var r=g(t,n,true);return r>-1?t[r]:T}return v(t,n,yo)},At.findLastIndex=function(t,n){return t&&t.length?g(t,Ur(n,3),true):-1; -},At.findLastKey=function(t,n){return v(t,Ur(n,3),hn,true)},At.floor=Hi,At.forEach=ye,At.forEachRight=be,At.forIn=function(t,n){return null==t?t:bo(t,Ur(n,3),ru)},At.forInRight=function(t,n){return null==t?t:xo(t,Ur(n,3),ru)},At.forOwn=function(t,n){return t&&sn(t,Ur(n,3))},At.forOwnRight=function(t,n){return t&&hn(t,Ur(n,3))},At.get=Xe,At.gt=fi,At.gte=ci,At.has=function(t,n){return null!=t&&Zr(t,n,dn)},At.hasIn=tu,At.head=ae,At.identity=cu,At.includes=function(t,n,r,e){return t=We(t)?t:eu(t),r=r&&!e?Ge(r):0, -e=t.length,0>r&&(r=Vu(e+r,0)),Ze(t)?e>=r&&-1r&&(r=Vu(e+r,0)),d(t,n,r)):-1},At.inRange=function(t,n,r){return n=Ye(n)||0,r===T?(r=n,n=0):r=Ye(r)||0,t=Ye(t),t>=Ku(n,r)&&t=-9007199254740991&&9007199254740991>=t},At.isSet=function(t){return De(t)&&"[object Set]"==Pr(t)},At.isString=Ze,At.isSymbol=Te,At.isTypedArray=qe,At.isUndefined=function(t){return t===T},At.isWeakMap=function(t){return De(t)&&"[object WeakMap]"==Pr(t)},At.isWeakSet=function(t){return De(t)&&"[object WeakSet]"==Ou.call(t)},At.join=function(t,n){return t?Tu.call(t,n):""},At.kebabCase=Ri,At.last=le,At.lastIndexOf=function(t,n,r){var e=t?t.length:0; -if(!e)return-1;var u=e;if(r!==T&&(u=Ge(r),u=(0>u?Vu(e+u,0):Ku(u,e-1))+1),n!==n)return M(t,u,true);for(;u--;)if(t[u]===n)return u;return-1},At.lowerCase=Wi,At.lowerFirst=Bi,At.lt=si,At.lte=hi,At.max=function(t){return t&&t.length?cn(t,cu,gn):T},At.maxBy=function(t,n){return t&&t.length?cn(t,Ur(n),gn):T},At.mean=function(t){return b(t,cu)},At.meanBy=function(t,n){return b(t,Ur(n))},At.min=function(t){return t&&t.length?cn(t,cu,kn):T},At.minBy=function(t,n){return t&&t.length?cn(t,Ur(n),kn):T},At.multiply=Qi, -At.nth=function(t,n){return t&&t.length?Wn(t,Ge(n)):T},At.noConflict=function(){return Jt._===this&&(Jt._=ku),this},At.noop=su,At.now=Qo,At.pad=function(t,n,r){t=Qe(t);var e=(n=Ge(n))?N(t):0;return!n||e>=n?t:(n=(n-e)/2,Or(Nu(n),r)+t+Or($u(n),r))},At.padEnd=function(t,n,r){t=Qe(t);var e=(n=Ge(n))?N(t):0;return n&&n>e?t+Or(n-e,r):t},At.padStart=function(t,n,r){t=Qe(t);var e=(n=Ge(n))?N(t):0;return n&&n>e?Or(n-e,r)+t:t},At.parseInt=function(t,n,r){return r||null==n?n=0:n&&(n=+n),t=Qe(t).replace(ct,""), -Gu(t,n||(vt.test(t)?16:10))},At.random=function(t,n,r){if(r&&typeof r!="boolean"&&Hr(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=Ye(t)||0,n===T?(n=t,t=0):n=Ye(n)||0),t>n){var e=t;t=n,n=e}return r||t%1||n%1?(r=Ju(),Ku(t+r*(n-t+Nt("1e-"+((r+"").length-1))),n)):Fn(t,n)},At.reduce=function(t,n,r){var e=ai(t)?h:x,u=3>arguments.length;return e(t,Ur(n,4),r,u,go)},At.reduceRight=function(t,n,r){var e=ai(t)?p:x,u=3>arguments.length;return e(t,Ur(n,4),r,u,yo); -},At.repeat=function(t,n,r){return n=(r?Hr(t,n,r):n===T)?1:Ge(n),$n(Qe(t),n)},At.replace=function(){var t=arguments,n=Qe(t[0]);return 3>t.length?n:Yu.call(n,t[1],t[2])},At.result=function(t,n,r){n=Qr(n,t)?[n]:nr(n);var e=-1,u=n.length;for(u||(t=T,u=1);++e0?t[Fn(0,n-1)]:T},At.size=function(t){if(null==t)return 0;if(We(t)){var n=t.length; -return n&&Ze(t)?N(t):n}return De(t)&&(n=Pr(t),"[object Map]"==n||"[object Set]"==n)?t.size:nu(t).length},At.snakeCase=Li,At.some=function(t,n,r){var e=ai(t)?_:Zn;return r&&Hr(t,n,r)&&(n=T),e(t,Ur(n,3))},At.sortedIndex=function(t,n){return Tn(t,n)},At.sortedIndexBy=function(t,n,r){return qn(t,n,Ur(r))},At.sortedIndexOf=function(t,n){var r=t?t.length:0;if(r){var e=Tn(t,n);if(r>e&&Se(t[e],n))return e}return-1},At.sortedLastIndex=function(t,n){return Tn(t,n,true)},At.sortedLastIndexBy=function(t,n,r){return qn(t,n,Ur(r),true); -},At.sortedLastIndexOf=function(t,n){if(t&&t.length){var r=Tn(t,n,true)-1;if(Se(t[r],n))return r}return-1},At.startCase=Mi,At.startsWith=function(t,n,r){return t=Qe(t),r=tn(Ge(r),0,t.length),t.lastIndexOf(Gn(n),r)==r},At.subtract=tf,At.sum=function(t){return t&&t.length?w(t,cu):0},At.sumBy=function(t,n){return t&&t.length?w(t,Ur(n)):0},At.template=function(t,n,r){var e=At.templateSettings;r&&Hr(t,n,r)&&(n=T),t=Qe(t),n=vi({},n,e,Tt),r=vi({},n.imports,e.imports,Tt);var u,o,i=nu(r),f=k(r,i),c=0;r=n.interpolate||wt; -var a="__p+='";r=gu((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=Ui(function(){return Function(i,l+"return "+a).apply(T,f)}),n.source=a,Le(n))throw n;return n},At.times=function(t,n){if(t=Ge(t),1>t||t>9007199254740991)return[];var r=4294967295,e=Ku(t,4294967295);for(n=Ur(n),t-=4294967295,e=m(e,n);++r=o)return t;if(o=r-N(e),1>o)return e;if(r=i?rr(i,0,o).join(""):t.slice(0,o),u===T)return r+e;if(i&&(o+=r.length-o),Pe(u)){if(t.slice(o).search(u)){var f=r;for(u.global||(u=gu(u.source,Qe(_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(Gn(u),o)!=o&&(u=r.lastIndexOf(u),u>-1&&(r=r.slice(0,u)));return r+e},At.unescape=function(t){return(t=Qe(t))&&Q.test(t)?t.replace(Y,P):t},At.uniqueId=function(t){ -var n=++mu;return Qe(t)+n},At.upperCase=Ci,At.upperFirst=zi,At.each=ye,At.eachRight=be,At.first=ae,lu(At,function(){var t={};return sn(At,function(n,r){wu.call(At.prototype,r)||(t[r]=n)}),t}(),{chain:false}),At.VERSION="4.12.0",u("bind bindKey curry curryRight partial partialRight".split(" "),function(t){At[t].placeholder=At}),u(["drop","take"],function(t,n){zt.prototype[t]=function(r){var e=this.__filtered__;if(e&&!n)return new zt(this);r=r===T?1:Vu(Ge(r),0);var u=this.clone();return e?u.__takeCount__=Ku(r,u.__takeCount__):u.__views__.push({ -size:Ku(r,4294967295),type:t+(0>u.__dir__?"Right":"")}),u},zt.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;zt.prototype[t]=function(t){var n=this.clone();return n.__iteratees__.push({iteratee:Ur(t,3),type:r}),n.__filtered__=n.__filtered__||e,n}}),u(["head","last"],function(t,n){var r="take"+(n?"Right":"");zt.prototype[t]=function(){return this[r](1).value()[0]}}),u(["initial","tail"],function(t,n){var r="drop"+(n?"":"Right"); -zt.prototype[t]=function(){return this.__filtered__?new zt(this):this[r](1)}}),zt.prototype.compact=function(){return this.filter(cu)},zt.prototype.find=function(t){return this.filter(t).head()},zt.prototype.findLast=function(t){return this.reverse().find(t)},zt.prototype.invokeMap=Ie(function(t,n){return typeof t=="function"?new zt(this):this.map(function(r){return jn(r,t,n)})}),zt.prototype.reject=function(t){return t=Ur(t,3),this.filter(function(n){return!t(n)})},zt.prototype.slice=function(t,n){ -t=Ge(t);var r=this;return r.__filtered__&&(t>0||0>n)?new zt(r):(0>t?r=r.takeRight(-t):t&&(r=r.drop(t)),n!==T&&(n=Ge(n),r=0>n?r.dropRight(-n):r.take(n-t)),r)},zt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},zt.prototype.toArray=function(){return this.take(4294967295)},sn(zt.prototype,function(t,n){var r=/^(?:filter|find|map|reject)|While$/.test(n),e=/^(?:head|last)$/.test(n),u=At[e?"take"+("last"==n?"Right":""):n],o=e||/^find/.test(n);u&&(At.prototype[n]=function(){ -function n(t){return t=u.apply(At,s([t],f)),e&&h?t[0]:t}var i=this.__wrapped__,f=e?[1]:arguments,c=i instanceof zt,a=f[0],l=c||ai(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 zt(this),i=t.apply(i,f),i.__actions__.push({func:ge,args:[n],thisArg:T}),new kt(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=yu[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",e=/^(?:pop|shift)$/.test(t); -At.prototype[t]=function(){var t=arguments;if(e&&!this.__chain__){var u=this.value();return n.apply(ai(u)?u:[],t)}return this[r](function(r){return n.apply(ai(r)?r:[],t)})}}),sn(zt.prototype,function(t,n){var r=At[n];if(r){var e=r.name+"";(fo[e]||(fo[e]=[])).push({name:n,func:r})}}),fo[jr(T,2).name]=[{name:"wrapper",func:T}],zt.prototype.clone=function(){var t=new zt(this.__wrapped__);return t.__actions__=cr(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=cr(this.__iteratees__), -t.__takeCount__=this.__takeCount__,t.__views__=cr(this.__views__),t},zt.prototype.reverse=function(){if(this.__filtered__){var t=new zt(this);t.__dir__=-1,t.__filtered__=true}else t=this.clone(),t.__dir__*=-1;return t},zt.prototype.value=function(){var t,n=this.__wrapped__.value(),r=this.__dir__,e=ai(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 Hn(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}},At.prototype.plant=function(t){for(var n,r=this;r instanceof Ot;){var e=ie(r);e.__index__=0,e.__values__=T,n?u.__wrapped__=e:n=e;var u=e,r=r.__wrapped__}return u.__wrapped__=t,n},At.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof zt?(this.__actions__.length&&(t=new zt(this)),t=t.reverse(),t.__actions__.push({func:ge, -args:[he],thisArg:T}),new kt(t,this.__chain__)):this.thru(he)},At.prototype.toJSON=At.prototype.valueOf=At.prototype.value=function(){return Hn(this.__wrapped__,this.__actions__)},Cu&&(At.prototype[Cu]=de),At}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)\]/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"),It=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),St=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 _ clearTimeout isFinite parseInt setTimeout".split(" "),Mt={}; +;(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(!Pe(t))return t;if(o=vi(t)){if(c=Vr(t),!n)return lr(t,c)}else{var a=Tr(t),l="[object Function]"==a||"[object GeneratorFunction]"==a;if(gi(t))return or(t,n);if("[object Object]"==a||"[object Arguments]"==a||l&&!i){if(C(t))return i?t:{};if(c=Kr(l?{}:t), +!n)return hr(t,Xt(c,t))}else{if(!Ct[a])return i?t:{};c=Gr(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,ou,Zr):ou(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=ou(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 Pe(t)?Zu(t):{}}function on(t,n,r){if(typeof t!="function")throw new mu("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&&Oo(t,n,ou)}function pn(t,n){return t&&ko(t,n,ou)}function _n(t,n){return f(n,function(n){return De(t[n])})}function vn(t,n){n=te(n,t)?[n]:er(n);for(var r=0,e=n.length;null!=t&&e>r;)t=t[ie(n[r++])];return r&&r==e?t:T}function gn(t,n,r){ +return n=n(t),vi(t)?n:s(n,r(t))}function dn(t,n){return t>n}function yn(t,n){return null!=t&&(Ru.call(t,n)||typeof t=="object"&&n in t&&null===Gu(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=Xu(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 te(n,t)||(n=er(n),t=oe(t,n),n=_e(n)),n=null==t?t:t[ie(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||!Pe(t)&&!Ze(n))n=t!==t&&n!==n;else t:{var o=vi(t),i=vi(n),f="[object Array]",c="[object Array]";o||(f=Tr(t),f="[object Arguments]"==f?"[object Object]":f),i||(c=Tr(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||Je(t)?Cr(t,n,mn,r,e,u):zr(t,n,f,mn,r,e,u);else{if(!(2&e)&&(o=a&&Ru.call(t,"__wrapped__"),f=i&&Ru.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=ou(t),i=f.length,c=ou(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=ze(t)?Array(t.length):[]; +return mo(t,function(t,u,o){e[++r]=n(t,u,o)}),e}function Rn(t){var n=Nr(t);return 1==n.length&&n[0][2]?ee(n[0][0],n[0][1]):function(r){return r===t||An(r,t,n)}}function Wn(t,n){return te(t)&&n===n&&!Pe(n)?ee(ie(t),n):function(r){var e=eu(r,t);return e===T&&e===n?uu(r,t):mn(n,e,T,3)}}function Bn(t,n,r,e,o){if(t!==n){if(!vi(n)&&!Je(n))var i=iu(n);u(i||n,function(u,f){if(i&&(f=u,u=n[f]),Pe(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, +vi(s)||Je(s)?vi(l)?h=l:Ue(l)?h=lr(l):(p=false,h=rn(s,true)):qe(s)||Ce(s)?Ce(l)?h=nu(l):!Pe(l)||r&&De(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,Qr(n,r)?t[n]:T):void 0}function Mn(t,n,r){var e=-1;return n=l(n.length?n:[hu],O(Dr())),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,iu,Wo),u=e.length,o={};++rn||n>9007199254740991)return r;do n%2&&(r+=t),(n=Ku(n/2))&&(t+=t);while(n);return r}function Zn(t,n,r,e){n=te(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&&!Ge(i)&&(r?n>=i:n>i)?e=o+1:u=o}return u} +return Kn(t,n,hu,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=Ge(n),a=n===T;o>u;){var l=Ku((u+o)/2),s=r(t[l]),h=s!==T,p=null===s,_=s===s,v=Ge(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 Xu(o,4294967294)}function Gn(t,n){for(var r=-1,e=t.length,u=0,o=[];++r=200){if(u=n?null:So(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 Ue(t)?t:[]}function er(t){return vi(t)?t:Mo(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 Du(n).set(new Du(t)),n}function fr(t,n){if(t!==n){var r=t!==T,e=null===t,u=t===t,o=Ge(t),i=n!==T,f=null===n,c=n===n,a=Ge(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=Qu(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=Qu(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&&Xr(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?Wr(t,n,mr,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 Le(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 mu("Expected a function");if(u&&!i&&"wrapper"==Ur(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),Wr(t,n,mr,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=Xu(f.length,x),m=lr(y);w--;){var A=f[w];y[w]=Qr(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 Ar(t,n){return function(r,e){return jn(r,t,n(e))}}function Or(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 kr(t){return Le(function(n){return n=1==n.length&&vi(n[0])?l(n[0],O(Dr())):l(sn(n,1,Hr),O(Dr())),Le(function(e){var u=this;return t(n,function(t){return r(t,u,e)})})})}function Er(t,n){n=n===T?" ":Yn(n);var r=n.length;return 2>r?r?Pn(n,t):n:(r=Pn(n,Vu(t/N(n))),Wt.test(n)?ur(r.match(It),0,t).join(""):r.slice(0,t))}function Sr(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:tu(e)||0;var u=-1;r=Qu(Vu((r-n)/(e||1)),0);for(var o=Array(r);r--;)o[t?r:++u]=n,n+=e;return o}}function Rr(t){return function(n,r){return typeof n=="string"&&typeof r=="string"||(n=tu(n),r=tu(r)),t(n,r)}}function Wr(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),ne(t)&&Lo(r,n),r.placeholder=e,r}function Br(t){var n=ju[t];return function(t,r){if(t=tu(t),r=Xu(Qe(r),292)){var e=(ru(t)+"e").split("e"),e=n(e[0]+"e"+(+e[1]+r)),e=(ru(e)+"e").split("e");return+(e[0]+"e"+(+e[1]-r))}return n(t)}}function Lr(t){return function(n){var r=Tr(n);return"[object Map]"==r?U(n):"[object Set]"==r?F(n):A(n,t(n))}}function Mr(t,n,r,e,u,o,i,f){var c=2&n;if(!c&&typeof t!="function")throw new mu("Expected a function");var a=e?e.length:0; +if(a||(n&=-97,e=u=T),i=i===T?i:Qu(Qe(i),0),f=f===T?f:Qe(f),a-=u?u.length:0,64&n){var l=e,s=u;e=u=T}var h=c?T:Io(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]:Xu(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:Qu(o[9]-a,0),!f&&24&n&&(n&=-25),(h?Eo:Lo)(n&&1!=n?8==n||16==n?jr(t,n,f):32!=n&&33!=n||u.length?mr.apply(T,o):Sr(t,n,r,e):dr(t,n,r),o)}function Cr(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 Xr(t,n,r){if(!Pe(r))return false;var e=typeof n;return("number"==e?ze(r)&&Qr(n,r.length):"string"==e&&n in r)?Me(r[n],t):false}function te(t,n){if(vi(t))return false;var r=typeof t;return"number"==r||"symbol"==r||"boolean"==r||null==t||Ge(t)?true:ut.test(t)||!et.test(t)||null!=n&&t in Object(n)}function ne(t){var n=Ur(t),r=Ot[n];return typeof r=="function"&&n in Ut.prototype?t===r?true:(n=Io(r), +!!n&&t===n[0]):false}function re(t){var n=t&&t.constructor;return t===(typeof n=="function"&&n.prototype||Ou)}function ee(t,n){return function(r){return null==r?false:r[t]===n&&(n!==T||t in Object(r))}}function ue(t,n,r,e,u,o){return Pe(t)&&Pe(n)&&Bn(t,n,T,ue,o.set(n,t)),t}function oe(t,n){return 1==n.length?t:vn(t,Tn(n,0,-1))}function ie(t){if(typeof t=="string"||Ge(t))return t;var n=t+"";return"0"==n&&1/t==-q?"-0":n}function fe(t){if(null!=t){try{return Iu.call(t)}catch(n){}return t+""}return""}function ce(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 ae(t,n,r){var e=t?t.length:0;return e?(n=r||n===T?1:Qe(n),Tn(t,0>n?0:n,e)):[]}function le(t,n,r){var e=t?t.length:0;return e?(n=r||n===T?1:Qe(n),n=e-n,Tn(t,0,0>n?0:n)):[]}function se(t,n,r){var e=t?t.length:0;return e?(r=null==r?0:Qe(r),0>r&&(r=Qu(e+r,0)),g(t,Dr(n,3),r)):-1}function he(t,n,r){var e=t?t.length:0;if(!e)return-1; +var u=e-1;return r!==T&&(u=Qe(r),u=0>r?Qu(e+u,0):Xu(u,e-1)),g(t,Dr(n,3),u,true)}function pe(t){return t&&t.length?t[0]:T}function _e(t){var n=t?t.length:0;return n?t[n-1]:T}function ve(t,n){return t&&t.length&&n&&n.length?Dn(t,n):t}function ge(t){return t?eo.call(t):t}function de(t){if(!t||!t.length)return[];var n=0;return t=f(t,function(t){return Ue(t)?(n=Qu(t.length,n),true):void 0}),m(n,function(n){return l(t,Un(n))})}function ye(t,n){if(!t||!t.length)return[];var e=de(t);return null==n?e:l(e,function(t){ +return r(n,T,t)})}function be(t){return t=Ot(t),t.__chain__=true,t}function xe(t,n){return n(t)}function je(){return this}function we(t,n){return(vi(t)?u:mo)(t,Dr(n,3))}function me(t,n){return(vi(t)?o:Ao)(t,Dr(n,3))}function Ae(t,n){return(vi(t)?l:In)(t,Dr(n,3))}function Oe(t,n,r){var e=-1,u=Ye(t),o=u.length,i=o-1;for(n=(r?Xr(t,n,r):n===T)?1:nn(Qe(n),0,o);++e=t&&(n=T),r}}function Ie(t,n,r){return n=r?T:n,t=Mr(t,8,T,T,T,T,T,n),t.placeholder=Ie.placeholder,t}function Re(t,n,r){return n=r?T:n,t=Mr(t,16,T,T,T,T,T,n),t.placeholder=Re.placeholder,t}function We(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=ke();if(u(t))return i(t);var r;r=t-_,t=n-(t-p),r=g?Xu(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=ke(),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 mu("Expected a function");return n=tu(n)||0,Pe(r)&&(v=!!r.leading,l=(g="maxWait"in r)?Qu(tu(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(ke())},f}function Be(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 mu("Expected a function");return r.cache=new(Be.Cache||Pt),r}function Le(t,n){if(typeof t!="function")throw new mu("Expected a function");return n=Qu(n===T?t.length-1:Qe(n),0),function(){for(var e=arguments,u=-1,o=Qu(e.length-n,0),i=Array(o);++u-1&&0==t%1&&9007199254740991>=t}function Pe(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function Ze(t){return!!t&&typeof t=="object"}function Te(t){return typeof t=="number"||Ze(t)&&"[object Number]"==Lu.call(t)}function qe(t){return!Ze(t)||"[object Object]"!=Lu.call(t)||C(t)?false:(t=Gu(Object(t)), +null===t?true:(t=Ru.call(t,"constructor")&&t.constructor,typeof t=="function"&&t instanceof t&&Iu.call(t)==Bu))}function Ve(t){return Pe(t)&&"[object RegExp]"==Lu.call(t)}function Ke(t){return typeof t=="string"||!vi(t)&&Ze(t)&&"[object String]"==Lu.call(t)}function Ge(t){return typeof t=="symbol"||Ze(t)&&"[object Symbol]"==Lu.call(t)}function Je(t){return Ze(t)&&Ne(t.length)&&!!Mt[Lu.call(t)]}function Ye(t){if(!t)return[];if(ze(t))return Ke(t)?t.match(It):lr(t);if(Pu&&t[Pu])return z(t[Pu]());var n=Tr(t); +return("[object Map]"==n?U:"[object Set]"==n?D:fu)(t)}function He(t){return t?(t=tu(t),t===q||t===-q?1.7976931348623157e308*(0>t?-1:1):t===t?t:0):0===t?t:0}function Qe(t){t=He(t);var n=t%1;return t===t?n?t-n:t:0}function Xe(t){return t?nn(Qe(t),0,4294967295):0}function tu(t){if(typeof t=="number")return t;if(Ge(t))return V;if(Pe(t)&&(t=De(t.valueOf)?t.valueOf():t,t=Pe(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 nu(t){return sr(t,iu(t))}function ru(t){return null==t?"":Yn(t)}function eu(t,n,r){return t=null==t?T:vn(t,n),t===T?r:t}function uu(t,n){return null!=t&&qr(t,n,bn)}function ou(t){var n=re(t);if(!n&&!ze(t))return Hu(Object(t));var r,e=Jr(t),u=!!e,e=e||[],o=e.length;for(r in t)!yn(t,r)||u&&("length"==r||Qr(r,o))||n&&"constructor"==r||e.push(r);return e}function iu(t){for(var n=-1,r=re(t),e=En(t),u=e.length,o=Jr(t),i=!!o,o=o||[],f=o.length;++nt?false:(t==n.length-1?n.pop():qu.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(io||Dt),string:new $t}},Pt.prototype["delete"]=function(t){return Fr(this,t)["delete"](t)},Pt.prototype.get=function(t){return Fr(this,t).get(t)},Pt.prototype.has=function(t){return Fr(this,t).has(t)},Pt.prototype.set=function(t,n){ +return Fr(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 mo=vr(hn),Ao=vr(pn,true),Oo=gr(),ko=gr(true);Fu&&!Tu.call({valueOf:1},"valueOf")&&(En=function(t){return z(Fu(t))});var Eo=so?function(t,n){return so.set(t,n),t}:hu,So=co&&1/D(new co([,-0]))[1]==q?function(t){return new co(t)}:vu,Io=so?function(t){return so.get(t)}:vu,Ro=Un("length");Nu||(Zr=du);var Wo=Nu?function(t){for(var n=[];t;)s(n,Zr(t)),t=Gu(Object(t));return n}:Zr;(oo&&"[object DataView]"!=Tr(new oo(new ArrayBuffer(1)))||io&&"[object Map]"!=Tr(new io)||fo&&"[object Promise]"!=Tr(fo.resolve())||co&&"[object Set]"!=Tr(new co)||ao&&"[object WeakMap]"!=Tr(new ao))&&(Tr=function(t){ +var n=Lu.call(t);if(t=(t="[object Object]"==n?t.constructor:T)?fe(t):T)switch(t){case _o:return"[object DataView]";case vo:return"[object Map]";case go:return"[object Promise]";case yo:return"[object Set]";case bo:return"[object WeakMap]"}return n});var Bo=Eu?De:yu,Lo=function(){var t=0,n=0;return function(r,e){var u=ke(),o=16-(u-n);if(n=u,o>0){if(150<=++t)return r}else t=0;return Eo(r,e)}}(),Mo=Be(function(t){var n=[];return ru(t).replace(ot,function(t,r,e,u){n.push(e?u.replace(ht,"$1"):r||t)}), +n}),Co=Le(function(t,n){return Ue(t)?fn(t,sn(n,1,Ue,true)):[]}),zo=Le(function(t,n){var r=_e(n);return Ue(r)&&(r=T),Ue(t)?fn(t,sn(n,1,Ue,true),Dr(r)):[]}),Uo=Le(function(t,n){var r=_e(n);return Ue(r)&&(r=T),Ue(t)?fn(t,sn(n,1,Ue,true),T,r):[]}),$o=Le(function(t){var n=l(t,rr);return n.length&&n[0]===t[0]?xn(n):[]}),Do=Le(function(t){var n=_e(t),r=l(t,rr);return n===_e(r)?n=T:r.pop(),r.length&&r[0]===t[0]?xn(r,Dr(n)):[]}),Fo=Le(function(t){var n=_e(t),r=l(t,rr);return n===_e(r)?n=T:r.pop(),r.length&&r[0]===t[0]?xn(r,T,n):[]; +}),No=Le(ve),Po=Le(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 Qr(t,r)?+t:t}).sort(fr)),e}),Zo=Le(function(t){return Hn(sn(t,1,Ue,true))}),To=Le(function(t){var n=_e(t);return Ue(n)&&(n=T),Hn(sn(t,1,Ue,true),Dr(n))}),qo=Le(function(t){var n=_e(t);return Ue(n)&&(n=T),Hn(sn(t,1,Ue,true),T,n)}),Vo=Le(function(t,n){return Ue(t)?fn(t,n):[]}),Ko=Le(function(t){return tr(f(t,Ue))}),Go=Le(function(t){var n=_e(t);return Ue(n)&&(n=T),tr(f(t,Ue),Dr(n))}),Jo=Le(function(t){ +var n=_e(t);return Ue(n)&&(n=T),tr(f(t,Ue),T,n)}),Yo=Le(de),Ho=Le(function(t){var n=t.length,n=n>1?t[n-1]:T,n=typeof n=="function"?(t.pop(),n):T;return ye(t,n)}),Qo=Le(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&&Qr(e)?(u=u.slice(e,+e+(r?1:0)),u.__actions__.push({func:xe,args:[n],thisArg:T}),new zt(u,this.__chain__).thru(function(t){return r&&!t.length&&t.push(T),t})):this.thru(n)}),Xo=pr(function(t,n,r){ +Ru.call(t,r)?++t[r]:t[r]=1}),ti=pr(function(t,n,r){Ru.call(t,r)?t[r].push(n):t[r]=[n]}),ni=Le(function(t,n,e){var u=-1,o=typeof n=="function",i=te(n),f=ze(t)?Array(t.length):[];return mo(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}),ri=pr(function(t,n,r){t[r]=n}),ei=pr(function(t,n,r){t[r?0:1].push(n)},function(){return[[],[]]}),ui=Le(function(t,n){if(null==t)return[];var r=n.length;return r>1&&Xr(t,n[0],n[1])?n=[]:r>2&&Xr(n[0],n[1],n[2])&&(n=[n[0]]),n=1==n.length&&vi(n[0])?n[0]:sn(n,1,Hr), +Mn(t,n,[])}),oi=Le(function(t,n,r){var e=1;if(r.length)var u=$(r,$r(oi)),e=32|e;return Mr(t,e,n,r,u)}),ii=Le(function(t,n,r){var e=3;if(r.length)var u=$(r,$r(ii)),e=32|e;return Mr(n,e,t,r,u)}),fi=Le(function(t,n){return on(t,1,n)}),ci=Le(function(t,n,r){return on(t,tu(n)||0,r)});Be.Cache=Pt;var ai=Le(function(t,n){n=1==n.length&&vi(n[0])?l(n[0],O(Dr())):l(sn(n,1,Hr),O(Dr()));var e=n.length;return Le(function(u){for(var o=-1,i=Xu(u.length,e);++o=n}),vi=Array.isArray,gi=zu?function(t){return t instanceof zu}:yu,di=Rr(Sn),yi=Rr(function(t,n){return n>=t}),bi=_r(function(t,n){if(ho||re(n)||ze(n))sr(n,ou(n),t);else for(var r in n)Ru.call(n,r)&&Yt(t,r,n[r])}),xi=_r(function(t,n){if(ho||re(n)||ze(n))sr(n,iu(n),t);else for(var r in n)Yt(t,r,n[r])}),ji=_r(function(t,n,r,e){ +sr(n,iu(n),t,e)}),wi=_r(function(t,n,r,e){sr(n,ou(n),t,e)}),mi=Le(function(t,n){return tn(t,sn(n,1))}),Ai=Le(function(t){return t.push(T,Vt),r(ji,T,t)}),Oi=Le(function(t){return t.push(T,ue),r(Ri,T,t)}),ki=Ar(function(t,n,r){t[n]=r},su(hu)),Ei=Ar(function(t,n,r){Ru.call(t,n)?t[n].push(r):t[n]=[r]},Dr),Si=Le(wn),Ii=_r(function(t,n,r){Bn(t,n,r)}),Ri=_r(function(t,n,r,e){Bn(t,n,r,e)}),Wi=Le(function(t,n){return null==t?{}:(n=l(sn(n,1),ie),Cn(t,fn(gn(t,iu,Wo),n)))}),Bi=Le(function(t,n){return null==t?{}:Cn(t,l(sn(n,1),ie)); +}),Li=Lr(ou),Mi=Lr(iu),Ci=br(function(t,n,r){return n=n.toLowerCase(),t+(r?cu(n):n)}),zi=br(function(t,n,r){return t+(r?"-":"")+n.toLowerCase()}),Ui=br(function(t,n,r){return t+(r?" ":"")+n.toLowerCase()}),$i=yr("toLowerCase"),Di=br(function(t,n,r){return t+(r?"_":"")+n.toLowerCase()}),Fi=br(function(t,n,r){return t+(r?" ":"")+Pi(n)}),Ni=br(function(t,n,r){return t+(r?" ":"")+n.toUpperCase()}),Pi=yr("toUpperCase"),Zi=Le(function(t,n){try{return r(t,T,n)}catch(e){return $e(e)?e:new xu(e)}}),Ti=Le(function(t,n){ +return u(sn(n,1),function(n){n=ie(n),t[n]=oi(t[n],t)}),t}),qi=wr(),Vi=wr(true),Ki=Le(function(t,n){return function(r){return wn(r,t,n)}}),Gi=Le(function(t,n){return function(r){return wn(t,r,n)}}),Ji=kr(l),Yi=kr(i),Hi=kr(_),Qi=Ir(),Xi=Ir(true),tf=Or(function(t,n){return t+n}),nf=Br("ceil"),rf=Or(function(t,n){return t/n}),ef=Br("floor"),uf=Or(function(t,n){return t*n}),of=Br("round"),ff=Or(function(t,n){return t-n});return Ot.after=function(t,n){if(typeof n!="function")throw new mu("Expected a function"); +return t=Qe(t),function(){return 1>--t?n.apply(this,arguments):void 0}},Ot.ary=Ee,Ot.assign=bi,Ot.assignIn=xi,Ot.assignInWith=ji,Ot.assignWith=wi,Ot.at=mi,Ot.before=Se,Ot.bind=oi,Ot.bindAll=Ti,Ot.bindKey=ii,Ot.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return vi(t)?t:[t]},Ot.chain=be,Ot.chunk=function(t,n,r){if(n=(r?Xr(t,n,r):n===T)?1:Qu(Qe(n),0),r=t?t.length:0,!r||1>n)return[];for(var e=0,u=0,o=Array(Vu(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:Qe(e),0>e&&(e+=u),e=r>e?0:Xe(e);e>r;)t[r++]=n;return t},Ot.filter=function(t,n){return(vi(t)?f:ln)(t,Dr(n,3))},Ot.flatMap=function(t,n){return sn(Ae(t,n),1)},Ot.flatMapDeep=function(t,n){return sn(Ae(t,n),q)},Ot.flatMapDepth=function(t,n,r){return r=r===T?1:Qe(r),sn(Ae(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:Qe(n),sn(t,n)):[]; +},Ot.flip=function(t){return Mr(t,512)},Ot.flow=qi,Ot.flowRight=Vi,Ot.fromPairs=function(t){for(var n=-1,r=t?t.length:0,e={};++n>>0,r?(t=ru(t))&&(typeof n=="string"||null!=n&&!Ve(n))&&(n=Yn(n),""==n&&Wt.test(t))?ur(t.match(It),0,r):uo.call(t,n,r):[]},Ot.spread=function(t,n){if(typeof t!="function")throw new mu("Expected a function");return n=n===T?0:Qu(Qe(n),0),Le(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 ae(t,1)},Ot.take=function(t,n,r){return t&&t.length?(n=r||n===T?1:Qe(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:Qe(n),n=e-n,Tn(t,0>n?0:n,e)):[]},Ot.takeRightWhile=function(t,n){return t&&t.length?Qn(t,Dr(n,3),false,true):[]},Ot.takeWhile=function(t,n){return t&&t.length?Qn(t,Dr(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 mu("Expected a function");return Pe(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),We(t,n,{leading:e,maxWait:n, +trailing:u})},Ot.thru=xe,Ot.toArray=Ye,Ot.toPairs=Li,Ot.toPairsIn=Mi,Ot.toPath=function(t){return vi(t)?l(t,ie):Ge(t)?[t]:lr(Mo(t))},Ot.toPlainObject=nu,Ot.transform=function(t,n,r){var e=vi(t)||Je(t);if(n=Dr(n,4),null==r)if(e||Pe(t)){var o=t.constructor;r=e?vi(t)?new o:[]:De(o)?un(Gu(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 Ee(t,1)},Ot.union=Zo,Ot.unionBy=To,Ot.unionWith=qo,Ot.uniq=function(t){return t&&t.length?Hn(t):[]},Ot.uniqBy=function(t,n){ +return t&&t.length?Hn(t,Dr(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=te(e,r)?[e]:er(e);r=oe(r,e),e=ie(_e(e)),r=!(null!=r&&yn(r,e))||delete r[e]}return r},Ot.unzip=de,Ot.unzipWith=ye,Ot.update=function(t,n,r){return null==t?t:Zn(t,n,(typeof r=="function"?r:hu)(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:hu)(vn(t,n)),e)),t},Ot.values=fu, +Ot.valuesIn=function(t){return null==t?[]:k(t,iu(t))},Ot.without=Vo,Ot.words=lu,Ot.wrap=function(t,n){return n=null==n?hu:n,li(n,t)},Ot.xor=Ko,Ot.xorBy=Go,Ot.xorWith=Jo,Ot.zip=Yo,Ot.zipObject=function(t,n){return nr(t||[],n||[],Yt)},Ot.zipObjectDeep=function(t,n){return nr(t||[],n||[],Zn)},Ot.zipWith=Ho,Ot.entries=Li,Ot.entriesIn=Mi,Ot.extend=xi,Ot.extendWith=ji,_u(Ot,Ot),Ot.add=tf,Ot.attempt=Zi,Ot.camelCase=Ci,Ot.capitalize=cu,Ot.ceil=nf,Ot.clamp=function(t,n,r){return r===T&&(r=n,n=T),r!==T&&(r=tu(r), +r=r===r?r:0),n!==T&&(n=tu(n),n=n===n?n:0),nn(tu(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=au,Ot.divide=rf,Ot.endsWith=function(t,n,r){t=ru(t),n=Yn(n);var e=t.length;return r=r===T?e:nn(Qe(r),0,e),r-=n.length,r>=0&&t.indexOf(n,r)==r},Ot.eq=Me,Ot.escape=function(t){return(t=ru(t))&&X.test(t)?t.replace(H,B):t},Ot.escapeRegExp=function(t){ +return(t=ru(t))&&ft.test(t)?t.replace(it,"\\$&"):t},Ot.every=function(t,n,r){var e=vi(t)?i:cn;return r&&Xr(t,n,r)&&(n=T),e(t,Dr(n,3))},Ot.find=function(t,n,r){return t=ze(t)?t:fu(t),n=se(t,n,r),n>-1?t[n]:T},Ot.findIndex=se,Ot.findKey=function(t,n){return v(t,Dr(n,3),hn)},Ot.findLast=function(t,n,r){return t=ze(t)?t:fu(t),n=he(t,n,r),n>-1?t[n]:T},Ot.findLastIndex=he,Ot.findLastKey=function(t,n){return v(t,Dr(n,3),pn)},Ot.floor=ef,Ot.forEach=we,Ot.forEachRight=me,Ot.forIn=function(t,n){return null==t?t:Oo(t,Dr(n,3),iu); +},Ot.forInRight=function(t,n){return null==t?t:ko(t,Dr(n,3),iu)},Ot.forOwn=function(t,n){return t&&hn(t,Dr(n,3))},Ot.forOwnRight=function(t,n){return t&&pn(t,Dr(n,3))},Ot.get=eu,Ot.gt=pi,Ot.gte=_i,Ot.has=function(t,n){return null!=t&&qr(t,n,yn)},Ot.hasIn=uu,Ot.head=pe,Ot.identity=hu,Ot.includes=function(t,n,r,e){return t=ze(t)?t:fu(t),r=r&&!e?Qe(r):0,e=t.length,0>r&&(r=Qu(e+r,0)),Ke(t)?e>=r&&-1r&&(r=Qu(e+r,0)),d(t,n,r)):-1},Ot.inRange=function(t,n,r){return n=tu(n)||0,r===T?(r=n,n=0):r=tu(r)||0,t=tu(t),t>=Xu(n,r)&&t=-9007199254740991&&9007199254740991>=t},Ot.isSet=function(t){return Ze(t)&&"[object Set]"==Tr(t)},Ot.isString=Ke,Ot.isSymbol=Ge,Ot.isTypedArray=Je,Ot.isUndefined=function(t){return t===T},Ot.isWeakMap=function(t){return Ze(t)&&"[object WeakMap]"==Tr(t)},Ot.isWeakSet=function(t){return Ze(t)&&"[object WeakSet]"==Lu.call(t)},Ot.join=function(t,n){return t?Yu.call(t,n):""},Ot.kebabCase=zi,Ot.last=_e,Ot.lastIndexOf=function(t,n,r){var e=t?t.length:0; +if(!e)return-1;var u=e;if(r!==T&&(u=Qe(r),u=(0>u?Qu(e+u,0):Xu(u,e-1))+1),n!==n)return M(t,u-1,true);for(;u--;)if(t[u]===n)return u;return-1},Ot.lowerCase=Ui,Ot.lowerFirst=$i,Ot.lt=di,Ot.lte=yi,Ot.max=function(t){return t&&t.length?an(t,hu,dn):T},Ot.maxBy=function(t,n){return t&&t.length?an(t,Dr(n),dn):T},Ot.mean=function(t){return b(t,hu)},Ot.meanBy=function(t,n){return b(t,Dr(n))},Ot.min=function(t){return t&&t.length?an(t,hu,Sn):T},Ot.minBy=function(t,n){return t&&t.length?an(t,Dr(n),Sn):T},Ot.stubArray=du, +Ot.stubFalse=yu,Ot.stubObject=function(){return{}},Ot.stubString=function(){return""},Ot.stubTrue=function(){return true},Ot.multiply=uf,Ot.nth=function(t,n){return t&&t.length?Ln(t,Qe(n)):T},Ot.noConflict=function(){return Kt._===this&&(Kt._=Mu),this},Ot.noop=vu,Ot.now=ke,Ot.pad=function(t,n,r){t=ru(t);var e=(n=Qe(n))?N(t):0;return!n||e>=n?t:(n=(n-e)/2,Er(Ku(n),r)+t+Er(Vu(n),r))},Ot.padEnd=function(t,n,r){t=ru(t);var e=(n=Qe(n))?N(t):0;return n&&n>e?t+Er(n-e,r):t},Ot.padStart=function(t,n,r){t=ru(t); +var e=(n=Qe(n))?N(t):0;return n&&n>e?Er(n-e,r)+t:t},Ot.parseInt=function(t,n,r){return r||null==n?n=0:n&&(n=+n),t=ru(t).replace(ct,""),to(t,n||(vt.test(t)?16:10))},Ot.random=function(t,n,r){if(r&&typeof r!="boolean"&&Xr(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=tu(t)||0,n===T?(n=t,t=0):n=tu(n)||0),t>n){var e=t;t=n,n=e}return r||t%1||n%1?(r=no(),Xu(t+r*(n-t+Ft("1e-"+((r+"").length-1))),n)):Nn(t,n)},Ot.reduce=function(t,n,r){var e=vi(t)?h:x,u=3>arguments.length; +return e(t,Dr(n,4),r,u,mo)},Ot.reduceRight=function(t,n,r){var e=vi(t)?p:x,u=3>arguments.length;return e(t,Dr(n,4),r,u,Ao)},Ot.repeat=function(t,n,r){return n=(r?Xr(t,n,r):n===T)?1:Qe(n),Pn(ru(t),n)},Ot.replace=function(){var t=arguments,n=ru(t[0]);return 3>t.length?n:ro.call(n,t[1],t[2])},Ot.result=function(t,n,r){n=te(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(ze(t)){var n=t.length;return n&&Ke(t)?N(t):n}return Ze(t)&&(n=Tr(t),"[object Map]"==n||"[object Set]"==n)?t.size:ou(t).length},Ot.snakeCase=Di,Ot.some=function(t,n,r){var e=vi(t)?_:qn;return r&&Xr(t,n,r)&&(n=T),e(t,Dr(n,3))},Ot.sortedIndex=function(t,n){return Vn(t,n)},Ot.sortedIndexBy=function(t,n,r){return Kn(t,n,Dr(r))},Ot.sortedIndexOf=function(t,n){var r=t?t.length:0;if(r){var e=Vn(t,n);if(r>e&&Me(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,Dr(r),true)},Ot.sortedLastIndexOf=function(t,n){if(t&&t.length){var r=Vn(t,n,true)-1;if(Me(t[r],n))return r}return-1},Ot.startCase=Fi,Ot.startsWith=function(t,n,r){return t=ru(t),r=nn(Qe(r),0,t.length),t.lastIndexOf(Yn(n),r)==r},Ot.subtract=ff,Ot.sum=function(t){return t&&t.length?w(t,hu):0},Ot.sumBy=function(t,n){return t&&t.length?w(t,Dr(n)):0},Ot.template=function(t,n,r){var e=Ot.templateSettings; +r&&Xr(t,n,r)&&(n=T),t=ru(t),n=ji({},n,e,Vt),r=ji({},n.imports,e.imports,Vt);var u,o,i=ou(r),f=k(r,i),c=0;r=n.interpolate||wt;var a="__p+='";r=wu((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=Zi(function(){return Function(i,l+"return "+a).apply(T,f)}),n.source=a,$e(n))throw n;return n},Ot.times=function(t,n){if(t=Qe(t),1>t||t>9007199254740991)return[];var r=4294967295,e=Xu(t,4294967295);for(n=Dr(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),Ve(u)){if(t.slice(o).search(u)){var f=r;for(u.global||(u=wu(u.source,ru(_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=ru(t))&&Q.test(t)?t.replace(Y,P):t},Ot.uniqueId=function(t){var n=++Wu;return ru(t)+n},Ot.upperCase=Ni,Ot.upperFirst=Pi,Ot.each=we,Ot.eachRight=me,Ot.first=pe,_u(Ot,function(){var t={};return hn(Ot,function(n,r){ +Ru.call(Ot.prototype,r)||(t[r]=n)}),t}(),{chain:false}),Ot.VERSION="4.13.0",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:Qu(Qe(r),0);var u=this.clone();return e?u.__takeCount__=Xu(r,u.__takeCount__):u.__views__.push({size:Xu(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:Dr(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(hu)},Ut.prototype.find=function(t){return this.filter(t).head()},Ut.prototype.findLast=function(t){return this.reverse().find(t)},Ut.prototype.invokeMap=Le(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=Dr(t,3),this.filter(function(n){return!t(n)})},Ut.prototype.slice=function(t,n){t=Qe(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=Qe(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||vi(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:xe,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=Au[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(vi(u)?u:[],t)}return this[r](function(r){return n.apply(vi(r)?r:[],t)})}}),hn(Ut.prototype,function(t,n){var r=Ot[n];if(r){var e=r.name+"";(po[e]||(po[e]=[])).push({name:n,func:r})}}),po[mr(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=vi(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=ce(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:xe,args:[ge],thisArg:T}),new zt(t,this.__chain__)):this.thru(ge); +},Ot.prototype.toJSON=Ot.prototype.valueOf=Ot.prototype.value=function(){return Xn(this.__wrapped__,this.__actions__)},Pu&&(Ot.prototype[Pu]=je),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={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Dt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ft={"function":true,object:true},$t={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029" -},Nt=parseFloat,Pt=parseInt,Zt=Ft[typeof exports]&&exports&&!exports.nodeType?exports:T,Tt=Ft[typeof module]&&module&&!module.nodeType?module:T,qt=Tt&&Tt.exports===Zt?Zt:T,Vt=R(Ft[typeof self]&&self),Kt=R(Ft[typeof window]&&window),Gt=R(Ft[typeof this]&&this),Jt=R(Zt&&Tt&&typeof global=="object"&&global)||Kt!==(Gt&&Gt.window)&&Kt||Vt||Gt||Function("return this")(),Yt=Z();(Kt||Vt||{})._=Yt,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){return Yt}):Zt&&Tt?(qt&&((Tt.exports=Yt)._=Yt), -Zt._=Yt):Jt._=Yt}).call(this); \ No newline at end of file +"\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 diff --git a/dist/mapping.fp.js b/dist/mapping.fp.js index f74fb2acf9..abf71920f9 100644 --- a/dist/mapping.fp.js +++ b/dist/mapping.fp.js @@ -140,12 +140,13 @@ return /******/ (function(modules) { // webpackBootstrap ], '3': [ 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith', - 'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'invokeArgs', - 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth', 'mergeWith', - 'orderBy', 'padChars', 'padCharsEnd', 'padCharsStart', 'pullAllBy', - 'pullAllWith', 'reduce', 'reduceRight', 'replace', 'set', 'slice', - 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', - 'update', 'xorBy', 'xorWith', 'zipWith' + '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' @@ -166,10 +167,14 @@ return /******/ (function(modules) { // webpackBootstrap '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, @@ -204,7 +209,11 @@ return /******/ (function(modules) { // webpackBootstrap exports.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], @@ -216,7 +225,11 @@ return /******/ (function(modules) { // webpackBootstrap '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] }; @@ -291,9 +304,16 @@ return /******/ (function(modules) { // webpackBootstrap exports.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', @@ -340,7 +360,6 @@ return /******/ (function(modules) { // webpackBootstrap 'range': true, 'rangeRight': true, 'subtract': true, - 'without': true, 'zip': true, 'zipObject': true }; diff --git a/doc/README.md b/doc/README.md index 066750e240..8624ce4c07 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,4 +1,4 @@ -# lodash v4.12.0 +# lodash v4.13.0 @@ -16,8 +16,8 @@ * `_.dropRightWhile` * `_.dropWhile` * `_.fill` -* `_.findIndex` -* `_.findLastIndex` +* `_.findIndex` +* `_.findLastIndex` * `_.first` -> `head` * `_.flatten` * `_.flattenDeep` @@ -81,8 +81,8 @@ * `_.eachRight` -> `forEachRight` * `_.every` * `_.filter` -* `_.find` -* `_.findLast` +* `_.find` +* `_.findLast` * `_.flatMap` * `_.flatMapDeep` * `_.flatMapDepth` @@ -371,6 +371,11 @@ * `_.range` * `_.rangeRight` * `_.runInContext` +* `_.stubArray` +* `_.stubFalse` +* `_.stubObject` +* `_.stubString` +* `_.stubTrue` * `_.times` * `_.toPath` * `_.uniqueId` @@ -408,7 +413,7 @@ ### `_.chunk(array, [size=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6050 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.chunk "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6093 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.chunk "See the npm package") 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 @@ -438,7 +443,7 @@ _.chunk(['a', 'b', 'c', 'd'], 3); ### `_.compact(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6085 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.compact "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6128 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.compact "See the npm package") Creates an array with all falsey values removed. The values `false`, `null`, `0`, `""`, `undefined`, and `NaN` are falsey. @@ -463,7 +468,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.concat(array, [values])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6122 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.concat "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6165 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.concat "See the npm package") Creates a new array concatenating `array` with any additional arrays and/or values. @@ -495,7 +500,7 @@ console.log(array); ### `_.difference(array, [values])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6155 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.difference "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6198 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.difference "See the npm package") 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) @@ -513,8 +518,8 @@ order they occur in the first array. #### Example ```js -_.difference([3, 2, 1], [4, 2]); -// => [3, 1] +_.difference([2, 1], [2, 3]); +// => [1] ``` * * * @@ -523,7 +528,7 @@ _.difference([3, 2, 1], [4, 2]); ### `_.differenceBy(array, [values], [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6185 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.differenceby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6228 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.differenceby "See the npm package") This method is like `_.difference` except that it accepts `iteratee` which is invoked for each element of `array` and `values` to generate the criterion @@ -542,8 +547,8 @@ The iteratee is invoked with one argument: *(value)*. #### Example ```js -_.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor); -// => [3.1, 1.3] +_.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); +// => [1.2] // The `_.property` iteratee shorthand. _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); @@ -556,7 +561,7 @@ _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); ### `_.differenceWith(array, [values], [comparator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6216 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.differencewith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6259 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.differencewith "See the npm package") This method is like `_.difference` except that it accepts `comparator` which is invoked to compare elements of `array` to `values`. Result values @@ -587,7 +592,7 @@ _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual); ### `_.drop(array, [n=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6251 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.drop "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6294 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.drop "See the npm package") Creates a slice of `array` with `n` elements dropped from the beginning. @@ -621,7 +626,7 @@ _.drop([1, 2, 3], 0); ### `_.dropRight(array, [n=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6285 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6328 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropright "See the npm package") Creates a slice of `array` with `n` elements dropped from the end. @@ -655,7 +660,7 @@ _.dropRight([1, 2, 3], 0); ### `_.dropRightWhile(array, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6331 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.droprightwhile "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6374 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.droprightwhile "See the npm package") Creates a slice of `array` excluding elements dropped from the end. Elements are dropped until `predicate` returns falsey. The predicate is @@ -700,7 +705,7 @@ _.dropRightWhile(users, 'active'); ### `_.dropWhile(array, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6373 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropwhile "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6416 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropwhile "See the npm package") Creates a slice of `array` excluding elements dropped from the beginning. Elements are dropped until `predicate` returns falsey. The predicate is @@ -745,7 +750,7 @@ _.dropWhile(users, 'active'); ### `_.fill(array, value, [start=0], [end=array.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6408 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.fill "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6451 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.fill "See the npm package") Fills elements of `array` with `value` from `start` up to, but not including, `end`. @@ -784,8 +789,8 @@ _.fill([4, 6, 8, 10], '*', 1, 3); -### `_.findIndex(array, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6455 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findindex "See the npm package") +### `_.findIndex(array, [predicate=_.identity], [fromIndex=0])` +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6499 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findindex "See the npm package") This method is like `_.find` except that it returns the index of the first element `predicate` returns truthy for instead of the element itself. @@ -795,6 +800,7 @@ element `predicate` returns truthy for instead of the element itself. #### Arguments 1. `array` *(Array)*: The array to search. 2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration. +3. `[fromIndex=0]` *(number)*: The index to search from. #### Returns *(number)*: Returns the index of the found element, else `-1`. @@ -828,8 +834,8 @@ _.findIndex(users, 'active'); -### `_.findLastIndex(array, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6496 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastindex "See the npm package") +### `_.findLastIndex(array, [predicate=_.identity], [fromIndex=array.length-1])` +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6547 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastindex "See the npm package") This method is like `_.findIndex` except that it iterates over elements of `collection` from right to left. @@ -839,6 +845,7 @@ of `collection` from right to left. #### Arguments 1. `array` *(Array)*: The array to search. 2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration. +3. `[fromIndex=array.length-1]` *(number)*: The index to search from. #### Returns *(number)*: Returns the index of the found element, else `-1`. @@ -873,7 +880,7 @@ _.findLastIndex(users, 'active'); ### `_.flatten(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6516 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatten "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6576 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatten "See the npm package") Flattens `array` a single level deep. @@ -897,7 +904,7 @@ _.flatten([1, [2, [3, [4]], 5]]); ### `_.flattenDeep(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6535 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendeep "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6595 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendeep "See the npm package") Recursively flattens `array`. @@ -921,7 +928,7 @@ _.flattenDeep([1, [2, [3, [4]], 5]]); ### `_.flattenDepth(array, [depth=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6560 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendepth "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6620 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendepth "See the npm package") Recursively flatten `array` up to `depth` times. @@ -951,7 +958,7 @@ _.flattenDepth(array, 2); ### `_.fromPairs(pairs)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6584 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.frompairs "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6644 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.frompairs "See the npm package") The inverse of `_.toPairs`; this method returns an object composed from key-value `pairs`. @@ -976,7 +983,7 @@ _.fromPairs([['fred', 30], ['barney', 40]]); ### `_.head(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6614 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.head "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6674 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.head "See the npm package") Gets the first element of `array`. @@ -1006,7 +1013,7 @@ _.head([]); ### `_.indexOf(array, value, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6641 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.indexof "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6701 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.indexof "See the npm package") 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,7 +1046,7 @@ _.indexOf([1, 2, 1, 2], 2, 2); ### `_.initial(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6667 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.initial "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6727 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.initial "See the npm package") Gets all but the last element of `array`. @@ -1063,7 +1070,7 @@ _.initial([1, 2, 3]); ### `_.intersection([arrays])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6688 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersection "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6748 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersection "See the npm package") 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) @@ -1080,7 +1087,7 @@ order they occur in the first array. #### Example ```js -_.intersection([2, 1], [4, 2], [1, 2]); +_.intersection([2, 1], [2, 3]); // => [2] ``` * * * @@ -1090,7 +1097,7 @@ _.intersection([2, 1], [4, 2], [1, 2]); ### `_.intersectionBy([arrays], [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6718 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersectionby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6778 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersectionby "See the npm package") 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 +1115,7 @@ The iteratee is invoked with one argument: *(value)*. #### Example ```js -_.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); +_.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); // => [2.1] // The `_.property` iteratee shorthand. @@ -1122,7 +1129,7 @@ _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); ### `_.intersectionWith([arrays], [comparator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6753 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersectionwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6813 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersectionwith "See the npm package") This method is like `_.intersection` except that it accepts `comparator` which is invoked to compare elements of `arrays`. Result values are chosen @@ -1153,7 +1160,7 @@ _.intersectionWith(objects, others, _.isEqual); ### `_.join(array, [separator=','])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6782 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.join "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6842 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.join "See the npm package") Converts all elements in `array` into a string separated by `separator`. @@ -1178,7 +1185,7 @@ _.join(['a', 'b', 'c'], '~'); ### `_.last(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6800 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.last "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6860 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.last "See the npm package") Gets the last element of `array`. @@ -1202,7 +1209,7 @@ _.last([1, 2, 3]); ### `_.lastIndexOf(array, value, [fromIndex=array.length-1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6826 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lastindexof "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6886 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lastindexof "See the npm package") This method is like `_.indexOf` except that it iterates over elements of `array` from right to left. @@ -1233,9 +1240,9 @@ _.lastIndexOf([1, 2, 1, 2], 2, 2); ### `_.nth(array, [n=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6872 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.nth "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6932 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.nth "See the npm package") -Gets the element at `n` index of `array`. If `n` is negative, the nth +Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned. #### Since @@ -1264,7 +1271,7 @@ _.nth(array, -2); ### `_.pull(array, [values])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6899 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pull "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6959 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pull "See the npm package") Removes all given values from `array` using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) @@ -1285,11 +1292,11 @@ to remove elements from an array by predicate. #### Example ```js -var array = [1, 2, 3, 1, 2, 3]; +var array = ['a', 'b', 'c', 'a', 'b', 'c']; -_.pull(array, 2, 3); +_.pull(array, 'a', 'c'); console.log(array); -// => [1, 1] +// => ['b', 'b'] ``` * * * @@ -1298,7 +1305,7 @@ console.log(array); ### `_.pullAll(array, values)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6921 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullall "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L6981 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullall "See the npm package") This method is like `_.pull` except that it accepts an array of values to remove.
@@ -1316,11 +1323,11 @@ This method is like `_.pull` except that it accepts an array of values to remove #### Example ```js -var array = [1, 2, 3, 1, 2, 3]; +var array = ['a', 'b', 'c', 'a', 'b', 'c']; -_.pullAll(array, [2, 3]); +_.pullAll(array, ['a', 'c']); console.log(array); -// => [1, 1] +// => ['b', 'b'] ``` * * * @@ -1329,7 +1336,7 @@ console.log(array); ### `_.pullAllBy(array, values, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6951 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullallby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7011 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullallby "See the npm package") This method is like `_.pullAll` except that it accepts `iteratee` which is invoked for each element of `array` and `values` to generate the criterion @@ -1363,7 +1370,7 @@ console.log(array); ### `_.pullAllWith(array, values, [comparator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L6980 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullallwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7040 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullallwith "See the npm package") This method is like `_.pullAll` except that it accepts `comparator` which is invoked to compare elements of `array` to `values`. The comparator is @@ -1397,7 +1404,7 @@ console.log(array); ### `_.pullAt(array, [indexes])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7010 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullat "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7070 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullat "See the npm package") Removes elements from `array` corresponding to `indexes` and returns an array of removed elements. @@ -1416,14 +1423,14 @@ array of removed elements. #### Example ```js -var array = [5, 10, 15, 20]; -var evens = _.pullAt(array, 1, 3); +var array = ['a', 'b', 'c', 'd']; +var pulled = _.pullAt(array, [1, 3]); console.log(array); -// => [5, 15] +// => ['a', 'c'] -console.log(evens); -// => [10, 20] +console.log(pulled); +// => ['b', 'd'] ``` * * * @@ -1432,7 +1439,7 @@ console.log(evens); ### `_.remove(array, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7052 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.remove "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7112 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.remove "See the npm package") Removes all elements from `array` that `predicate` returns truthy for and returns an array of the removed elements. The predicate is invoked @@ -1471,7 +1478,7 @@ console.log(evens); ### `_.reverse(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7096 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reverse "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7156 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reverse "See the npm package") Reverses `array` so that the first element becomes the last, the second element becomes the second to last, and so on. @@ -1505,7 +1512,7 @@ console.log(array); ### `_.slice(array, [start=0], [end=array.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7116 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.slice "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7176 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.slice "See the npm package") Creates a slice of `array` from `start` up to, but not including, `end`.
@@ -1531,7 +1538,7 @@ returned. ### `_.sortedIndex(array, value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7152 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindex "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7209 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindex "See the npm package") Uses a binary search to determine the lowest index at which `value` should be inserted into `array` in order to maintain its sort order. @@ -1549,9 +1556,6 @@ should be inserted into `array` in order to maintain its sort order. ```js _.sortedIndex([30, 50], 40); // => 1 - -_.sortedIndex([4, 5], 4); -// => 0 ``` * * * @@ -1560,7 +1564,7 @@ _.sortedIndex([4, 5], 4); ### `_.sortedIndexBy(array, value, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7182 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7239 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexby "See the npm package") This method is like `_.sortedIndex` except that it accepts `iteratee` which is invoked for `value` and each element of `array` to compute their @@ -1578,13 +1582,13 @@ sort ranking. The iteratee is invoked with one argument: *(value)*. #### Example ```js -var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; +var objects = [{ 'x': 4 }, { 'x': 5 }]; -_.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); -// => 1 +_.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); +// => 0 // The `_.property` iteratee shorthand. -_.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); +_.sortedIndexBy(objects, { 'x': 4 }, 'x'); // => 0 ``` * * * @@ -1594,7 +1598,7 @@ _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); ### `_.sortedIndexOf(array, value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7202 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexof "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7259 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexof "See the npm package") This method is like `_.indexOf` except that it performs a binary search on a sorted `array`. @@ -1610,8 +1614,8 @@ search on a sorted `array`. #### Example ```js -_.sortedIndexOf([1, 1, 2, 2], 2); -// => 2 +_.sortedIndexOf([4, 5, 5, 5, 6], 5); +// => 1 ``` * * * @@ -1620,7 +1624,7 @@ _.sortedIndexOf([1, 1, 2, 2], 2); ### `_.sortedLastIndex(array, value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7231 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindex "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7288 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindex "See the npm package") This method is like `_.sortedIndex` except that it returns the highest index at which `value` should be inserted into `array` in order to @@ -1637,8 +1641,8 @@ maintain its sort order. #### Example ```js -_.sortedLastIndex([4, 5], 4); -// => 1 +_.sortedLastIndex([4, 5, 5, 5, 6], 5); +// => 4 ``` * * * @@ -1647,7 +1651,7 @@ _.sortedLastIndex([4, 5], 4); ### `_.sortedLastIndexBy(array, value, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7256 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7318 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexby "See the npm package") This method is like `_.sortedLastIndex` except that it accepts `iteratee` which is invoked for `value` and each element of `array` to compute their @@ -1665,8 +1669,13 @@ sort ranking. The iteratee is invoked with one argument: *(value)*. #### Example ```js +var objects = [{ 'x': 4 }, { 'x': 5 }]; + +_.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); +// => 1 + // The `_.property` iteratee shorthand. -_.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); +_.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); // => 1 ``` * * * @@ -1676,7 +1685,7 @@ _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); ### `_.sortedLastIndexOf(array, value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7276 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexof "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7338 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexof "See the npm package") This method is like `_.lastIndexOf` except that it performs a binary search on a sorted `array`. @@ -1692,7 +1701,7 @@ search on a sorted `array`. #### Example ```js -_.sortedLastIndexOf([1, 1, 2, 2], 2); +_.sortedLastIndexOf([4, 5, 5, 5, 6], 5); // => 3 ``` * * * @@ -1702,7 +1711,7 @@ _.sortedLastIndexOf([1, 1, 2, 2], 2); ### `_.sortedUniq(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7302 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniq "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7364 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniq "See the npm package") This method is like `_.uniq` except that it's designed and optimized for sorted arrays. @@ -1727,7 +1736,7 @@ _.sortedUniq([1, 1, 2]); ### `_.sortedUniqBy(array, [iteratee])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7324 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniqby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7386 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniqby "See the npm package") This method is like `_.uniqBy` except that it's designed and optimized for sorted arrays. @@ -1753,7 +1762,7 @@ _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); ### `_.tail(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7344 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tail "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7406 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tail "See the npm package") Gets all but the first element of `array`. @@ -1777,7 +1786,7 @@ _.tail([1, 2, 3]); ### `_.take(array, [n=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7373 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.take "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7435 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.take "See the npm package") Creates a slice of `array` with `n` elements taken from the beginning. @@ -1811,7 +1820,7 @@ _.take([1, 2, 3], 0); ### `_.takeRight(array, [n=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7406 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takeright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7468 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takeright "See the npm package") Creates a slice of `array` with `n` elements taken from the end. @@ -1845,7 +1854,7 @@ _.takeRight([1, 2, 3], 0); ### `_.takeRightWhile(array, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7452 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takerightwhile "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7514 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takerightwhile "See the npm package") Creates a slice of `array` with elements taken from the end. Elements are taken until `predicate` returns falsey. The predicate is invoked with @@ -1890,7 +1899,7 @@ _.takeRightWhile(users, 'active'); ### `_.takeWhile(array, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7494 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takewhile "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7556 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takewhile "See the npm package") Creates a slice of `array` with elements taken from the beginning. Elements are taken until `predicate` returns falsey. The predicate is invoked with @@ -1935,7 +1944,7 @@ _.takeWhile(users, 'active'); ### `_.union([arrays])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7516 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.union "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7578 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.union "See the npm package") Creates an array of unique values, in order, from all given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) @@ -1951,8 +1960,8 @@ for equality comparisons. #### Example ```js -_.union([2, 1], [4, 2], [1, 2]); -// => [2, 1, 4] +_.union([2], [1, 2]); +// => [2, 1] ``` * * * @@ -1961,7 +1970,7 @@ _.union([2, 1], [4, 2], [1, 2]); ### `_.unionBy([arrays], [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7543 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unionby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7605 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unionby "See the npm package") This method is like `_.union` except that it accepts `iteratee` which is invoked for each element of each `arrays` to generate the criterion by @@ -1979,8 +1988,8 @@ which uniqueness is computed. The iteratee is invoked with one argument:
#### Example ```js -_.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); -// => [2.1, 1.2, 4.3] +_.unionBy([2.1], [1.2, 2.3], Math.floor); +// => [2.1, 1.2] // The `_.property` iteratee shorthand. _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); @@ -1993,7 +2002,7 @@ _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unionWith([arrays], [comparator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7571 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unionwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7633 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unionwith "See the npm package") This method is like `_.union` except that it accepts `comparator` which is invoked to compare elements of `arrays`. The comparator is invoked @@ -2023,7 +2032,7 @@ _.unionWith(objects, others, _.isEqual); ### `_.uniq(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7596 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniq "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7658 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniq "See the npm package") Creates a duplicate-free version of an array, using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) @@ -2050,7 +2059,7 @@ _.uniq([2, 1, 2]); ### `_.uniqBy(array, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7624 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7686 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqby "See the npm package") This method is like `_.uniq` except that it accepts `iteratee` which is invoked for each element in `array` to generate the criterion by which @@ -2081,7 +2090,7 @@ _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.uniqWith(array, [comparator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7649 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7711 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqwith "See the npm package") This method is like `_.uniq` except that it accepts `comparator` which is invoked to compare elements of `array`. The comparator is invoked with @@ -2098,7 +2107,7 @@ two arguments: *(arrVal, othVal)*. #### Example ```js -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 }]; _.uniqWith(objects, _.isEqual); // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] @@ -2110,7 +2119,7 @@ _.uniqWith(objects, _.isEqual); ### `_.unzip(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7674 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzip "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7736 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzip "See the npm package") 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 @@ -2139,7 +2148,7 @@ _.unzip(zipped); ### `_.unzipWith(array, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7711 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzipwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7773 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzipwith "See the npm package") This method is like `_.unzip` except that it accepts `iteratee` to specify how regrouped values should be combined. The iteratee is invoked with the @@ -2169,7 +2178,7 @@ _.unzipWith(zipped, _.add); ### `_.without(array, [values])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7742 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.without "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7804 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.without "See the npm package") Creates an array excluding all given values using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) @@ -2186,7 +2195,7 @@ for equality comparisons. #### Example ```js -_.without([1, 2, 1, 3], 1, 2); +_.without([2, 1, 2, 3], 1, 2); // => [3] ``` * * * @@ -2196,7 +2205,7 @@ _.without([1, 2, 1, 3], 1, 2); ### `_.xor([arrays])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7766 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xor "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7828 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xor "See the npm package") Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) @@ -2213,8 +2222,8 @@ they occur in the arrays. #### Example ```js -_.xor([2, 1], [4, 2]); -// => [1, 4] +_.xor([2, 1], [2, 3]); +// => [1, 3] ``` * * * @@ -2223,7 +2232,7 @@ _.xor([2, 1], [4, 2]); ### `_.xorBy([arrays], [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7793 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xorby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7855 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xorby "See the npm package") This method is like `_.xor` except that it accepts `iteratee` which is invoked for each element of each `arrays` to generate the criterion by @@ -2241,8 +2250,8 @@ which by which they're compared. The iteratee is invoked with one argument:
#### Example ```js -_.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); -// => [1.2, 4.3] +_.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); +// => [1.2, 3.4] // The `_.property` iteratee shorthand. _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); @@ -2255,7 +2264,7 @@ _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); ### `_.xorWith([arrays], [comparator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7821 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xorwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7883 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xorwith "See the npm package") This method is like `_.xor` except that it accepts `comparator` which is invoked to compare elements of `arrays`. The comparator is invoked with @@ -2285,7 +2294,7 @@ _.xorWith(objects, others, _.isEqual); ### `_.zip([arrays])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7845 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zip "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7907 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zip "See the npm package") Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the @@ -2311,7 +2320,7 @@ _.zip(['fred', 'barney'], [30, 40], [true, false]); ### `_.zipObject([props=[]], [values=[]])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7863 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7925 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package") This method is like `_.fromPairs` except that it accepts two arrays, one of property identifiers and one of corresponding values. @@ -2337,7 +2346,7 @@ _.zipObject(['a', 'b'], [1, 2]); ### `_.zipObjectDeep([props=[]], [values=[]])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7882 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobjectdeep "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7944 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobjectdeep "See the npm package") This method is like `_.zipObject` except that it supports property paths. @@ -2362,7 +2371,7 @@ _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]); ### `_.zipWith([arrays], [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7905 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L7967 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipwith "See the npm package") This method is like `_.zip` except that it accepts `iteratee` to specify how grouped values should be combined. The iteratee is invoked with the @@ -2397,7 +2406,7 @@ _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { ### `_.countBy(collection, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8288 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.countby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8348 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.countby "See the npm package") Creates an object composed of keys generated from the results of running each element of `collection` thru `iteratee`. The corresponding value of @@ -2418,6 +2427,7 @@ iteratee is invoked with one argument: *(value)*. _.countBy([6.1, 4.2, 6.3], Math.floor); // => { '4': 1, '6': 2 } +// The `_.property` iteratee shorthand. _.countBy(['one', 'two', 'three'], 'length'); // => { '3': 2, '5': 1 } ``` @@ -2428,7 +2438,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8329 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.every "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8389 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.every "See the npm package") Checks if `predicate` returns truthy for **all** elements of `collection`. Iteration is stopped once `predicate` returns falsey. The predicate is @@ -2472,7 +2482,7 @@ _.every(users, 'active'); ### `_.filter(collection, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8373 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.filter "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8433 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.filter "See the npm package") Iterates over elements of `collection`, returning an array of all elements `predicate` returns truthy for. The predicate is invoked with three @@ -2515,8 +2525,8 @@ _.filter(users, 'active'); -### `_.find(collection, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8414 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.find "See the npm package") +### `_.find(collection, [predicate=_.identity], [fromIndex=0])` +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8475 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.find "See the npm package") Iterates over elements of `collection`, returning the first element `predicate` returns truthy for. The predicate is invoked with three @@ -2527,6 +2537,7 @@ arguments: *(value, index|key, collection)*. #### Arguments 1. `collection` *(Array|Object)*: The collection to search. 2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration. +3. `[fromIndex=0]` *(number)*: The index to search from. #### Returns *(*)*: Returns the matched element, else `undefined`. @@ -2560,8 +2571,8 @@ _.find(users, 'active'); -### `_.findLast(collection, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8442 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlast "See the npm package") +### `_.findLast(collection, [predicate=_.identity], [fromIndex=collection.length-1])` +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8501 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlast "See the npm package") This method is like `_.find` except that it iterates over elements of `collection` from right to left. @@ -2571,6 +2582,7 @@ This method is like `_.find` except that it iterates over elements of #### Arguments 1. `collection` *(Array|Object)*: The collection to search. 2. `[predicate=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration. +3. `[fromIndex=collection.length-1]` *(number)*: The index to search from. #### Returns *(*)*: Returns the matched element, else `undefined`. @@ -2589,7 +2601,7 @@ _.findLast([1, 2, 3, 4], function(n) { ### `_.flatMap(collection, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8473 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmap "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8529 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmap "See the npm package") Creates a flattened array of values by running each element in `collection` thru `iteratee` and flattening the mapped results. The iteratee is invoked @@ -2620,7 +2632,7 @@ _.flatMap([1, 2], duplicate); ### `_.flatMapDeep(collection, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8498 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmapdeep "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8554 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmapdeep "See the npm package") This method is like `_.flatMap` except that it recursively flattens the mapped results. @@ -2650,7 +2662,7 @@ _.flatMapDeep([1, 2], duplicate); ### `_.flatMapDepth(collection, [iteratee=_.identity], [depth=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8524 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmapdepth "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8580 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmapdepth "See the npm package") This method is like `_.flatMap` except that it recursively flattens the mapped results up to `depth` times. @@ -2681,7 +2693,7 @@ _.flatMapDepth([1, 2], duplicate, 2); ### `_.forEach(collection, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8559 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreach "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8615 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreach "See the npm package") Iterates over elements of `collection` and invokes `iteratee` for each element. The iteratee is invoked with three arguments: *(value, index|key, collection)*. @@ -2723,7 +2735,7 @@ _.forEach({ 'a': 1, 'b': 2 }, function(value, key) { ### `_.forEachRight(collection, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8584 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreachright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8640 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreachright "See the npm package") This method is like `_.forEach` except that it iterates over elements of `collection` from right to left. @@ -2754,7 +2766,7 @@ _.forEachRight([1, 2], function(value) { ### `_.groupBy(collection, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8613 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.groupby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8669 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.groupby "See the npm package") Creates an object composed of keys generated from the results of running each element of `collection` thru `iteratee`. The order of grouped values @@ -2787,7 +2799,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.includes(collection, value, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8651 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.includes "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8707 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.includes "See the npm package") Checks if `value` is in `collection`. If `collection` is a string, it's checked for a substring of `value`, otherwise @@ -2826,7 +2838,7 @@ _.includes('pebbles', 'eb'); ### `_.invokeMap(collection, path, [args])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8687 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invokemap "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8743 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invokemap "See the npm package") Invokes the method at `path` of each element in `collection`, returning an array of the results of each invoked method. Any additional arguments @@ -2858,7 +2870,7 @@ _.invokeMap([123, 456], String.prototype.split, ''); ### `_.keyBy(collection, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8729 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keyby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8785 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keyby "See the npm package") Creates an object composed of keys generated from the results of running each element of `collection` thru `iteratee`. The corresponding value of @@ -2896,7 +2908,7 @@ _.keyBy(array, 'dir'); ### `_.map(collection, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8776 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.map "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8832 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.map "See the npm package") Creates an array of values by running each element in `collection` thru `iteratee`. The iteratee is invoked with three arguments:
@@ -2950,7 +2962,7 @@ _.map(users, 'user'); ### `_.orderBy(collection, [iteratees=[_.identity]], [orders])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8810 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.orderby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8866 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.orderby "See the npm package") 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 @@ -2987,7 +2999,7 @@ _.orderBy(users, ['user', 'age'], ['asc', 'desc']); ### `_.partition(collection, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8861 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partition "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8917 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partition "See the npm package") Creates an array of elements split into two groups, the first of which contains elements `predicate` returns truthy for, the second of which @@ -3033,7 +3045,7 @@ _.partition(users, 'active'); ### `_.reduce(collection, [iteratee=_.identity], [accumulator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8902 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduce "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8958 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduce "See the npm package") Reduces `collection` to a value which is the accumulated result of running each element in `collection` thru `iteratee`, where each successive @@ -3081,7 +3093,7 @@ _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { ### `_.reduceRight(collection, [iteratee=_.identity], [accumulator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8931 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduceright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8987 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduceright "See the npm package") This method is like `_.reduce` except that it iterates over elements of `collection` from right to left. @@ -3112,7 +3124,7 @@ _.reduceRight(array, function(flattened, other) { ### `_.reject(collection, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8973 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9029 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reject "See the npm package") The opposite of `_.filter`; this method returns the elements of `collection` that `predicate` does **not** return truthy for. @@ -3155,7 +3167,7 @@ _.reject(users, 'active'); ### `_.sample(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8995 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sample "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9051 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sample "See the npm package") Gets a random element from `collection`. @@ -3179,7 +3191,7 @@ _.sample([1, 2, 3, 4]); ### `_.sampleSize(collection, [n=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9022 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.samplesize "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9078 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.samplesize "See the npm package") Gets `n` random elements at unique keys from `collection` up to the size of `collection`. @@ -3208,7 +3220,7 @@ _.sampleSize([1, 2, 3], 4); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9059 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.shuffle "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9115 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.shuffle "See the npm package") Creates an array of shuffled values, using a version of the [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). @@ -3233,7 +3245,7 @@ _.shuffle([1, 2, 3, 4]); ### `_.size(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9084 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.size "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9140 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.size "See the npm package") Gets the size of `collection` by returning its length for array-like values or the number of own enumerable string keyed properties for objects. @@ -3264,7 +3276,7 @@ _.size('pebbles'); ### `_.some(collection, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9138 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.some "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9194 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.some "See the npm package") Checks if `predicate` returns truthy for **any** element of `collection`. Iteration is stopped once `predicate` returns truthy. The predicate is @@ -3308,7 +3320,7 @@ _.some(users, 'active'); ### `_.sortBy(collection, [iteratees=[_.identity]])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9180 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9236 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortby "See the npm package") Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru each iteratee. This method @@ -3357,7 +3369,7 @@ _.sortBy(users, 'user', function(o) { ### `_.now()` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9216 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.now "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9271 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.now "See the npm package") Gets the timestamp of the number of milliseconds that have elapsed since the Unix epoch *(1 January `1970 00`:00:00 UTC)*. @@ -3372,7 +3384,7 @@ the Unix epoch *(1 January `1970 00`:00:00 UTC)*. _.defer(function(stamp) { console.log(_.now() - stamp); }, _.now()); -// => Logs the number of milliseconds it took for the deferred function to be invoked. +// => Logs the number of milliseconds it took for the deferred invocation. ``` * * * @@ -3387,7 +3399,7 @@ _.defer(function(stamp) { ### `_.after(n, func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9244 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.after "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9301 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.after "See the npm package") The opposite of `_.before`; this method creates a function that invokes `func` once it's called `n` or more times. @@ -3421,7 +3433,7 @@ _.forEach(saves, function(type) { ### `_.ary(func, [n=func.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9273 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ary "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9330 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ary "See the npm package") Creates a function that invokes `func`, with up to `n` arguments, ignoring any additional arguments. @@ -3447,7 +3459,7 @@ _.map(['6', '8', '10'], _.ary(parseInt, 1)); ### `_.before(n, func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9296 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.before "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9353 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.before "See the npm package") 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 @@ -3474,7 +3486,7 @@ jQuery(element).on('click', _.before(5, addContactToList)); ### `_.bind(func, thisArg, [partials])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9348 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bind "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9405 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bind "See the npm package") Creates a function that invokes `func` with the `this` binding of `thisArg` and `partials` prepended to the arguments it receives. @@ -3484,7 +3496,7 @@ The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, may be used as a placeholder for partially applied arguments.

-**Note:** Unlike native `Function#bind` this method doesn't set the "length" +**Note:** Unlike native `Function#bind`, this method doesn't set the "length" property of bound functions. #### Since @@ -3521,7 +3533,7 @@ bound('hi'); ### `_.bindKey(object, key, [partials])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9402 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindkey "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9459 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindkey "See the npm package") Creates a function that invokes the method at `object[key]` with `partials` prepended to the arguments it receives. @@ -3578,7 +3590,7 @@ bound('hi'); ### `_.curry(func, [arity=func.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9452 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curry "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9509 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curry "See the npm package") Creates a function that accepts arguments of `func` and either invokes `func` returning its result, if at least `arity` number of arguments have @@ -3630,7 +3642,7 @@ curried(1)(_, 3)(2); ### `_.curryRight(func, [arity=func.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9497 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curryright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9554 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curryright "See the npm package") This method is like `_.curry` except that arguments are applied to `func` in the manner of `_.partialRight` instead of `_.partial`. @@ -3679,7 +3691,7 @@ curried(3)(1, _)(2); ### `_.debounce(func, [wait=0], [options={}], [options.leading=false], [options.maxWait], [options.trailing=true])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9554 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.debounce "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9611 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.debounce "See the npm package") Creates a debounced function that delays invoking `func` until after `wait` milliseconds have elapsed since the last time the debounced function was @@ -3738,7 +3750,7 @@ jQuery(window).on('popstate', debounced.cancel); ### `_.defer(func, [args])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9696 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defer "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9748 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defer "See the npm package") Defers invoking the `func` until the current call stack has cleared. Any additional arguments are provided to `func` when it's invoked. @@ -3766,7 +3778,7 @@ _.defer(function(text) { ### `_.delay(func, wait, [args])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9719 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.delay "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9771 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.delay "See the npm package") Invokes `func` after `wait` milliseconds. Any additional arguments are provided to `func` when it's invoked. @@ -3795,7 +3807,7 @@ _.delay(function(text) { ### `_.flip(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9741 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flip "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9793 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flip "See the npm package") Creates a function that invokes `func` with arguments reversed. @@ -3823,7 +3835,7 @@ flipped('a', 'b', 'c', 'd'); ### `_.memoize(func, [resolver])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9789 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.memoize "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9841 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.memoize "See the npm package") 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 @@ -3878,7 +3890,7 @@ _.memoize.Cache = WeakMap; ### `_.negate(predicate)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9832 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.negate "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9884 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.negate "See the npm package") Creates a function that negates the result of the predicate `func`. The `func` predicate is invoked with the `this` binding and arguments of the @@ -3908,7 +3920,7 @@ _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); ### `_.once(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9859 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.once "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9911 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.once "See the npm package") 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 @@ -3936,7 +3948,7 @@ initialize(); ### `_.overArgs(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9895 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.overargs "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9947 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.overargs "See the npm package") Creates a function that invokes `func` with arguments transformed by corresponding `transforms`. @@ -3961,7 +3973,7 @@ function square(n) { var func = _.overArgs(function(x, y) { return [x, y]; -}, square, doubled); +}, [square, doubled]); func(9, 3); // => [81, 6] @@ -3976,7 +3988,7 @@ func(10, 5); ### `_.partial(func, [partials])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9945 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partial "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L9997 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partial "See the npm package") Creates a function that invokes `func` with `partials` prepended to the arguments it receives. This method is like `_.bind` except it does **not** @@ -4021,7 +4033,7 @@ greetFred('hi'); ### `_.partialRight(func, [partials])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L9982 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partialright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10034 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partialright "See the npm package") This method is like `_.partial` except that partially applied arguments are appended to the arguments it receives. @@ -4065,7 +4077,7 @@ sayHelloTo('fred'); ### `_.rearg(func, indexes)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10009 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rearg "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10061 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rearg "See the npm package") Creates a function that invokes `func` with arguments arranged according to the specified `indexes` where the argument value at the first index is @@ -4085,7 +4097,7 @@ provided as the second argument, and so on. ```js var rearged = _.rearg(function(a, b, c) { return [a, b, c]; -}, 2, 0, 1); +}, [2, 0, 1]); rearged('b', 'c', 'a') // => ['a', 'b', 'c'] @@ -4097,7 +4109,7 @@ rearged('b', 'c', 'a') ### `_.rest(func, [start=func.length-1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10038 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rest "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10090 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rest "See the npm package") Creates a function that invokes `func` with the `this` binding of the created function and arguments from `start` and beyond provided as @@ -4133,7 +4145,7 @@ say('hello', 'fred', 'barney', 'pebbles'); ### `_.spread(func, [start=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10101 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.spread "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10153 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.spread "See the npm package") Creates a function that invokes `func` with the `this` binding of the create function and an array of arguments much like @@ -4178,7 +4190,7 @@ numbers.then(_.spread(function(x, y) { ### `_.throttle(func, [wait=0], [options={}], [options.leading=true], [options.trailing=true])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10158 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.throttle "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10210 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.throttle "See the npm package") Creates a throttled function that only invokes `func` at most once per every `wait` milliseconds. The throttled function comes with a `cancel` @@ -4229,7 +4241,7 @@ jQuery(window).on('popstate', throttled.cancel); ### `_.unary(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10191 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unary "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10243 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unary "See the npm package") Creates a function that accepts up to one argument, ignoring any additional arguments. @@ -4254,7 +4266,7 @@ _.map(['6', '8', '10'], _.unary(parseInt)); ### `_.wrap(value, [wrapper=identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10217 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.wrap "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10269 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.wrap "See the npm package") Creates a function that provides `value` to the wrapper function as its first argument. Any additional arguments provided to the function are @@ -4292,7 +4304,7 @@ p('fred, barney, & pebbles'); ### `_.castArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10257 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.castarray "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10309 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.castarray "See the npm package") Casts `value` as an array if it's not one. @@ -4335,7 +4347,7 @@ console.log(_.castArray(array) === array); ### `_.clone(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10291 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clone "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10343 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clone "See the npm package") Creates a shallow clone of `value`.
@@ -4371,7 +4383,7 @@ console.log(shallow[0] === objects[0]); ### `_.cloneDeep(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10348 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeep "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10400 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeep "See the npm package") This method is like `_.clone` except that it recursively clones `value`. @@ -4398,7 +4410,7 @@ console.log(deep[0] === objects[0]); ### `_.cloneDeepWith(value, [customizer])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10380 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeepwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10432 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeepwith "See the npm package") This method is like `_.cloneWith` except that it recursively clones `value`. @@ -4435,7 +4447,7 @@ console.log(el.childNodes.length); ### `_.cloneWith(value, [customizer])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10326 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonewith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10378 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonewith "See the npm package") This method is like `_.clone` except that it accepts `customizer` which is invoked to produce the cloned value. If `customizer` returns `undefined`, @@ -4475,7 +4487,7 @@ console.log(el.childNodes.length); ### `_.eq(value, other)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10416 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.eq "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10468 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.eq "See the npm package") Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) @@ -4517,7 +4529,7 @@ _.eq(NaN, NaN); ### `_.gt(value, other)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10443 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.gt "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10495 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.gt "See the npm package") Checks if `value` is greater than `other`. @@ -4548,7 +4560,7 @@ _.gt(1, 3); ### `_.gte(value, other)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10468 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.gte "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10520 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.gte "See the npm package") Checks if `value` is greater than or equal to `other`. @@ -4579,7 +4591,7 @@ _.gte(1, 3); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10490 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarguments "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10542 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarguments "See the npm package") Checks if `value` is likely an `arguments` object. @@ -4606,7 +4618,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10521 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarray "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10573 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarray "See the npm package") Checks if `value` is classified as an `Array` object. @@ -4639,7 +4651,7 @@ _.isArray(_.noop); ### `_.isArrayBuffer(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10541 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraybuffer "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10593 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraybuffer "See the npm package") Checks if `value` is classified as an `ArrayBuffer` object. @@ -4666,7 +4678,7 @@ _.isArrayBuffer(new Array(2)); ### `_.isArrayLike(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10570 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraylike "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10622 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraylike "See the npm package") 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 @@ -4701,7 +4713,7 @@ _.isArrayLike(_.noop); ### `_.isArrayLikeObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10599 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraylikeobject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10651 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraylikeobject "See the npm package") This method is like `_.isArrayLike` except that it also checks if `value` is an object. @@ -4735,7 +4747,7 @@ _.isArrayLikeObject(_.noop); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10621 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isboolean "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10673 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isboolean "See the npm package") Checks if `value` is classified as a boolean primitive or object. @@ -4762,7 +4774,7 @@ _.isBoolean(null); ### `_.isBuffer(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10643 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isbuffer "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10695 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isbuffer "See the npm package") Checks if `value` is a buffer. @@ -4789,7 +4801,7 @@ _.isBuffer(new Uint8Array(2)); ### `_.isDate(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10665 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isdate "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10717 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isdate "See the npm package") Checks if `value` is classified as a `Date` object. @@ -4816,7 +4828,7 @@ _.isDate('Mon April 23 2012'); ### `_.isElement(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10687 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iselement "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10739 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iselement "See the npm package") Checks if `value` is likely a DOM element. @@ -4843,7 +4855,7 @@ _.isElement(''); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10724 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isempty "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10776 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isempty "See the npm package") Checks if `value` is an empty object, collection, map, or set.
@@ -4888,7 +4900,7 @@ _.isEmpty({ 'a': 1 }); ### `_.isEqual(value, other)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10773 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequal "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10825 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequal "See the npm package") Performs a deep comparison between two values to determine if they are equivalent. @@ -4927,7 +4939,7 @@ object === other; ### `_.isEqualWith(value, other, [customizer])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10810 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequalwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10862 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequalwith "See the npm package") This method is like `_.isEqual` except that it accepts `customizer` which is invoked to compare values. If `customizer` returns `undefined`, comparisons @@ -4969,7 +4981,7 @@ _.isEqualWith(array, other, customizer); ### `_.isError(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10835 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iserror "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10887 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iserror "See the npm package") Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, `SyntaxError`, `TypeError`, or `URIError` object. @@ -4997,7 +5009,7 @@ _.isError(Error); ### `_.isFinite(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10870 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfinite "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10922 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfinite "See the npm package") Checks if `value` is a finite primitive number.
@@ -5034,7 +5046,7 @@ _.isFinite('3'); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10892 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfunction "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10944 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfunction "See the npm package") Checks if `value` is classified as a `Function` object. @@ -5061,7 +5073,7 @@ _.isFunction(/abc/); ### `_.isInteger(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10926 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isinteger "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L10978 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isinteger "See the npm package") Checks if `value` is an integer.
@@ -5098,7 +5110,7 @@ _.isInteger('3'); ### `_.isLength(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10957 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.islength "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11009 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.islength "See the npm package") Checks if `value` is a valid array-like length.
@@ -5135,7 +5147,7 @@ _.isLength('3'); ### `_.isMap(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11038 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismap "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11090 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismap "See the npm package") Checks if `value` is classified as a `Map` object. @@ -5162,7 +5174,7 @@ _.isMap(new WeakMap); ### `_.isMatch(object, source)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11066 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatch "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11118 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatch "See the npm package") Performs a partial deep comparison between `object` and `source` to determine if `object` contains equivalent property values. This method is @@ -5197,7 +5209,7 @@ _.isMatch(object, { 'age': 36 }); ### `_.isMatchWith(object, source, [customizer])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11102 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatchwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11154 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatchwith "See the npm package") This method is like `_.isMatch` except that it accepts `customizer` which is invoked to compare values. If `customizer` returns `undefined`, comparisons @@ -5239,7 +5251,7 @@ _.isMatchWith(object, source, customizer); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11135 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnan "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11187 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnan "See the npm package") Checks if `value` is `NaN`.
@@ -5278,9 +5290,18 @@ _.isNaN(undefined); ### `_.isNative(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11160 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnative "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11220 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnative "See the npm package") -Checks if `value` is a native function. +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`. #### Since 3.0.0 @@ -5305,7 +5326,7 @@ _.isNative(_); ### `_.isNil(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11209 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnil "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11268 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnil "See the npm package") Checks if `value` is `null` or `undefined`. @@ -5335,7 +5356,7 @@ _.isNil(NaN); ### `_.isNull(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11185 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnull "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11244 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnull "See the npm package") Checks if `value` is `null`. @@ -5362,7 +5383,7 @@ _.isNull(void 0); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11240 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnumber "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11299 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnumber "See the npm package") Checks if `value` is classified as a `Number` primitive or object.
@@ -5399,7 +5420,7 @@ _.isNumber('3'); ### `_.isObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L10987 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11039 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobject "See the npm package") Checks if `value` is the [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) @@ -5434,7 +5455,7 @@ _.isObject(null); ### `_.isObjectLike(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11016 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobjectlike "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11068 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobjectlike "See the npm package") Checks if `value` is object-like. A value is object-like if it's not `null` and has a `typeof` result of "object". @@ -5468,7 +5489,7 @@ _.isObjectLike(null); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11274 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isplainobject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11333 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isplainobject "See the npm package") Checks if `value` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`. @@ -5506,7 +5527,7 @@ _.isPlainObject(Object.create(null)); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11306 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isregexp "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11365 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isregexp "See the npm package") Checks if `value` is classified as a `RegExp` object. @@ -5533,7 +5554,7 @@ _.isRegExp('/abc/'); ### `_.isSafeInteger(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11338 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.issafeinteger "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11397 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.issafeinteger "See the npm package") 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. @@ -5571,7 +5592,7 @@ _.isSafeInteger('3'); ### `_.isSet(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11360 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isset "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11419 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isset "See the npm package") Checks if `value` is classified as a `Set` object. @@ -5598,7 +5619,7 @@ _.isSet(new WeakSet); ### `_.isString(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11382 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isstring "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11441 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isstring "See the npm package") Checks if `value` is classified as a `String` primitive or object. @@ -5625,7 +5646,7 @@ _.isString(1); ### `_.isSymbol(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11405 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.issymbol "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11464 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.issymbol "See the npm package") Checks if `value` is classified as a `Symbol` primitive or object. @@ -5652,7 +5673,7 @@ _.isSymbol('abc'); ### `_.isTypedArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11428 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.istypedarray "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11487 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.istypedarray "See the npm package") Checks if `value` is classified as a typed array. @@ -5679,7 +5700,7 @@ _.isTypedArray([]); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11450 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isundefined "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11509 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isundefined "See the npm package") Checks if `value` is `undefined`. @@ -5706,7 +5727,7 @@ _.isUndefined(null); ### `_.isWeakMap(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11472 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isweakmap "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11531 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isweakmap "See the npm package") Checks if `value` is classified as a `WeakMap` object. @@ -5733,7 +5754,7 @@ _.isWeakMap(new Map); ### `_.isWeakSet(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11494 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isweakset "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11553 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isweakset "See the npm package") Checks if `value` is classified as a `WeakSet` object. @@ -5760,7 +5781,7 @@ _.isWeakSet(new Set); ### `_.lt(value, other)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11521 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lt "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11580 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lt "See the npm package") Checks if `value` is less than `other`. @@ -5791,7 +5812,7 @@ _.lt(3, 1); ### `_.lte(value, other)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11546 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lte "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11605 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lte "See the npm package") Checks if `value` is less than or equal to `other`. @@ -5822,7 +5843,7 @@ _.lte(3, 1); ### `_.toArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11573 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toarray "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11632 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toarray "See the npm package") Converts `value` to an array. @@ -5855,7 +5876,7 @@ _.toArray(null); ### `_.toFinite(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11612 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tofinite "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11671 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tofinite "See the npm package") Converts `value` to a finite number. @@ -5888,12 +5909,12 @@ _.toFinite('3.2'); ### `_.toInteger(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11650 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tointeger "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11709 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tointeger "See the npm package") Converts `value` to an integer.

-**Note:** This function is loosely based on +**Note:** This method is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). #### Since @@ -5925,7 +5946,7 @@ _.toInteger('3.2'); ### `_.toLength(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11684 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tolength "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11743 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tolength "See the npm package") Converts `value` to an integer suitable for use as the length of an array-like object. @@ -5963,7 +5984,7 @@ _.toLength('3.2'); ### `_.toNumber(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11711 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tonumber "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11770 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tonumber "See the npm package") Converts `value` to a number. @@ -5996,7 +6017,7 @@ _.toNumber('3.2'); ### `_.toPlainObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11756 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toplainobject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11815 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toplainobject "See the npm package") Converts `value` to a plain object flattening inherited enumerable string keyed properties of `value` to own properties of the plain object. @@ -6030,7 +6051,7 @@ _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); ### `_.toSafeInteger(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11784 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tosafeinteger "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11843 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tosafeinteger "See the npm package") Converts `value` to a safe integer. A safe integer can be compared and represented correctly. @@ -6064,7 +6085,7 @@ _.toSafeInteger('3.2'); ### `_.toString(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11809 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tostring "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11868 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tostring "See the npm package") Converts `value` to a string. An empty string is returned for `null` and `undefined` values. The sign of `-0` is preserved. @@ -6101,7 +6122,7 @@ _.toString([1, 2, 3]); ### `_.add(augend, addend)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15322 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.add "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15464 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.add "See the npm package") Adds two numbers. @@ -6126,7 +6147,7 @@ _.add(6, 4); ### `_.ceil(number, [precision=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15347 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ceil "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15489 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ceil "See the npm package") Computes `number` rounded up to `precision`. @@ -6157,7 +6178,7 @@ _.ceil(6040, -2); ### `_.divide(dividend, divisor)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15364 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.divide "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15506 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.divide "See the npm package") Divide two numbers. @@ -6182,7 +6203,7 @@ _.divide(6, 4); ### `_.floor(number, [precision=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15389 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.floor "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15531 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.floor "See the npm package") Computes `number` rounded down to `precision`. @@ -6213,7 +6234,7 @@ _.floor(4060, -2); ### `_.max(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15409 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.max "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15551 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.max "See the npm package") Computes the maximum value of `array`. If `array` is empty or falsey, `undefined` is returned. @@ -6241,7 +6262,7 @@ _.max([]); ### `_.maxBy(array, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15439 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.maxby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15581 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.maxby "See the npm package") This method is like `_.max` except that it accepts `iteratee` which is invoked for each element in `array` to generate the criterion by which @@ -6274,7 +6295,7 @@ _.maxBy(objects, 'n'); ### `_.mean(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15459 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mean "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15601 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mean "See the npm package") Computes the mean of the values in `array`. @@ -6298,7 +6319,7 @@ _.mean([4, 2, 8, 6]); ### `_.meanBy(array, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15487 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.meanby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15629 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.meanby "See the npm package") 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. @@ -6331,7 +6352,7 @@ _.meanBy(objects, 'n'); ### `_.min(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15509 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.min "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15651 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.min "See the npm package") Computes the minimum value of `array`. If `array` is empty or falsey, `undefined` is returned. @@ -6359,7 +6380,7 @@ _.min([]); ### `_.minBy(array, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15539 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.minby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15681 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.minby "See the npm package") This method is like `_.min` except that it accepts `iteratee` which is invoked for each element in `array` to generate the criterion by which @@ -6392,7 +6413,7 @@ _.minBy(objects, 'n'); ### `_.multiply(multiplier, multiplicand)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15560 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.multiply "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15702 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.multiply "See the npm package") Multiply two numbers. @@ -6417,7 +6438,7 @@ _.multiply(6, 4); ### `_.round(number, [precision=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15585 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.round "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15727 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.round "See the npm package") Computes `number` rounded to `precision`. @@ -6448,7 +6469,7 @@ _.round(4060, -2); ### `_.subtract(minuend, subtrahend)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15602 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.subtract "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15744 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.subtract "See the npm package") Subtract two numbers. @@ -6473,7 +6494,7 @@ _.subtract(6, 4); ### `_.sum(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15620 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sum "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15762 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sum "See the npm package") Computes the sum of the values in `array`. @@ -6497,7 +6518,7 @@ _.sum([4, 2, 8, 6]); ### `_.sumBy(array, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15650 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sumby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15792 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sumby "See the npm package") 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. @@ -6536,7 +6557,7 @@ _.sumBy(objects, 'n'); ### `_.clamp(number, [lower], upper)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13232 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clamp "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13289 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clamp "See the npm package") Clamps `number` within the inclusive `lower` and `upper` bounds. @@ -6565,7 +6586,7 @@ _.clamp(10, -5, 5); ### `_.inRange(number, [start=0], end)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13286 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.inrange "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13343 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.inrange "See the npm package") 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`. @@ -6612,7 +6633,7 @@ _.inRange(-3, -2, -6); ### `_.random([lower=0], [upper=1], [floating])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13329 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.random "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13386 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.random "See the npm package") 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 @@ -6660,7 +6681,7 @@ _.random(1.2, 5.2); ### `_.assign(object, [sources])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11847 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assign "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11906 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assign "See the npm package") Assigns own enumerable string keyed properties of source objects to the destination object. Source objects are applied from left to right. @@ -6702,7 +6723,7 @@ _.assign({ 'a': 1 }, new Foo, new Bar); ### `_.assignIn(object, [sources])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11890 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assignin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11949 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assignin "See the npm package") This method is like `_.assign` except that it iterates over own and inherited source properties. @@ -6745,7 +6766,7 @@ _.assignIn({ 'a': 1 }, new Foo, new Bar); ### `_.assignInWith(object, sources, [customizer])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11929 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assigninwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L11988 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assigninwith "See the npm package") This method is like `_.assignIn` except that it accepts `customizer` which is invoked to produce the assigned values. If `customizer` returns @@ -6786,7 +6807,7 @@ defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); ### `_.assignWith(object, sources, [customizer])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11961 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assignwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12020 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assignwith "See the npm package") This method is like `_.assign` except that it accepts `customizer` which is invoked to produce the assigned values. If `customizer` returns @@ -6824,7 +6845,7 @@ defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); ### `_.at(object, [paths])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L11985 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.at "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12041 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.at "See the npm package") Creates an array of values corresponding to `paths` of `object`. @@ -6843,9 +6864,6 @@ var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; _.at(object, ['a[0].b.c', 'a[1]']); // => [3, 4] - -_.at(['a', 'b', 'c'], 0, 2); -// => ['a', 'c'] ``` * * * @@ -6854,7 +6872,7 @@ _.at(['a', 'b', 'c'], 0, 2); ### `_.create(prototype, [properties])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12023 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.create "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12079 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.create "See the npm package") Creates an object that inherits from the `prototype` object. If a `properties` object is given, its own enumerable string keyed properties @@ -6898,7 +6916,7 @@ circle instanceof Shape; ### `_.defaults(object, [sources])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12049 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaults "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12105 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaults "See the npm package") Assigns own and inherited enumerable string keyed properties of source objects to the destination object for all destination properties that @@ -6929,7 +6947,7 @@ _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); ### `_.defaultsDeep(object, [sources])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12074 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaultsdeep "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12130 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaultsdeep "See the npm package") This method is like `_.defaults` except that it recursively assigns default properties. @@ -6958,7 +6976,7 @@ _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'ag ### `_.findKey(object, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12115 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findkey "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12171 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findkey "See the npm package") This method is like `_.find` except that it returns the key of the first element `predicate` returns truthy for instead of the element itself. @@ -7002,7 +7020,7 @@ _.findKey(users, 'active'); ### `_.findLastKey(object, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12155 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastkey "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12211 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastkey "See the npm package") This method is like `_.findKey` except that it iterates over elements of a collection in the opposite order. @@ -7046,7 +7064,7 @@ _.findLastKey(users, 'active'); ### `_.forIn(object, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12187 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12243 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forin "See the npm package") Iterates over own and inherited enumerable string keyed properties of an object and invokes `iteratee` for each property. The iteratee is invoked @@ -7083,7 +7101,7 @@ _.forIn(new Foo, function(value, key) { ### `_.forInRight(object, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12219 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forinright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12275 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forinright "See the npm package") This method is like `_.forIn` except that it iterates over properties of `object` in the opposite order. @@ -7118,7 +7136,7 @@ _.forInRight(new Foo, function(value, key) { ### `_.forOwn(object, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12253 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forown "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12309 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forown "See the npm package") Iterates over own enumerable string keyed properties of an object and invokes `iteratee` for each property. The iteratee is invoked with three @@ -7155,7 +7173,7 @@ _.forOwn(new Foo, function(value, key) { ### `_.forOwnRight(object, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12283 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forownright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12339 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forownright "See the npm package") This method is like `_.forOwn` except that it iterates over properties of `object` in the opposite order. @@ -7190,7 +7208,7 @@ _.forOwnRight(new Foo, function(value, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12310 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functions "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12366 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functions "See the npm package") Creates an array of function property names from own enumerable properties of `object`. @@ -7222,7 +7240,7 @@ _.functions(new Foo); ### `_.functionsIn(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12337 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functionsin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12393 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functionsin "See the npm package") Creates an array of function property names from own and inherited enumerable properties of `object`. @@ -7254,7 +7272,7 @@ _.functionsIn(new Foo); ### `_.get(object, path, [defaultValue])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12366 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.get "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12422 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.get "See the npm package") Gets the value at `path` of `object`. If the resolved value is `undefined`, the `defaultValue` is used in its place. @@ -7289,7 +7307,7 @@ _.get(object, 'a.b.c', 'default'); ### `_.has(object, path)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12398 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.has "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12454 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.has "See the npm package") Checks if `path` is a direct property of `object`. @@ -7326,7 +7344,7 @@ _.has(other, 'a'); ### `_.hasIn(object, path)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12428 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.hasin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12484 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.hasin "See the npm package") Checks if `path` is a direct or inherited property of `object`. @@ -7362,7 +7380,7 @@ _.hasIn(object, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12450 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invert "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12506 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invert "See the npm package") Creates an object composed of the inverted keys and values of `object`. If `object` contains duplicate values, subsequent values overwrite @@ -7390,7 +7408,7 @@ _.invert(object); ### `_.invertBy(object, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12481 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invertby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12537 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invertby "See the npm package") This method is like `_.invert` except that the inverted object is generated from the results of running each element of `object` thru `iteratee`. The @@ -7426,7 +7444,7 @@ _.invertBy(object, function(value) { ### `_.invoke(object, path, [args])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12507 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invoke "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12563 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invoke "See the npm package") Invokes the method at `path` of `object`. @@ -7454,7 +7472,7 @@ _.invoke(object, 'a[0].b.c.slice', 1, 3); ### `_.keys(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12537 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keys "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12593 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keys "See the npm package") Creates an array of the own enumerable property names of `object`.
@@ -7493,7 +7511,7 @@ _.keys('hi'); ### `_.keysIn(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12580 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keysin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12636 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keysin "See the npm package") Creates an array of the own and inherited enumerable property names of `object`.
@@ -7527,7 +7545,7 @@ _.keysIn(new Foo); ### `_.mapKeys(object, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12622 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapkeys "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12678 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapkeys "See the npm package") The opposite of `_.mapValues`; this method creates an object with the same values as `object` and keys generated by running each own enumerable @@ -7557,7 +7575,7 @@ _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { ### `_.mapValues(object, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12661 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapvalues "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12717 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapvalues "See the npm package") Creates an object with the same keys as `object` and values generated by running each own enumerable string keyed property of `object` thru @@ -7594,7 +7612,7 @@ _.mapValues(users, 'age'); ### `_.merge(object, [sources])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12702 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.merge "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12758 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.merge "See the npm package") This method is like `_.assign` except that it recursively merges own and inherited enumerable string keyed properties of source objects into the @@ -7636,7 +7654,7 @@ _.merge(users, ages); ### `_.mergeWith(object, sources, customizer)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12744 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mergewith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12800 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mergewith "See the npm package") This method is like `_.merge` except that it accepts `customizer` which is invoked to produce the merged values of the destination and source @@ -7685,7 +7703,7 @@ _.mergeWith(object, other, customizer); ### `_.omit(object, [props])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12767 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omit "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12823 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omit "See the npm package") The opposite of `_.pick`; this method creates an object composed of the own and inherited enumerable string keyed properties of `object` that are @@ -7714,7 +7732,7 @@ _.omit(object, ['a', 'c']); ### `_.omitBy(object, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12796 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omitby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12852 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omitby "See the npm package") The opposite of `_.pickBy`; this method creates an object composed of the own and inherited enumerable string keyed properties of `object` that @@ -7744,7 +7762,7 @@ _.omitBy(object, _.isNumber); ### `_.pick(object, [props])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12820 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pick "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12876 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pick "See the npm package") Creates an object composed of the picked `object` properties. @@ -7771,7 +7789,7 @@ _.pick(object, ['a', 'c']); ### `_.pickBy(object, [predicate=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12843 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pickby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12899 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pickby "See the npm package") Creates an object composed of the `object` properties `predicate` returns truthy for. The predicate is invoked with two arguments: *(value, key)*. @@ -7799,7 +7817,7 @@ _.pickBy(object, _.isNumber); ### `_.result(object, path, [defaultValue])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12876 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.result "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12932 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.result "See the npm package") 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 @@ -7838,7 +7856,7 @@ _.result(object, 'a[0].b.c3', _.constant('default')); ### `_.set(object, path, value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12926 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.set "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L12982 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.set "See the npm package") 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 @@ -7877,7 +7895,7 @@ console.log(object.x[0].y.z); ### `_.setWith(object, path, value, [customizer])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12954 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.setwith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13010 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.setwith "See the npm package") This method is like `_.set` except that it accepts `customizer` which is invoked to produce the objects of `path`. If `customizer` returns `undefined` @@ -7912,7 +7930,7 @@ _.setWith(object, '[0][1]', 'a', Object); ### `_.toPairs(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L12983 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topairs "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13039 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topairs "See the npm package") 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 @@ -7948,7 +7966,7 @@ _.toPairs(new Foo); ### `_.toPairsIn(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13009 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topairsin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13065 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topairsin "See the npm package") 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 @@ -7984,19 +8002,20 @@ _.toPairsIn(new Foo); ### `_.transform(object, [iteratee=_.identity], [accumulator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13040 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.transform "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13097 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.transform "See the npm package") An alternative to `_.reduce`; this method transforms `object` to a new `accumulator` object which is the result of running each of its own enumerable string keyed properties thru `iteratee`, with each invocation -potentially mutating the `accumulator` object. The iteratee is invoked -with four arguments: *(accumulator, value, key, object)*. Iteratee functions -may exit iteration early by explicitly returning `false`. +potentially mutating the `accumulator` object. If `accumulator` is not +provided, a new object with the same `[[Prototype]]` will be used. The +iteratee is invoked with four arguments: *(accumulator, value, key, object)*. +Iteratee functions may exit iteration early by explicitly returning `false`. #### Since 1.3.0 #### Arguments -1. `object` *(Array|Object)*: The object to iterate over. +1. `object` *(Object)*: The object to iterate over. 2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration. 3. `[accumulator]` *(*)*: The custom accumulator value. @@ -8023,7 +8042,7 @@ _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { ### `_.unset(object, path)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13089 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unset "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13146 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unset "See the npm package") Removes the property at `path` of `object`.
@@ -8061,7 +8080,7 @@ console.log(object); ### `_.update(object, path, updater)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13120 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.update "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13177 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.update "See the npm package") This method is like `_.set` except that accepts `updater` to produce the value to set. Use `_.updateWith` to customize `path` creation. The `updater` @@ -8099,7 +8118,7 @@ console.log(object.x[0].y.z); ### `_.updateWith(object, path, updater, [customizer])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13148 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.updatewith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13205 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.updatewith "See the npm package") This method is like `_.update` except that it accepts `customizer` which is invoked to produce the objects of `path`. If `customizer` returns `undefined` @@ -8134,7 +8153,7 @@ _.updateWith(object, '[0][1]', _.constant('a'), Object); ### `_.values(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13179 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.values "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13236 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.values "See the npm package") Creates an array of the own enumerable string keyed property values of `object`.
@@ -8171,7 +8190,7 @@ _.values('hi'); ### `_.valuesIn(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13207 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.valuesin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13264 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.valuesin "See the npm package") Creates an array of the own and inherited enumerable string keyed property values of `object`. @@ -8212,7 +8231,7 @@ _.valuesIn(new Foo); ### `_(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L1462 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L1464 "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, @@ -8298,19 +8317,21 @@ The wrapper methods that are **not** chainable by default are:
`isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, -`isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, -`isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, -`isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`, -`join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, -`lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`, -`noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`, -`pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`, -`runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, -`sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, -`startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toFinite`, -`toInteger`, `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, -`toString`, `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, -`uniqueId`, `upperCase`, `upperFirst`, `value`, and `words` +`isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, +`isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, +`isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, +`isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, +`lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, +`min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, +`padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, +`repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, +`snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, +`sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, +`stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, +`template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, +`toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, +`trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, +`upperFirst`, `value`, and `words` #### Arguments 1. `value` *(*)*: The value to wrap in a `lodash` instance. @@ -8346,7 +8367,7 @@ _.isArray(squares.value()); ### `_.chain(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7944 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8006 "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 @@ -8385,7 +8406,7 @@ var youngest = _ ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L7973 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8035 "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 @@ -8418,7 +8439,7 @@ _([1, 2, 3]) ### `_.thru(value, interceptor)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8001 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8063 "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 @@ -8451,7 +8472,7 @@ _(' abc ') ### `_.prototype[Symbol.iterator]()` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8160 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8219 "View in source") [Ⓣ][1] Enables the wrapper to be iterable. @@ -8477,7 +8498,7 @@ Array.from(wrapped); ### `_.prototype.at([paths])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8024 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8083 "View in source") [Ⓣ][1] This method is the wrapper version of `_.at`. @@ -8495,9 +8516,6 @@ var object = { 'a': [{ 'b': { 'c': 3 } }, 4] }; _(object).at(['a[0].b.c', 'a[1]']).value(); // => [3, 4] - -_(['a', 'b', 'c']).at(0, 2).value(); -// => ['a', 'c'] ``` * * * @@ -8506,7 +8524,7 @@ _(['a', 'b', 'c']).at(0, 2).value(); ### `_.prototype.chain()` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8076 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8135 "View in source") [Ⓣ][1] Creates a `lodash` wrapper instance with explicit method chain sequences enabled. @@ -8541,7 +8559,7 @@ _(users) ### `_.prototype.commit()` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8106 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8165 "View in source") [Ⓣ][1] Executes the chain sequence and returns the wrapped result. @@ -8575,7 +8593,7 @@ console.log(array); ### `_.prototype.next()` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8132 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8191 "View in source") [Ⓣ][1] Gets the next value on a wrapped object following the [iterator protocol](https://mdn.io/iteration_protocols#iterator). @@ -8605,7 +8623,7 @@ wrapped.next(); ### `_.prototype.plant(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8188 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8247 "View in source") [Ⓣ][1] Creates a clone of the chain sequence planting `value` as the wrapped value. @@ -8639,7 +8657,7 @@ wrapped.value(); ### `_.prototype.reverse()` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8228 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8287 "View in source") [Ⓣ][1] This method is the wrapper version of `_.reverse`.
@@ -8668,7 +8686,7 @@ console.log(array); ### `_.prototype.value()` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L8260 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L8319 "View in source") [Ⓣ][1] Executes the chain sequence to resolve the unwrapped value. @@ -8698,7 +8716,7 @@ _([1, 2, 3]).value(); ### `_.camelCase([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13390 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.camelcase "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13447 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.camelcase "See the npm package") Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). @@ -8728,7 +8746,7 @@ _.camelCase('__FOO_BAR__'); ### `_.capitalize([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13410 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.capitalize "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13467 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.capitalize "See the npm package") Converts the first character of `string` to upper case and the remaining to lower case. @@ -8753,7 +8771,7 @@ _.capitalize('FRED'); ### `_.deburr([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13431 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.deburr "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13488 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.deburr "See the npm package") Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) @@ -8780,7 +8798,7 @@ _.deburr('dĂ©jĂ  vu'); ### `_.endsWith([string=''], [target], [position=string.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13459 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.endswith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13516 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.endswith "See the npm package") Checks if `string` ends with the given target string. @@ -8789,7 +8807,7 @@ Checks if `string` ends with the given target string. #### Arguments 1. `[string='']` *(string)*: The string to search. 2. `[target]` *(string)*: The string to search for. -3. `[position=string.length]` *(number)*: The position to search from. +3. `[position=string.length]` *(number)*: The position to search up to. #### Returns *(boolean)*: Returns `true` if `string` ends with `target`, else `false`. @@ -8812,7 +8830,7 @@ _.endsWith('abc', 'b', 2); ### `_.escape([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13506 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escape "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13563 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escape "See the npm package") Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to their corresponding HTML entities. @@ -8860,7 +8878,7 @@ _.escape('fred, barney, & pebbles'); ### `_.escapeRegExp([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13528 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escaperegexp "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13585 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escaperegexp "See the npm package") Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. @@ -8885,7 +8903,7 @@ _.escapeRegExp('[lodash](https://lodash.com/)'); ### `_.kebabCase([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13556 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.kebabcase "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13613 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.kebabcase "See the npm package") Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). @@ -8916,7 +8934,7 @@ _.kebabCase('__FOO_BAR__'); ### `_.lowerCase([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13580 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lowercase "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13637 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lowercase "See the npm package") Converts `string`, as space separated words, to lower case. @@ -8946,7 +8964,7 @@ _.lowerCase('__FOO_BAR__'); ### `_.lowerFirst([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13601 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lowerfirst "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13658 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lowerfirst "See the npm package") Converts the first character of `string` to lower case. @@ -8973,7 +8991,7 @@ _.lowerFirst('FRED'); ### `_.pad([string=''], [length=0], [chars=' '])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13626 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pad "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13683 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pad "See the npm package") 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`. @@ -9006,7 +9024,7 @@ _.pad('abc', 3); ### `_.padEnd([string=''], [length=0], [chars=' '])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13665 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padend "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13722 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padend "See the npm package") Pads `string` on the right side if it's shorter than `length`. Padding characters are truncated if they exceed `length`. @@ -9039,7 +9057,7 @@ _.padEnd('abc', 3); ### `_.padStart([string=''], [length=0], [chars=' '])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13698 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padstart "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13755 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padstart "See the npm package") Pads `string` on the left side if it's shorter than `length`. Padding characters are truncated if they exceed `length`. @@ -9072,7 +9090,7 @@ _.padStart('abc', 3); ### `_.parseInt(string, [radix=10])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13732 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.parseint "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13789 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.parseint "See the npm package") 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 @@ -9106,7 +9124,7 @@ _.map(['6', '08', '10'], _.parseInt); ### `_.repeat([string=''], [n=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13766 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.repeat "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13823 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.repeat "See the npm package") Repeats the given string `n` times. @@ -9137,7 +9155,7 @@ _.repeat('abc', 0); ### `_.replace([string=''], pattern, replacement)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13794 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.replace "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13851 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.replace "See the npm package") Replaces matches for `pattern` in `string` with `replacement`.
@@ -9167,7 +9185,7 @@ _.replace('Hi Fred', 'Fred', 'Barney'); ### `_.snakeCase([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13822 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.snakecase "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13879 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.snakecase "See the npm package") Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). @@ -9198,7 +9216,7 @@ _.snakeCase('--FOO-BAR--'); ### `_.split([string=''], separator, [limit])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13845 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.split "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13902 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.split "See the npm package") Splits `string` by `separator`.
@@ -9228,7 +9246,7 @@ _.split('a-b-c', '-', 2); ### `_.startCase([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13887 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startcase "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13944 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startcase "See the npm package") Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). @@ -9259,7 +9277,7 @@ _.startCase('__FOO_BAR__'); ### `_.startsWith([string=''], [target], [position=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L13914 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startswith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L13971 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startswith "See the npm package") Checks if `string` starts with the given target string. @@ -9291,7 +9309,7 @@ _.startsWith('abc', 'b', 1); ### `_.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.12.0/lodash.js#L14023 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.template "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14080 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.template "See the npm package") Creates a compiled template function that can interpolate data properties in "interpolate" delimiters, HTML-escape interpolated data properties in @@ -9400,7 +9418,7 @@ fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\ ### `_.toLower([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14152 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tolower "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14209 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tolower "See the npm package") Converts `string`, as a whole, to lower case just like [String#toLowerCase](https://mdn.io/toLowerCase). @@ -9431,7 +9449,7 @@ _.toLower('__FOO_BAR__'); ### `_.toUpper([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14177 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toupper "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14234 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toupper "See the npm package") Converts `string`, as a whole, to upper case just like [String#toUpperCase](https://mdn.io/toUpperCase). @@ -9462,7 +9480,7 @@ _.toUpper('__foo_bar__'); ### `_.trim([string=''], [chars=whitespace])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14203 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trim "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14260 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trim "See the npm package") Removes leading and trailing whitespace or specified characters from `string`. @@ -9493,7 +9511,7 @@ _.map([' foo ', ' bar '], _.trim); ### `_.trimEnd([string=''], [chars=whitespace])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14238 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimend "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14295 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimend "See the npm package") Removes trailing whitespace or specified characters from `string`. @@ -9521,7 +9539,7 @@ _.trimEnd('-_-abc-_-', '_-'); ### `_.trimStart([string=''], [chars=whitespace])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14271 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimstart "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14328 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimstart "See the npm package") Removes leading whitespace or specified characters from `string`. @@ -9549,7 +9567,7 @@ _.trimStart('-_-abc-_-', '_-'); ### `_.truncate([string=''], [options={}], [options.length=30], [options.omission='...'], [options.separator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14322 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.truncate "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14379 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.truncate "See the npm package") Truncates `string` if it's longer than the given maximum string length. The last characters of the truncated string are replaced with the omission @@ -9596,7 +9614,7 @@ _.truncate('hi-diddly-ho there, neighborino', { ### `_.unescape([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14397 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unescape "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14454 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unescape "See the npm package") The inverse of `_.escape`; this method converts the HTML entities `&`, `<`, `>`, `"`, `'`, and ``` in `string` to @@ -9626,7 +9644,7 @@ _.unescape('fred, barney, & pebbles'); ### `_.upperCase([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14424 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uppercase "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14481 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uppercase "See the npm package") Converts `string`, as space separated words, to upper case. @@ -9656,7 +9674,7 @@ _.upperCase('__foo_bar__'); ### `_.upperFirst([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14445 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.upperfirst "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14502 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.upperfirst "See the npm package") Converts the first character of `string` to upper case. @@ -9683,7 +9701,7 @@ _.upperFirst('FRED'); ### `_.words([string=''], [pattern])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14466 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.words "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14523 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.words "See the npm package") Splits `string` into an array of its words. @@ -9717,7 +9735,7 @@ _.words('fred, barney, & pebbles', /[^, ]+/g); ### `_.attempt(func, [args])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14500 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.attempt "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14557 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.attempt "See the npm package") Attempts to invoke `func`, returning either the result or the caught error object. Any additional arguments are provided to `func` when it's invoked. @@ -9749,7 +9767,7 @@ if (_.isError(elements)) { ### `_.bindAll(object, methodNames)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14534 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindall "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14591 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindall "See the npm package") Binds methods of an object to the object itself, overwriting the existing method. @@ -9775,7 +9793,7 @@ var view = { } }; -_.bindAll(view, 'onClick'); +_.bindAll(view, ['onClick']); jQuery(element).on('click', view.onClick); // => Logs 'clicked docs' when clicked. ``` @@ -9786,7 +9804,7 @@ jQuery(element).on('click', view.onClick); ### `_.cond(pairs)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14571 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.cond "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14628 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.cond "See the npm package") Creates a function that iterates over `pairs` and invokes the corresponding function of the first predicate to return truthy. The predicate-function @@ -9825,7 +9843,7 @@ func({ 'a': '1', 'b': '2' }); ### `_.conforms(source)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14614 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.conforms "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14671 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.conforms "See the npm package") Creates a function that invokes the predicate properties of `source` with the corresponding property values of a given object, returning `true` if @@ -9846,7 +9864,7 @@ var users = [ { 'user': 'fred', 'age': 40 } ]; -_.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) })); +_.filter(users, _.conforms({ 'age': function(n) { return n > 38; } })); // => [{ 'user': 'fred', 'age': 40 }] ``` * * * @@ -9856,7 +9874,7 @@ _.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) })); ### `_.constant(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14635 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.constant "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14694 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.constant "See the npm package") Creates a function that returns `value`. @@ -9870,10 +9888,12 @@ Creates a function that returns `value`. #### Example ```js -var object = { 'user': 'fred' }; -var getter = _.constant(object); +var objects = _.times(2, _.constant({ 'a': 1 })); -getter() === object; +console.log(objects); +// => [{ 'a': 1 }, { 'a': 1 }] + +console.log(objects[0] === objects[1]); // => true ``` * * * @@ -9883,7 +9903,7 @@ getter() === object; ### `_.flow([funcs])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14663 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flow "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14722 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flow "See the npm package") Creates a function that returns the result of invoking the given functions with the `this` binding of the created function, where each successive @@ -9903,7 +9923,7 @@ function square(n) { return n * n; } -var addSquare = _.flow(_.add, square); +var addSquare = _.flow([_.add, square]); addSquare(1, 2); // => 9 ``` @@ -9914,7 +9934,7 @@ addSquare(1, 2); ### `_.flowRight([funcs])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14686 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flowright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14745 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flowright "See the npm package") This method is like `_.flow` except that it creates a function that invokes the given functions from right to left. @@ -9933,7 +9953,7 @@ function square(n) { return n * n; } -var addSquare = _.flowRight(square, _.add); +var addSquare = _.flowRight([square, _.add]); addSquare(1, 2); // => 9 ``` @@ -9944,7 +9964,7 @@ addSquare(1, 2); ### `_.identity(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14704 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.identity "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14763 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.identity "See the npm package") This method returns the first argument given to it. @@ -9960,7 +9980,7 @@ This method returns the first argument given to it. ```js var object = { 'user': 'fred' }; -_.identity(object) === object; +console.log(_.identity(object) === object); // => true ``` * * * @@ -9970,7 +9990,7 @@ _.identity(object) === object; ### `_.iteratee([func=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14750 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iteratee "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14809 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iteratee "See the npm package") Creates a function that invokes `func` with the arguments of the created function. If `func` is a property name, the created function returns the @@ -10022,7 +10042,7 @@ _.filter(['abc', 'def'], /ef/); ### `_.matches(source)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14778 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matches "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14837 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matches "See the npm package") Creates a function that performs a partial deep comparison between a given object and `source`, returning `true` if the given object has equivalent @@ -10057,7 +10077,7 @@ _.filter(users, _.matches({ 'age': 40, 'active': false })); ### `_.matchesProperty(path, srcValue)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14806 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matchesproperty "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14865 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matchesproperty "See the npm package") Creates a function that performs a partial deep comparison between the value at `path` of a given object to `srcValue`, returning `true` if the @@ -10092,7 +10112,7 @@ _.find(users, _.matchesProperty('user', 'fred')); ### `_.method(path, [args])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14834 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.method "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14893 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.method "See the npm package") Creates a function that invokes the method at `path` of a given object. Any additional arguments are provided to the invoked method. @@ -10126,7 +10146,7 @@ _.map(objects, _.method(['a', 'b'])); ### `_.methodOf(object, [args])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14863 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.methodof "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14922 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.methodof "See the npm package") The opposite of `_.method`; this method creates a function that invokes the method at a given path of `object`. Any additional arguments are @@ -10159,7 +10179,7 @@ _.map([['a', '2'], ['c', '0']], _.methodOf(object)); ### `_.mixin([object=lodash], source, [options={}], [options.chain=true])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14905 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mixin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L14964 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mixin "See the npm package") Adds all own enumerable string keyed function properties of a source object to the destination object. If `object` is a function, then methods @@ -10206,7 +10226,7 @@ _('fred').vowels(); ### `_.noConflict()` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14954 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noconflict "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15013 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noconflict "See the npm package") Reverts the `_` variable to its previous value and returns a reference to the `lodash` function. @@ -10227,19 +10247,16 @@ var lodash = _.noConflict(); ### `_.noop()` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L14976 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noop "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15032 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noop "See the npm package") -A no-operation function that returns `undefined` regardless of the -arguments it receives. +A method that returns `undefined`. #### Since 2.3.0 #### Example ```js -var object = { 'user': 'fred' }; - -_.noop(object) === undefined; -// => true +_.times(2, _.noop); +// => [undefined, undefined] ``` * * * @@ -10248,9 +10265,9 @@ _.noop(object) === undefined; ### `_.nthArg([n=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15000 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ntharg "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15056 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ntharg "See the npm package") -Creates a function that gets the argument at `n` index. If `n` is negative, +Creates a function that gets the argument at index `n`. If `n` is negative, the nth argument from the end is returned. #### Since @@ -10278,7 +10295,7 @@ func('a', 'b', 'c', 'd'); ### `_.over([iteratees=[_.identity]])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15025 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.over "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15081 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.over "See the npm package") Creates a function that invokes `iteratees` with the arguments it receives and returns their results. @@ -10293,7 +10310,7 @@ and returns their results. #### Example ```js -var func = _.over(Math.max, Math.min); +var func = _.over([Math.max, Math.min]); func(1, 2, 3, 4); // => [4, 1] @@ -10305,7 +10322,7 @@ func(1, 2, 3, 4); ### `_.overEvery([predicates=[_.identity]])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15051 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.overevery "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15107 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.overevery "See the npm package") Creates a function that checks if **all** of the `predicates` return truthy when invoked with the arguments it receives. @@ -10320,7 +10337,7 @@ truthy when invoked with the arguments it receives. #### Example ```js -var func = _.overEvery(Boolean, isFinite); +var func = _.overEvery([Boolean, isFinite]); func('1'); // => true @@ -10338,7 +10355,7 @@ func(NaN); ### `_.overSome([predicates=[_.identity]])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15077 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.oversome "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15133 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.oversome "See the npm package") Creates a function that checks if **any** of the `predicates` return truthy when invoked with the arguments it receives. @@ -10353,7 +10370,7 @@ truthy when invoked with the arguments it receives. #### Example ```js -var func = _.overSome(Boolean, isFinite); +var func = _.overSome([Boolean, isFinite]); func('1'); // => true @@ -10371,7 +10388,7 @@ func(NaN); ### `_.property(path)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15101 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.property "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15157 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.property "See the npm package") Creates a function that returns the value at `path` of a given object. @@ -10403,7 +10420,7 @@ _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); ### `_.propertyOf(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15126 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.propertyof "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15182 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.propertyof "See the npm package") The opposite of `_.property`; this method creates a function that returns the value at a given path of `object`. @@ -10434,7 +10451,7 @@ _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); ### `_.range([start=0], end, [step=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15173 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.range "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15229 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.range "See the npm package") 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 @@ -10485,7 +10502,7 @@ _.range(0); ### `_.rangeRight([start=0], end, [step=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15211 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rangeright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15267 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rangeright "See the npm package") This method is like `_.range` except that it populates values in descending order. @@ -10530,7 +10547,7 @@ _.rangeRight(0); ### `_.runInContext([context=root])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L1244 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.runincontext "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L1234 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.runincontext "See the npm package") Create a new pristine `lodash` function using the `context` object. @@ -10559,10 +10576,10 @@ lodash.isFunction(lodash.foo); lodash.isFunction(lodash.bar); // => true -// Use `context` to mock `Date#getTime` use in `_.now`. -var mock = _.runInContext({ +// Use `context` to stub `Date#getTime` use in `_.now`. +var stubbed = _.runInContext({ 'Date': function() { - return { 'getTime': getTimeMock }; + return { 'getTime': stubGetTime }; } }); @@ -10575,8 +10592,123 @@ var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; +### `_.stubArray()` +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15287 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.stubarray "See the npm package") + +A method that returns a new empty array. + +#### Since +4.13.0 +#### Returns +*(Array)*: Returns the new empty array. + +#### Example +```js +var arrays = _.times(2, _.stubArray); + +console.log(arrays); +// => [[], []] + +console.log(arrays[0] === arrays[1]); +// => false +``` +* * * + + + + + +### `_.stubFalse()` +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15304 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.stubfalse "See the npm package") + +A method that returns `false`. + +#### Since +4.13.0 +#### Returns +*(boolean)*: Returns `false`. + +#### Example +```js +_.times(2, _.stubFalse); +// => [false, false] +``` +* * * + + + + + +### `_.stubObject()` +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15326 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.stubobject "See the npm package") + +A method that returns a new empty object. + +#### Since +4.13.0 +#### Returns +*(Object)*: Returns the new empty object. + +#### Example +```js +var objects = _.times(2, _.stubObject); + +console.log(objects); +// => [{}, {}] + +console.log(objects[0] === objects[1]); +// => false +``` +* * * + + + + + +### `_.stubString()` +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15343 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.stubstring "See the npm package") + +A method that returns an empty string. + +#### Since +4.13.0 +#### Returns +*(string)*: Returns the empty string. + +#### Example +```js +_.times(2, _.stubString); +// => ['', ''] +``` +* * * + + + + + +### `_.stubTrue()` +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15360 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.stubtrue "See the npm package") + +A method that returns `true`. + +#### Since +4.13.0 +#### Returns +*(boolean)*: Returns `true`. + +#### Example +```js +_.times(2, _.stubTrue); +// => [true, true] +``` +* * * + + + + + ### `_.times(n, [iteratee=_.identity])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15232 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.times "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15383 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.times "See the npm package") Invokes the iteratee `n` times, returning an array of the results of each invocation. The iteratee is invoked with one argument; *(index)*. @@ -10595,8 +10727,8 @@ each invocation. The iteratee is invoked with one argument; *(index)*. _.times(3, String); // => ['0', '1', '2'] - _.times(4, _.constant(true)); -// => [true, true, true, true] + _.times(4, _.constant(0)); +// => [0, 0, 0, 0] ``` * * * @@ -10605,7 +10737,7 @@ _.times(3, String); ### `_.toPath(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15276 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topath "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15418 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topath "See the npm package") Converts `value` to a property path array. @@ -10624,15 +10756,6 @@ _.toPath('a.b.c'); _.toPath('a[0].b.c'); // => ['a', '0', 'b', 'c'] - -var path = ['a', 'b', 'c'], - newPath = _.toPath(path); - -console.log(newPath); -// => ['a', 'b', 'c'] - -console.log(path === newPath); -// => false ``` * * * @@ -10641,7 +10764,7 @@ console.log(path === newPath); ### `_.uniqueId([prefix=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15300 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqueid "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L15442 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqueid "See the npm package") Generates a unique ID. If `prefix` is given, the ID is appended to it. @@ -10674,7 +10797,7 @@ _.uniqueId(); ### `_.VERSION` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L15988 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L16135 "View in source") [Ⓣ][1] (string): The semantic version number. @@ -10685,7 +10808,7 @@ _.uniqueId(); ### `_.templateSettings` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L1507 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.templatesettings "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L1509 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.templatesettings "See the npm package") (Object): By default, the template delimiters used by lodash are like those in embedded Ruby *(ERB)*. Change the following template settings to use @@ -10698,7 +10821,7 @@ alternative delimiters. ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L1515 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L1517 "View in source") [Ⓣ][1] (RegExp): Used to detect `data` property values to be HTML-escaped. @@ -10709,7 +10832,7 @@ alternative delimiters. ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L1523 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L1525 "View in source") [Ⓣ][1] (RegExp): Used to detect code to be evaluated. @@ -10720,7 +10843,7 @@ alternative delimiters. ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L1547 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L1549 "View in source") [Ⓣ][1] (Object): Used to import variables into the compiled template. @@ -10731,7 +10854,7 @@ alternative delimiters. ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L1531 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L1533 "View in source") [Ⓣ][1] (RegExp): Used to detect `data` property values to inject. @@ -10742,7 +10865,7 @@ alternative delimiters. ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L1539 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L1541 "View in source") [Ⓣ][1] (string): Used to reference the data object in the template text. @@ -10759,7 +10882,7 @@ alternative delimiters. ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/lodash/lodash/blob/4.12.0/lodash.js#L1555 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/4.13.0/lodash.js#L1557 "View in source") [Ⓣ][1] A reference to the `lodash` function. diff --git a/fp/_mapping.js b/fp/_mapping.js index 178e4d6d4a..a30c5dee41 100644 --- a/fp/_mapping.js +++ b/fp/_mapping.js @@ -84,12 +84,13 @@ exports.aryMethod = { ], '3': [ 'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith', - 'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'invokeArgs', - 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth', 'mergeWith', - 'orderBy', 'padChars', 'padCharsEnd', 'padCharsStart', 'pullAllBy', - 'pullAllWith', 'reduce', 'reduceRight', 'replace', 'set', 'slice', - 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', - 'update', 'xorBy', 'xorWith', 'zipWith' + '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' @@ -110,10 +111,14 @@ exports.iterateeAry = { '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, @@ -148,7 +153,11 @@ exports.iterateeRearg = { exports.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], @@ -160,7 +169,11 @@ exports.methodRearg = { '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] }; @@ -235,9 +248,16 @@ exports.realToAlias = (function() { exports.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', @@ -284,7 +304,6 @@ exports.skipRearg = { 'range': true, 'rangeRight': true, 'subtract': true, - 'without': true, 'zip': true, 'zipObject': true }; diff --git a/lib/main/build-doc.js b/lib/main/build-doc.js index 97569549c0..6c5f22b577 100644 --- a/lib/main/build-doc.js +++ b/lib/main/build-doc.js @@ -33,13 +33,8 @@ var config = { }; function postprocess(string) { - // Fix docdown bugs. - return string - // Repair the default value of `chars`. - // See https://github.com/eslint/doctrine/issues/157 for more details. - .replace(/\bchars=''/g, "chars=' '") - // Wrap symbol property identifiers in brackets. - .replace(/\.(Symbol\.(?:[a-z]+[A-Z]?)+)/g, '[$1]'); + // Wrap symbol property identifiers in brackets. + return string.replace(/\.(Symbol\.(?:[a-z]+[A-Z]?)+)/g, '[$1]'); } /*----------------------------------------------------------------------------*/ diff --git a/lodash.js b/lodash.js index 4bcb6ca88c..3fef2c8e86 100644 --- a/lodash.js +++ b/lodash.js @@ -12,7 +12,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.12.0'; + var VERSION = '4.13.0'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -116,7 +116,7 @@ /** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g; + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g; /** * Used to match `RegExp` @@ -249,7 +249,7 @@ 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object', 'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', - '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout' + '_', 'isFinite', 'parseInt', 'setTimeout' ]; /** Used to make template sourceURLs easier to identify. */ @@ -328,12 +328,6 @@ '`': '`' }; - /** Used to determine if values are of the language type `Object`. */ - var objectTypes = { - 'function': true, - 'object': true - }; - /** Used to escape characters for inclusion in compiled string literals. */ var stringEscapes = { '\\': '\\', @@ -349,41 +343,25 @@ freeParseInt = parseInt; /** Detect free variable `exports`. */ - var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) - ? exports - : undefined; + var freeExports = typeof exports == 'object' && exports; /** Detect free variable `module`. */ - var freeModule = (objectTypes[typeof module] && module && !module.nodeType) - ? module - : undefined; + var freeModule = freeExports && typeof module == 'object' && module; /** Detect the popular CommonJS extension `module.exports`. */ - var moduleExports = (freeModule && freeModule.exports === freeExports) - ? freeExports - : undefined; + var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `global` from Node.js. */ - var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); + var freeGlobal = checkGlobal(typeof global == 'object' && global); /** Detect free variable `self`. */ - var freeSelf = checkGlobal(objectTypes[typeof self] && self); - - /** Detect free variable `window`. */ - var freeWindow = checkGlobal(objectTypes[typeof window] && window); + var freeSelf = checkGlobal(typeof self == 'object' && self); /** Detect `this` as the global object. */ - var thisGlobal = checkGlobal(objectTypes[typeof this] && this); + var thisGlobal = checkGlobal(typeof this == 'object' && this); - /** - * Used as a reference to the global object. - * - * The `this` value is used if it's the global object to avoid Greasemonkey's - * restricted `window` object, otherwise the `window` object is used. - */ - var root = freeGlobal || - ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || - freeSelf || thisGlobal || Function('return this')(); + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || thisGlobal || Function('return this')(); /*--------------------------------------------------------------------------*/ @@ -439,7 +417,7 @@ * A specialized version of `baseAggregator` for arrays. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} setter The function to set `accumulator` values. * @param {Function} iteratee The iteratee to transform keys. * @param {Object} accumulator The initial aggregated object. @@ -447,7 +425,7 @@ */ function arrayAggregator(array, setter, iteratee, accumulator) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { var value = array[index]; @@ -461,13 +439,13 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { if (iteratee(array[index], index, array) === false) { @@ -482,12 +460,12 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEachRight(array, iteratee) { - var length = array.length; + var length = array ? array.length : 0; while (length--) { if (iteratee(array[length], length, array) === false) { @@ -502,14 +480,14 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if all elements pass the predicate check, * else `false`. */ function arrayEvery(array, predicate) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { if (!predicate(array[index], index, array)) { @@ -524,13 +502,13 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, - length = array.length, + length = array ? array.length : 0, resIndex = 0, result = []; @@ -548,26 +526,27 @@ * specifying an index to search from. * * @private - * @param {Array} array The array to search. + * @param {Array} [array] The array to search. * @param {*} target The value to search for. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludes(array, value) { - return !!array.length && baseIndexOf(array, value, 0) > -1; + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; } /** * This function is like `arrayIncludes` except that it accepts a comparator. * * @private - * @param {Array} array The array to search. + * @param {Array} [array] The array to search. * @param {*} target The value to search for. * @param {Function} comparator The comparator invoked per element. * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludesWith(array, value, comparator) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { if (comparator(value, array[index])) { @@ -582,13 +561,13 @@ * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, - length = array.length, + length = array ? array.length : 0, result = Array(length); while (++index < length) { @@ -621,7 +600,7 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as @@ -630,7 +609,7 @@ */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, - length = array.length; + length = array ? array.length : 0; if (initAccum && length) { accumulator = array[++index]; @@ -646,7 +625,7 @@ * iteratee shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the last element of `array` as @@ -654,7 +633,7 @@ * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initAccum) { - var length = array.length; + var length = array ? array.length : 0; if (initAccum && length) { accumulator = array[--length]; } @@ -669,14 +648,14 @@ * shorthands. * * @private - * @param {Array} array The array to iterate over. + * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, - length = array.length; + length = array ? array.length : 0; while (++index < length) { if (predicate(array[index], index, array)) { @@ -687,23 +666,21 @@ } /** - * The base implementation of methods like `_.find` and `_.findKey`, without - * support for iteratee shorthands, which iterates over `collection` using - * `eachFunc`. + * The base implementation of methods like `_.findKey` and `_.findLastKey`, + * without support for iteratee shorthands, which iterates over `collection` + * using `eachFunc`. * * @private * @param {Array|Object} collection The collection to search. * @param {Function} predicate The function invoked per iteration. * @param {Function} eachFunc The function to iterate over `collection`. - * @param {boolean} [retKey] Specify returning the key of the found element - * instead of the element itself. * @returns {*} Returns the found element or its key, else `undefined`. */ - function baseFind(collection, predicate, eachFunc, retKey) { + function baseFindKey(collection, predicate, eachFunc) { var result; eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { - result = retKey ? key : value; + result = key; return false; } }); @@ -717,12 +694,13 @@ * @private * @param {Array} array The array to search. * @param {Function} predicate The function invoked per iteration. + * @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 value, else `-1`. */ - function baseFindIndex(array, predicate, fromRight) { + function baseFindIndex(array, predicate, fromIndex, fromRight) { var length = array.length, - index = fromRight ? length : -1; + index = fromIndex + (fromRight ? 1 : -1); while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { @@ -1029,6 +1007,18 @@ return '\\' + stringEscapes[chr]; } + /** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ + function getValue(object, key) { + return object == null ? undefined : object[key]; + } + /** * Gets the index at which the first occurrence of `NaN` is found in `array`. * @@ -1040,7 +1030,7 @@ */ function indexOfNaN(array, fromIndex, fromRight) { var length = array.length, - index = fromIndex + (fromRight ? 0 : -1); + index = fromIndex + (fromRight ? 1 : -1); while ((fromRight ? index-- : ++index < length)) { var other = array[index]; @@ -1231,10 +1221,10 @@ * lodash.isFunction(lodash.bar); * // => true * - * // Use `context` to mock `Date#getTime` use in `_.now`. - * var mock = _.runInContext({ + * // Use `context` to stub `Date#getTime` use in `_.now`. + * var stubbed = _.runInContext({ * 'Date': function() { - * return { 'getTime': getTimeMock }; + * return { 'getTime': stubGetTime }; * } * }); * @@ -1256,6 +1246,15 @@ objectProto = context.Object.prototype, stringProto = context.String.prototype; + /** Used to detect overreaching core-js shims. */ + var coreJsData = context['__core-js_shared__']; + + /** Used to detect methods masquerading as native. */ + var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; + }()); + /** Used to resolve the decompiled source of functions. */ var funcToString = context.Function.prototype.toString; @@ -1289,15 +1288,16 @@ Reflect = context.Reflect, Symbol = context.Symbol, Uint8Array = context.Uint8Array, - clearTimeout = context.clearTimeout, enumerate = Reflect ? Reflect.enumerate : undefined, getOwnPropertySymbols = Object.getOwnPropertySymbols, iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined, objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, - setTimeout = context.setTimeout, splice = arrayProto.splice; + /** Built-in method references that are mockable. */ + var 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, @@ -1419,19 +1419,21 @@ * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, * `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, * `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, - * `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, - * `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, - * `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`, - * `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`, - * `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`, - * `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`, - * `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`, - * `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, - * `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, - * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toFinite`, - * `toInteger`, `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, - * `toString`, `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, - * `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words` + * `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, + * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, + * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`, + * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`, + * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, + * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`, + * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, + * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, + * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`, + * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`, + * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`, + * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`, + * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`, + * `upperFirst`, `value`, and `words` * * @name _ * @constructor @@ -2732,7 +2734,7 @@ * The base implementation of `_.has` without support for deep paths. * * @private - * @param {Object} object The object to query. + * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ @@ -2740,20 +2742,21 @@ // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, // that are composed entirely of index properties, return `false` for // `hasOwnProperty` checks of them. - return hasOwnProperty.call(object, key) || - (typeof object == 'object' && key in object && getPrototype(object) === null); + return object != null && + (hasOwnProperty.call(object, key) || + (typeof object == 'object' && key in object && getPrototype(object) === null)); } /** * The base implementation of `_.hasIn` without support for deep paths. * * @private - * @param {Object} object The object to query. + * @param {Object} [object] The object to query. * @param {Array|string} key The key to check. * @returns {boolean} Returns `true` if `key` exists, else `false`. */ function baseHasIn(object, key) { - return key in Object(object); + return object != null && key in Object(object); } /** @@ -3007,6 +3010,22 @@ return true; } + /** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ + function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); + } + /** * The base implementation of `_.iteratee`. * @@ -3375,6 +3394,9 @@ length = values.length, seen = array; + if (array === values) { + values = copyArray(values); + } if (iteratee) { seen = arrayMap(array, baseUnary(iteratee)); } @@ -4890,7 +4912,7 @@ var func = Math[methodName]; return function(number, precision) { number = toNumber(number); - precision = toInteger(precision); + precision = nativeMin(toInteger(precision), 292); if (precision) { // Shift with exponential notation to avoid floating-point issues. // See [MDN](https://mdn.io/round#Examples) for more details. @@ -5371,11 +5393,14 @@ * @returns {Array} Returns the match data of `object`. */ function getMatchData(object) { - var result = toPairs(object), + var result = keys(object), length = result.length; while (length--) { - result[length][2] = isStrictComparable(result[length][1]); + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; } return result; } @@ -5389,8 +5414,8 @@ * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = object[key]; - return isNative(value) ? value : undefined; + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; } /** @@ -5419,9 +5444,7 @@ // Fallback for IE < 11. if (!getOwnPropertySymbols) { - getSymbols = function() { - return []; - }; + getSymbols = stubArray; } /** @@ -5753,6 +5776,26 @@ return !!data && func === data[0]; } + /** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ + function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); + } + + /** + * Checks if `func` is capable of being masked. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `func` is maskable, else `false`. + */ + var isMaskable = !coreJsData ? stubFalse : isFunction; + /** * Checks if `value` is likely a prototype object. * @@ -6149,8 +6192,8 @@ * @see _.without, _.xor * @example * - * _.difference([3, 2, 1], [4, 2]); - * // => [3, 1] + * _.difference([2, 1], [2, 3]); + * // => [1] */ var difference = rest(function(array, values) { return isArrayLikeObject(array) @@ -6175,8 +6218,8 @@ * @returns {Array} Returns the new array of filtered values. * @example * - * _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor); - * // => [3.1, 1.3] + * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2] * * // The `_.property` iteratee shorthand. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); @@ -6428,6 +6471,7 @@ * @param {Array} array The array to search. * @param {Array|Function|Object|string} [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`. * @example * @@ -6452,10 +6496,16 @@ * _.findIndex(users, 'active'); * // => 2 */ - function findIndex(array, predicate) { - return (array && array.length) - ? baseFindIndex(array, getIteratee(predicate, 3)) - : -1; + function findIndex(array, predicate, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); + } + return baseFindIndex(array, getIteratee(predicate, 3), index); } /** @@ -6469,6 +6519,7 @@ * @param {Array} array The array to search. * @param {Array|Function|Object|string} [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`. * @example * @@ -6493,10 +6544,19 @@ * _.findLastIndex(users, 'active'); * // => 0 */ - function findLastIndex(array, predicate) { - return (array && array.length) - ? baseFindIndex(array, getIteratee(predicate, 3), true) - : -1; + function findLastIndex(array, predicate, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = length - 1; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = fromIndex < 0 + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); + } + return baseFindIndex(array, getIteratee(predicate, 3), index, true); } /** @@ -6643,11 +6703,11 @@ if (!length) { return -1; } - fromIndex = toInteger(fromIndex); - if (fromIndex < 0) { - fromIndex = nativeMax(length + fromIndex, 0); + var index = fromIndex == null ? 0 : toInteger(fromIndex); + if (index < 0) { + index = nativeMax(length + index, 0); } - return baseIndexOf(array, value, fromIndex); + return baseIndexOf(array, value, index); } /** @@ -6682,7 +6742,7 @@ * @returns {Array} Returns the new array of intersecting values. * @example * - * _.intersection([2, 1], [4, 2], [1, 2]); + * _.intersection([2, 1], [2, 3]); * // => [2] */ var intersection = rest(function(arrays) { @@ -6708,7 +6768,7 @@ * @returns {Array} Returns the new array of intersecting values. * @example * - * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); * // => [2.1] * * // The `_.property` iteratee shorthand. @@ -6838,7 +6898,7 @@ ) + 1; } if (value !== value) { - return indexOfNaN(array, index, true); + return indexOfNaN(array, index - 1, true); } while (index--) { if (array[index] === value) { @@ -6849,7 +6909,7 @@ } /** - * Gets the element at `n` index of `array`. If `n` is negative, the nth + * Gets the element at index `n` of `array`. If `n` is negative, the nth * element from the end is returned. * * @static @@ -6890,11 +6950,11 @@ * @returns {Array} Returns `array`. * @example * - * var array = [1, 2, 3, 1, 2, 3]; + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; * - * _.pull(array, 2, 3); + * _.pull(array, 'a', 'c'); * console.log(array); - * // => [1, 1] + * // => ['b', 'b'] */ var pull = rest(pullAll); @@ -6912,11 +6972,11 @@ * @returns {Array} Returns `array`. * @example * - * var array = [1, 2, 3, 1, 2, 3]; + * var array = ['a', 'b', 'c', 'a', 'b', 'c']; * - * _.pullAll(array, [2, 3]); + * _.pullAll(array, ['a', 'c']); * console.log(array); - * // => [1, 1] + * // => ['b', 'b'] */ function pullAll(array, values) { return (array && array.length && values && values.length) @@ -6998,14 +7058,14 @@ * @returns {Array} Returns the new array of removed elements. * @example * - * var array = [5, 10, 15, 20]; - * var evens = _.pullAt(array, 1, 3); + * var array = ['a', 'b', 'c', 'd']; + * var pulled = _.pullAt(array, [1, 3]); * * console.log(array); - * // => [5, 15] + * // => ['a', 'c'] * - * console.log(evens); - * // => [10, 20] + * console.log(pulled); + * // => ['b', 'd'] */ var pullAt = rest(function(array, indexes) { indexes = baseFlatten(indexes, 1); @@ -7145,9 +7205,6 @@ * * _.sortedIndex([30, 50], 40); * // => 1 - * - * _.sortedIndex([4, 5], 4); - * // => 0 */ function sortedIndex(array, value) { return baseSortedIndex(array, value); @@ -7170,13 +7227,13 @@ * into `array`. * @example * - * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; + * var objects = [{ 'x': 4 }, { 'x': 5 }]; * - * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); - * // => 1 + * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 0 * * // The `_.property` iteratee shorthand. - * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * _.sortedIndexBy(objects, { 'x': 4 }, 'x'); * // => 0 */ function sortedIndexBy(array, value, iteratee) { @@ -7196,8 +7253,8 @@ * @returns {number} Returns the index of the matched value, else `-1`. * @example * - * _.sortedIndexOf([1, 1, 2, 2], 2); - * // => 2 + * _.sortedIndexOf([4, 5, 5, 5, 6], 5); + * // => 1 */ function sortedIndexOf(array, value) { var length = array ? array.length : 0; @@ -7225,8 +7282,8 @@ * into `array`. * @example * - * _.sortedLastIndex([4, 5], 4); - * // => 1 + * _.sortedLastIndex([4, 5, 5, 5, 6], 5); + * // => 4 */ function sortedLastIndex(array, value) { return baseSortedIndex(array, value, true); @@ -7249,8 +7306,13 @@ * into `array`. * @example * + * var objects = [{ 'x': 4 }, { 'x': 5 }]; + * + * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; }); + * // => 1 + * * // The `_.property` iteratee shorthand. - * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); + * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x'); * // => 1 */ function sortedLastIndexBy(array, value, iteratee) { @@ -7270,7 +7332,7 @@ * @returns {number} Returns the index of the matched value, else `-1`. * @example * - * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5); * // => 3 */ function sortedLastIndexOf(array, value) { @@ -7510,8 +7572,8 @@ * @returns {Array} Returns the new array of combined values. * @example * - * _.union([2, 1], [4, 2], [1, 2]); - * // => [2, 1, 4] + * _.union([2], [1, 2]); + * // => [2, 1] */ var union = rest(function(arrays) { return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); @@ -7533,8 +7595,8 @@ * @returns {Array} Returns the new array of combined values. * @example * - * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); - * // => [2.1, 1.2, 4.3] + * _.unionBy([2.1], [1.2, 2.3], Math.floor); + * // => [2.1, 1.2] * * // The `_.property` iteratee shorthand. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); @@ -7641,7 +7703,7 @@ * @returns {Array} Returns the new duplicate free array. * @example * - * 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 }]; * * _.uniqWith(objects, _.isEqual); * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] @@ -7736,7 +7798,7 @@ * @see _.difference, _.xor * @example * - * _.without([1, 2, 1, 3], 1, 2); + * _.without([2, 1, 2, 3], 1, 2); * // => [3] */ var without = rest(function(array, values) { @@ -7760,8 +7822,8 @@ * @see _.difference, _.without * @example * - * _.xor([2, 1], [4, 2]); - * // => [1, 4] + * _.xor([2, 1], [2, 3]); + * // => [1, 3] */ var xor = rest(function(arrays) { return baseXor(arrayFilter(arrays, isArrayLikeObject)); @@ -7783,8 +7845,8 @@ * @returns {Array} Returns the new array of filtered values. * @example * - * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); - * // => [1.2, 4.3] + * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); + * // => [1.2, 3.4] * * // The `_.property` iteratee shorthand. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); @@ -8017,9 +8079,6 @@ * * _(object).at(['a[0].b.c', 'a[1]']).value(); * // => [3, 4] - * - * _(['a', 'b', 'c']).at(0, 2).value(); - * // => ['a', 'c'] */ var wrapperAt = rest(function(paths) { paths = baseFlatten(paths, 1); @@ -8282,6 +8341,7 @@ * _.countBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': 1, '6': 2 } * + * // The `_.property` iteratee shorthand. * _.countBy(['one', 'two', 'three'], 'length'); * // => { '3': 2, '5': 1 } */ @@ -8387,6 +8447,7 @@ * @param {Array|Object} collection The collection to search. * @param {Array|Function|Object|string} [predicate=_.identity] * The function invoked per iteration. + * @param {number} [fromIndex=0] The index to search from. * @returns {*} Returns the matched element, else `undefined`. * @example * @@ -8411,13 +8472,10 @@ * _.find(users, 'active'); * // => object for 'barney' */ - function find(collection, predicate) { - predicate = getIteratee(predicate, 3); - if (isArray(collection)) { - var index = baseFindIndex(collection, predicate); - return index > -1 ? collection[index] : undefined; - } - return baseFind(collection, predicate, baseEach); + function find(collection, predicate, fromIndex) { + collection = isArrayLike(collection) ? collection : values(collection); + var index = findIndex(collection, predicate, fromIndex); + return index > -1 ? collection[index] : undefined; } /** @@ -8431,6 +8489,7 @@ * @param {Array|Object} collection The collection to search. * @param {Array|Function|Object|string} [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`. * @example * @@ -8439,13 +8498,10 @@ * }); * // => 3 */ - function findLast(collection, predicate) { - predicate = getIteratee(predicate, 3); - if (isArray(collection)) { - var index = baseFindIndex(collection, predicate, true); - return index > -1 ? collection[index] : undefined; - } - return baseFind(collection, predicate, baseEachRight); + function findLast(collection, predicate, fromIndex) { + collection = isArrayLike(collection) ? collection : values(collection); + var index = findLastIndex(collection, predicate, fromIndex); + return index > -1 ? collection[index] : undefined; } /** @@ -9203,7 +9259,6 @@ * @static * @memberOf _ * @since 2.4.0 - * @type {Function} * @category Date * @returns {number} Returns the timestamp. * @example @@ -9211,9 +9266,11 @@ * _.defer(function(stamp) { * console.log(_.now() - stamp); * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred function to be invoked. + * // => Logs the number of milliseconds it took for the deferred invocation. */ - var now = Date.now; + function now() { + return Date.now(); + } /*------------------------------------------------------------------------*/ @@ -9317,7 +9374,7 @@ * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * - * **Note:** Unlike native `Function#bind` this method doesn't set the "length" + * **Note:** Unlike native `Function#bind`, this method doesn't set the "length" * property of bound functions. * * @static @@ -9557,7 +9614,7 @@ maxWait, result, timerId, - lastCallTime = 0, + lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, @@ -9608,7 +9665,7 @@ // Either this is the first call, activity has stopped and we're at the // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. - return (!lastCallTime || (timeSinceLastCall >= wait) || + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } @@ -9622,7 +9679,6 @@ } function trailingEdge(time) { - clearTimeout(timerId); timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been @@ -9635,11 +9691,8 @@ } function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); - } - lastCallTime = lastInvokeTime = 0; - lastArgs = lastThis = timerId = undefined; + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; } function flush() { @@ -9660,7 +9713,6 @@ } if (maxing) { // Handle invocations in a tight loop. - clearTimeout(timerId); timerId = setTimeout(timerExpired, wait); return invokeFunc(lastCallTime); } @@ -9884,7 +9936,7 @@ * * var func = _.overArgs(function(x, y) { * return [x, y]; - * }, square, doubled); + * }, [square, doubled]); * * func(9, 3); * // => [81, 6] @@ -10001,7 +10053,7 @@ * * var rearged = _.rearg(function(a, b, c) { * return [a, b, c]; - * }, 2, 0, 1); + * }, [2, 0, 1]); * * rearged('b', 'c', 'a') * // => ['a', 'b', 'c'] @@ -10640,7 +10692,7 @@ * _.isBuffer(new Uint8Array(2)); * // => false */ - var isBuffer = !Buffer ? constant(false) : function(value) { + var isBuffer = !Buffer ? stubFalse : function(value) { return value instanceof Buffer; }; @@ -11140,7 +11192,15 @@ } /** - * Checks if `value` is a native function. + * 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`. * * @static * @memberOf _ @@ -11158,11 +11218,10 @@ * // => false */ function isNative(value) { - if (!isObject(value)) { - return false; + if (isMaskable(value)) { + throw new Error('This method is not supported with `core-js`. Try https://github.com/es-shims.'); } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); + return baseIsNative(value); } /** @@ -11624,7 +11683,7 @@ /** * Converts `value` to an integer. * - * **Note:** This function is loosely based on + * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * * @static @@ -11978,9 +12037,6 @@ * * _.at(object, ['a[0].b.c', 'a[1]']); * // => [3, 4] - * - * _.at(['a', 'b', 'c'], 0, 2); - * // => ['a', 'c'] */ var at = rest(function(object, paths) { return baseAt(object, baseFlatten(paths, 1)); @@ -12113,7 +12169,7 @@ * // => 'barney' */ function findKey(object, predicate) { - return baseFind(object, getIteratee(predicate, 3), baseForOwn, true); + return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); } /** @@ -12153,7 +12209,7 @@ * // => 'pebbles' */ function findLastKey(object, predicate) { - return baseFind(object, getIteratee(predicate, 3), baseForOwnRight, true); + return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); } /** @@ -13012,15 +13068,16 @@ * An alternative to `_.reduce`; this method transforms `object` to a new * `accumulator` object which is the result of running each of its own * enumerable string keyed properties thru `iteratee`, with each invocation - * potentially mutating the `accumulator` object. The iteratee is invoked - * with four arguments: (accumulator, value, key, object). Iteratee functions - * may exit iteration early by explicitly returning `false`. + * potentially mutating the `accumulator` object. If `accumulator` is not + * provided, a new object with the same `[[Prototype]]` will be used. The + * iteratee is invoked with four arguments: (accumulator, value, key, object). + * Iteratee functions may exit iteration early by explicitly returning `false`. * * @static * @memberOf _ * @since 1.3.0 * @category Object - * @param {Array|Object} object The object to iterate over. + * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [accumulator] The custom accumulator value. * @returns {*} Returns the accumulated value. @@ -13442,7 +13499,7 @@ * @category String * @param {string} [string=''] The string to search. * @param {string} [target] The string to search for. - * @param {number} [position=string.length] The position to search from. + * @param {number} [position=string.length] The position to search up to. * @returns {boolean} Returns `true` if `string` ends with `target`, * else `false`. * @example @@ -14527,7 +14584,7 @@ * } * }; * - * _.bindAll(view, 'onClick'); + * _.bindAll(view, ['onClick']); * jQuery(element).on('click', view.onClick); * // => Logs 'clicked docs' when clicked. */ @@ -14608,7 +14665,7 @@ * { 'user': 'fred', 'age': 40 } * ]; * - * _.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) })); + * _.filter(users, _.conforms({ 'age': function(n) { return n > 38; } })); * // => [{ 'user': 'fred', 'age': 40 }] */ function conforms(source) { @@ -14626,10 +14683,12 @@ * @returns {Function} Returns the new constant function. * @example * - * var object = { 'user': 'fred' }; - * var getter = _.constant(object); + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] * - * getter() === object; + * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { @@ -14656,7 +14715,7 @@ * return n * n; * } * - * var addSquare = _.flow(_.add, square); + * var addSquare = _.flow([_.add, square]); * addSquare(1, 2); * // => 9 */ @@ -14679,7 +14738,7 @@ * return n * n; * } * - * var addSquare = _.flowRight(square, _.add); + * var addSquare = _.flowRight([square, _.add]); * addSquare(1, 2); * // => 9 */ @@ -14698,7 +14757,7 @@ * * var object = { 'user': 'fred' }; * - * _.identity(object) === object; + * console.log(_.identity(object) === object); * // => true */ function identity(value) { @@ -14959,8 +15018,7 @@ } /** - * A no-operation function that returns `undefined` regardless of the - * arguments it receives. + * A method that returns `undefined`. * * @static * @memberOf _ @@ -14968,17 +15026,15 @@ * @category Util * @example * - * var object = { 'user': 'fred' }; - * - * _.noop(object) === undefined; - * // => true + * _.times(2, _.noop); + * // => [undefined, undefined] */ function noop() { // No operation performed. } /** - * Creates a function that gets the argument at `n` index. If `n` is negative, + * Creates a function that gets the argument at index `n`. If `n` is negative, * the nth argument from the end is returned. * * @static @@ -15017,7 +15073,7 @@ * @returns {Function} Returns the new function. * @example * - * var func = _.over(Math.max, Math.min); + * var func = _.over([Math.max, Math.min]); * * func(1, 2, 3, 4); * // => [4, 1] @@ -15037,7 +15093,7 @@ * @returns {Function} Returns the new function. * @example * - * var func = _.overEvery(Boolean, isFinite); + * var func = _.overEvery([Boolean, isFinite]); * * func('1'); * // => true @@ -15063,7 +15119,7 @@ * @returns {Function} Returns the new function. * @example * - * var func = _.overSome(Boolean, isFinite); + * var func = _.overSome([Boolean, isFinite]); * * func('1'); * // => true @@ -15210,6 +15266,101 @@ */ var rangeRight = createRange(true); + /** + * A method that returns a new empty array. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Array} Returns the new empty array. + * @example + * + * var arrays = _.times(2, _.stubArray); + * + * console.log(arrays); + * // => [[], []] + * + * console.log(arrays[0] === arrays[1]); + * // => false + */ + function stubArray() { + return []; + } + + /** + * A method that returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ + function stubFalse() { + return false; + } + + /** + * A method that returns a new empty object. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Object} Returns the new empty object. + * @example + * + * var objects = _.times(2, _.stubObject); + * + * console.log(objects); + * // => [{}, {}] + * + * console.log(objects[0] === objects[1]); + * // => false + */ + function stubObject() { + return {}; + } + + /** + * A method that returns an empty string. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {string} Returns the empty string. + * @example + * + * _.times(2, _.stubString); + * // => ['', ''] + */ + function stubString() { + return ''; + } + + /** + * A method that returns `true`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `true`. + * @example + * + * _.times(2, _.stubTrue); + * // => [true, true] + */ + function stubTrue() { + return true; + } + /** * Invokes the iteratee `n` times, returning an array of the results of * each invocation. The iteratee is invoked with one argument; (index). @@ -15226,8 +15377,8 @@ * _.times(3, String); * // => ['0', '1', '2'] * - * _.times(4, _.constant(true)); - * // => [true, true, true, true] + * _.times(4, _.constant(0)); + * // => [0, 0, 0, 0] */ function times(n, iteratee) { n = toInteger(n); @@ -15263,15 +15414,6 @@ * * _.toPath('a[0].b.c'); * // => ['a', '0', 'b', 'c'] - * - * var path = ['a', 'b', 'c'], - * newPath = _.toPath(path); - * - * console.log(newPath); - * // => ['a', 'b', 'c'] - * - * console.log(path === newPath); - * // => false */ function toPath(value) { if (isArray(value)) { @@ -15910,6 +16052,11 @@ lodash.meanBy = meanBy; lodash.min = min; lodash.minBy = minBy; + lodash.stubArray = stubArray; + lodash.stubFalse = stubFalse; + lodash.stubObject = stubObject; + lodash.stubString = stubString; + lodash.stubTrue = stubTrue; lodash.multiply = multiply; lodash.nth = nth; lodash.noConflict = noConflict; @@ -16216,7 +16363,7 @@ // 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. - (freeWindow || freeSelf || {})._ = _; + (freeSelf || {})._ = _; // Some AMD build optimizers like r.js check for condition patterns like the following: if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { @@ -16227,11 +16374,9 @@ }); } // Check for `exports` after `define` in case a build optimizer adds an `exports` object. - else if (freeExports && freeModule) { + else if (freeModule) { // Export for Node.js. - if (moduleExports) { - (freeModule.exports = _)._ = _; - } + (freeModule.exports = _)._ = _; // Export for CommonJS support. freeExports._ = _; } diff --git a/package.json b/package.json index 44bcb934d3..9c601a2c02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "4.12.0", + "version": "4.13.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", + "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", "style:fp": "jscs fp/*.js lib/**/*.js", @@ -34,14 +35,14 @@ "curl-amd": "~0.8.12", "docdown": "~0.5.1", "dojo": "^1.11.1", - "ecstatic": "^1.4.0", + "ecstatic": "^1.4.1", "fs-extra": "~0.30.0", "glob": "^7.0.3", "istanbul": "0.4.3", - "jquery": "^2.2.3", + "jquery": "^2.2.4", "jscs": "^3.0.1", "lodash": "4.11.2", - "markdown-doctest": "^0.4.0", + "markdown-doctest": "^0.6.0", "platform": "^1.3.1", "qunit-extras": "^2.0.0", "qunitjs": "~1.23.1", @@ -49,6 +50,6 @@ "requirejs": "^2.2.0", "sauce-tunnel": "^2.4.0", "uglify-js": "2.6.2", - "webpack": "^1.12.15" + "webpack": "^1.13.1" } } diff --git a/test/test-fp.js b/test/test-fp.js index 6a471bf7b9..1fd668753e 100644 --- a/test/test-fp.js +++ b/test/test-fp.js @@ -19,6 +19,11 @@ slice = arrayProto.slice, WeakMap = root.WeakMap; + /** Math helpers. */ + var add = function(x, y) { return x + y; }, + isEven = function(n) { return n % 2 == 0; }, + square = function(n) { return n * n; }; + // Leak to avoid sporadic `noglobals` fails on Edge in Sauce Labs. root.msWDfn = undefined; @@ -28,10 +33,7 @@ var QUnit = root.QUnit || require('qunit-extras'); /** Load stable Lodash. */ - var _ = root._ || ( - _ = require('../lodash.js'), - _.runInContext(root) - ); + var _ = root._ || require('../lodash.js'); var convert = (function() { var baseConvert = root.fp || require('../fp/_baseConvert.js'); @@ -95,11 +97,8 @@ assert.expect(2); var array = [1, 2, 3, 4], - remove = convert('remove', _.remove); - - var actual = remove(function(n) { - return n % 2 == 0; - })(array); + remove = convert('remove', _.remove), + actual = remove(isEven)(array); assert.deepEqual(array, [1, 2, 3, 4]); assert.deepEqual(actual, [1, 3]); @@ -112,7 +111,7 @@ remove = convert('remove', _.remove, allFalseOptions); var actual = remove(array, function(n, index) { - return index % 2 == 0; + return isEven(index); }); assert.deepEqual(array, [2, 4]); @@ -125,11 +124,8 @@ if (!document) { var array = [1, 2, 3, 4], - lodash = convert({ 'remove': _.remove }); - - var actual = lodash.remove(function(n) { - return n % 2 == 0; - })(array); + lodash = convert({ 'remove': _.remove }), + actual = lodash.remove(isEven)(array); assert.deepEqual(array, [1, 2, 3, 4]); assert.deepEqual(actual, [1, 3]); @@ -147,7 +143,7 @@ lodash = convert({ 'remove': _.remove }, allFalseOptions); var actual = lodash.remove(array, function(n, index) { - return index % 2 == 0; + return isEven(index); }); assert.deepEqual(array, [2, 4]); @@ -166,7 +162,7 @@ lodash = convert(_.runInContext(), allFalseOptions); var actual = lodash.remove(array, function(n, index) { - return index % 2 == 0; + return isEven(index); }); assert.deepEqual(array, [2, 4]); @@ -182,7 +178,7 @@ lodash = runInContext(); var actual = lodash.remove(array, function(n, index) { - return index % 2 == 0; + return isEven(index); }); assert.deepEqual(array, [2, 4]); @@ -194,16 +190,15 @@ assert.expect(8); var array = [1, 2, 3, 4], - predicate = function(n) { return n % 2 == 0; }, value = _.clone(array), remove = convert('remove', _.remove, { 'cap': false }), - actual = remove(function(n, index) { return index % 2 == 0; })(value); + actual = remove(function(n, index) { return isEven(index); })(value); assert.deepEqual(value, [1, 2, 3, 4]); assert.deepEqual(actual, [2, 4]); remove = convert('remove', _.remove, { 'curry': false }); - actual = remove(predicate); + actual = remove(isEven); assert.deepEqual(actual, []); @@ -212,14 +207,14 @@ value = _.clone(array); remove = convert('remove', _.remove, { 'immutable': false }); - actual = remove(predicate)(value); + actual = remove(isEven)(value); assert.deepEqual(value, [1, 3]); assert.deepEqual(actual, [2, 4]); value = _.clone(array); remove = convert('remove', _.remove, { 'rearg': false }); - actual = remove(value)(predicate); + actual = remove(value)(isEven); assert.deepEqual(value, [1, 2, 3, 4]); assert.deepEqual(actual, [1, 3]); @@ -303,7 +298,7 @@ remove = isFp ? lodash.remove : lodash; var actual = remove(array, function(n, index) { - return index % 2 == 0; + return isEven(index); }); assert.deepEqual(array, [2, 4]); @@ -319,7 +314,7 @@ remove = (isFp ? lodash.remove : lodash).convert({ 'rearg': false }); var actual = remove(array)(function(n, index) { - return index % 2 == 0; + return isEven(index); }); assert.deepEqual(array, [1, 2, 3, 4]); @@ -496,7 +491,7 @@ actual = fp.uniqBy(_.identity, other); assert.deepEqual(actual, ['b', 'd'], 'fp.uniqBy'); - actual = fp.without(array)(other); + actual = fp.without(other)(array); assert.deepEqual(actual, ['a', 'c'], 'fp.without'); actual = fp.xor(other)(array); @@ -564,7 +559,7 @@ var predicate = function(value) { filterCount++; - return value % 2 == 0; + return isEven(value); }; var map1 = convert('map', _.map), @@ -611,163 +606,6 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('mutation methods'); - - (function() { - var array = [1, 2, 3], - object = { 'a': 1 }, - deepObject = { 'a': { 'b': 2, 'c': 3 } }; - - QUnit.test('should not mutate values', function(assert) { - assert.expect(42); - - function Foo() {} - Foo.prototype = { 'b': 2 }; - - var value = _.clone(object), - actual = fp.assign(value)({ 'b': 2 }); - - assert.deepEqual(value, object, 'fp.assign'); - assert.deepEqual(actual, { 'a': 1, 'b': 2 }, 'fp.assign'); - - value = _.clone(object); - actual = fp.assignWith(function(objValue, srcValue) { - return srcValue; - })(value)({ 'b': 2 }); - - assert.deepEqual(value, object, 'fp.assignWith'); - assert.deepEqual(actual, { 'a': 1, 'b': 2 }, 'fp.assignWith'); - - value = _.clone(object); - actual = fp.assignIn(value)(new Foo); - - assert.deepEqual(value, object, 'fp.assignIn'); - assert.deepEqual(actual, { 'a': 1, 'b': 2 }, 'fp.assignIn'); - - value = _.clone(object); - actual = fp.assignInWith(function(objValue, srcValue) { - return srcValue; - })(value)(new Foo); - - assert.deepEqual(value, object, 'fp.assignInWith'); - assert.deepEqual(actual, { 'a': 1, 'b': 2 }, 'fp.assignInWith'); - - value = _.clone(object); - actual = fp.defaults({ 'a': 2, 'b': 2 })(value); - - assert.deepEqual(value, object, 'fp.defaults'); - assert.deepEqual(actual, { 'a': 1, 'b': 2 }, 'fp.defaults'); - - value = _.cloneDeep(deepObject); - actual = fp.defaultsDeep({ 'a': { 'c': 4, 'd': 4 } })(deepObject); - - assert.deepEqual(value, { 'a': { 'b': 2, 'c': 3 } }, 'fp.defaultsDeep'); - assert.deepEqual(actual, { 'a': { 'b': 2, 'c': 3, 'd': 4 } }, 'fp.defaultsDeep'); - - value = _.clone(object); - actual = fp.extend(value)(new Foo); - - assert.deepEqual(value, object, 'fp.extend'); - assert.deepEqual(actual, { 'a': 1, 'b': 2 }, 'fp.extend'); - - value = _.clone(object); - actual = fp.extendWith(function(objValue, srcValue) { - return srcValue; - })(value)(new Foo); - - assert.deepEqual(value, object, 'fp.extendWith'); - assert.deepEqual(actual, { 'a': 1, 'b': 2 }, 'fp.extendWith'); - - value = _.clone(array); - actual = fp.fill(1)(2)('*')(value); - - assert.deepEqual(value, array, 'fp.fill'); - assert.deepEqual(actual, [1, '*', 3], 'fp.fill'); - - value = _.cloneDeep(deepObject); - actual = fp.merge(value)({ 'a': { 'd': 4 } }); - - assert.deepEqual(value, { 'a': { 'b': 2, 'c': 3 } }, 'fp.merge'); - assert.deepEqual(actual, { 'a': { 'b': 2, 'c': 3, 'd': 4 } }, 'fp.merge'); - - value = _.cloneDeep(deepObject); - value.a.b = [1]; - - actual = fp.mergeWith(function(objValue, srcValue) { - if (_.isArray(objValue)) { - return objValue.concat(srcValue); - } - }, value, { 'a': { 'b': [2, 3] } }); - - assert.deepEqual(value, { 'a': { 'b': [1], 'c': 3 } }, 'fp.mergeWith'); - assert.deepEqual(actual, { 'a': { 'b': [1, 2, 3], 'c': 3 } }, 'fp.mergeWith'); - - value = _.clone(array); - actual = fp.pull(2)(value); - - assert.deepEqual(value, array, 'fp.pull'); - assert.deepEqual(actual, [1, 3], 'fp.pull'); - - value = _.clone(array); - actual = fp.pullAll([1, 3])(value); - - assert.deepEqual(value, array, 'fp.pullAll'); - assert.deepEqual(actual, [2], 'fp.pullAll'); - - value = _.clone(array); - actual = fp.pullAt([0, 2])(value); - - assert.deepEqual(value, array, 'fp.pullAt'); - assert.deepEqual(actual, [2], 'fp.pullAt'); - - value = _.clone(array); - actual = fp.remove(function(value) { - return value === 2; - })(value); - - assert.deepEqual(value, array, 'fp.remove'); - assert.deepEqual(actual, [1, 3], 'fp.remove'); - - value = _.clone(array); - actual = fp.reverse(value); - - assert.deepEqual(value, array, 'fp.reverse'); - assert.deepEqual(actual, [3, 2, 1], 'fp.reverse'); - - value = _.cloneDeep(deepObject); - actual = fp.set('a.b')(3)(value); - - assert.deepEqual(value, deepObject, 'fp.set'); - assert.deepEqual(actual, { 'a': { 'b': 3, 'c': 3 } }, 'fp.set'); - - value = _.cloneDeep(deepObject); - actual = fp.setWith(Object)('d.e')(4)(value); - - assert.deepEqual(value, deepObject, 'fp.setWith'); - assert.deepEqual(actual, { 'a': { 'b': 2, 'c': 3 }, 'd': { 'e': 4 } }, 'fp.setWith'); - - value = _.cloneDeep(deepObject); - actual = fp.unset('a.b')(value); - - assert.deepEqual(value, deepObject, 'fp.unset'); - assert.deepEqual(actual, { 'a': { 'c': 3 } }, 'fp.unset'); - - value = _.cloneDeep(deepObject); - actual = fp.update('a.b')(function(n) { return n * n; })(value); - - assert.deepEqual(value, deepObject, 'fp.update'); - assert.deepEqual(actual, { 'a': { 'b': 4, 'c': 3 } }, 'fp.update'); - - value = _.cloneDeep(deepObject); - actual = fp.updateWith(Object)('d.e')(_.constant(4))(value); - - assert.deepEqual(value, deepObject, 'fp.updateWith'); - assert.deepEqual(actual, { 'a': { 'b': 2, 'c': 3 }, 'd': { 'e': 4 } }, 'fp.updateWith'); - }); - }()); - - /*--------------------------------------------------------------------------*/ - QUnit.module('placeholder methods'); (function() { @@ -777,11 +615,11 @@ var actual = fp.add(fp, 'b')('a'); assert.strictEqual(actual, 'ab'); - actual = fp.slice(fp, 2)(1)(['a', 'b', 'c']); - assert.deepEqual(actual, ['b']); - actual = fp.fill(fp, 2)(1, '*')([1, 2, 3]); assert.deepEqual(actual, [1, '*', 3]); + + actual = fp.slice(fp, 2)(1)(['a', 'b', 'c']); + assert.deepEqual(actual, ['b']); }); QUnit.test('should support `fp.placeholder`', function(assert) { @@ -793,11 +631,11 @@ var actual = fp.add(ph, 'b')('a'); assert.strictEqual(actual, 'ab'); - actual = fp.slice(ph, 2)(1)(['a', 'b', 'c']); - assert.deepEqual(actual, ['b']); - actual = fp.fill(ph, 2)(1, '*')([1, 2, 3]); assert.deepEqual(actual, [1, '*', 3]); + + actual = fp.slice(ph, 2)(1)(['a', 'b', 'c']); + assert.deepEqual(actual, ['b']); }); }); @@ -815,7 +653,7 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('set methods'); + QUnit.module('setter methods'); (function() { QUnit.test('should only clone objects in `path`', function(assert) { @@ -843,7 +681,7 @@ assert.strictEqual(actual.a.c, value.a.c, 'fp.unset'); value = _.cloneDeep(object); - actual = fp.update('a.b')(function(n) { return n * n; })(value); + actual = fp.update('a.b')(square)(value); assert.strictEqual(actual.a.b, 4, 'fp.update'); assert.strictEqual(actual.d, value.d, 'fp.update'); @@ -858,108 +696,67 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('with methods'); - - (function() { - var object = { 'a': 1 }; - - QUnit.test('should provide the correct `customizer` arguments', function(assert) { - assert.expect(7); - - var args, - value = _.clone(object); - - fp.assignWith(function() { - args || (args = _.map(arguments, _.cloneDeep)); - })(value)({ 'b': 2 }); - - assert.deepEqual(args, [undefined, 2, 'b', { 'a': 1 }, { 'b': 2 }], 'fp.assignWith'); - - args = undefined; - value = _.clone(object); - - fp.extendWith(function() { - args || (args = _.map(arguments, _.cloneDeep)); - })(value)({ 'b': 2 }); - - assert.deepEqual(args, [undefined, 2, 'b', { 'a': 1 }, { 'b': 2 }], 'fp.extendWith'); - - var iteration = 0, - objects = [{ 'a': 1 }, { 'a': 2 }], - stack = { '__data__': { '__data__': [objects] } }, - expected = [1, 2, 'a', objects[0], objects[1], stack]; - - args = undefined; - - fp.isEqualWith(function() { - if (++iteration == 2) { - args = _.map(arguments, _.cloneDeep); - } - })(objects[0])(objects[1]); + QUnit.module('fp.add and fp.subtract'); - args[5] = _.omitBy(args[5], _.isFunction); - args[5].__data__ = _.omitBy(args[5].__data__, _.isFunction); + _.each(['add', 'subtract'], function(methodName) { + var func = fp[methodName], + isAdd = methodName == 'add'; - assert.deepEqual(args, expected, 'fp.isEqualWith'); + QUnit.test('`fp.' + methodName + '` should not have `rearg` applied', function(assert) { + assert.expect(1); - args = undefined; - stack = { '__data__': { '__data__': [] } }; - expected = [2, 1, 'a', objects[1], objects[0], stack]; + assert.strictEqual(func('1')('2'), isAdd ? '12' : -1); + }); + }); - fp.isMatchWith(function() { - args || (args = _.map(arguments, _.cloneDeep)); - })(objects[0])(objects[1]); + /*--------------------------------------------------------------------------*/ - args[5] = _.omitBy(args[5], _.isFunction); - args[5].__data__ = _.omitBy(args[5].__data__, _.isFunction); + QUnit.module('assign methods'); - assert.deepEqual(args, expected, 'fp.isMatchWith'); + _.each(['assign', 'assignIn', 'defaults', 'defaultsDeep', 'merge'], function(methodName) { + var func = fp[methodName]; - args = undefined; - value = { 'a': [1] }; - expected = [[1], [2, 3], 'a', { 'a': [1] }, { 'a': [2, 3] }, stack]; + QUnit.test('`fp.' + methodName + '` should not mutate values', function(assert) { + assert.expect(2); - fp.mergeWith(function() { - args || (args = _.map(arguments, _.cloneDeep)); - })(value)({ 'a': [2, 3] }); + var object = { 'a': 1 }, + actual = func(object)({ 'b': 2 }); - args[5] = _.omitBy(args[5], _.isFunction); - args[5].__data__ = _.omitBy(args[5].__data__, _.isFunction); + assert.deepEqual(object, { 'a': 1 }); + assert.deepEqual(actual, { 'a': 1, 'b': 2 }); + }); + }); - assert.deepEqual(args, expected, 'fp.mergeWith'); + /*--------------------------------------------------------------------------*/ - args = undefined; - value = _.clone(object); + QUnit.module('assignWith methods'); - fp.setWith(function() { - args || (args = _.map(arguments, _.cloneDeep)); - })('b.c')(2)(value); + _.each(['assignWith', 'assignInWith', 'extendWith'], function(methodName) { + var func = fp[methodName]; - assert.deepEqual(args, [undefined, 'b', { 'a': 1 }], 'fp.setWith'); + QUnit.test('`fp.' + methodName + '` should provide the correct `customizer` arguments', function(assert) { + assert.expect(1); - args = undefined; - value = _.clone(object); + var args; - fp.updateWith(function() { + func(function() { args || (args = _.map(arguments, _.cloneDeep)); - })('b.c')(_.constant(2))(value); + })({ 'a': 1 })({ 'b': 2 }); - assert.deepEqual(args, [undefined, 'b', { 'a': 1 }], 'fp.updateWith'); + assert.deepEqual(args, [undefined, 2, 'b', { 'a': 1 }, { 'b': 2 }]); }); - }()); - /*--------------------------------------------------------------------------*/ - - QUnit.module('fp.add and fp.subtract'); + QUnit.test('`fp.' + methodName + '` should not mutate values', function(assert) { + assert.expect(2); - _.each(['add', 'subtract'], function(methodName) { - var func = fp[methodName], - isAdd = methodName == 'add'; + var object = { 'a': 1 }; - QUnit.test('`fp.' + methodName + '` should not have `rearg` applied', function(assert) { - assert.expect(1); + var actual = func(function(objValue, srcValue) { + return srcValue; + })(object)({ 'b': 2 }); - assert.strictEqual(func('1')('2'), isAdd ? '12' : -1); + assert.deepEqual(object, { 'a': 1 }); + assert.deepEqual(actual, { 'a': 1, 'b': 2 }); }); }); @@ -1042,7 +839,46 @@ QUnit.test('should return the elements of the first array not included in the second array', function(assert) { assert.expect(1); - assert.deepEqual(fp.difference([1, 2])([2, 3]), [1]); + var actual = fp.difference([2, 1], [2, 3]); + assert.deepEqual(actual, [1]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.differenceBy'); + + (function() { + QUnit.test('should have an argument order of `iteratee`, `array`, then `values`', function(assert) { + assert.expect(1); + + var actual = fp.differenceBy(Math.floor, [2.1, 1.2], [2.3, 3.4]); + assert.deepEqual(actual, [1.2]); + }); + + QUnit.test('should provide the correct `iteratee` arguments', function(assert) { + assert.expect(1); + + var args; + + fp.differenceBy(function() { + args || (args = slice.call(arguments)); + })([2.1, 1.2], [2.3, 3.4]); + + assert.deepEqual(args, [2.3]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.differenceWith'); + + (function() { + QUnit.test('should have an argument order of `comparator`, `array`, then `values`', function(assert) { + assert.expect(1); + + var actual = fp.differenceWith(fp.eq)([2, 1])([2, 3]); + assert.deepEqual(actual, [1]); }); }()); @@ -1093,62 +929,166 @@ var array = [1, 2, 3]; assert.deepEqual(fp.fill(1)(2)('*')(array), [1, '*', 3]); }); + + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var array = [1, 2, 3], + actual = fp.fill(1)(2)('*')(array); + + assert.deepEqual(array, [1, 2, 3]); + assert.deepEqual(actual, [1, '*', 3]); + }); }()); /*--------------------------------------------------------------------------*/ - QUnit.module('fp.flatMapDepth'); + QUnit.module('fp.findFrom methods'); + + _.each(['findFrom', 'findIndexFrom', 'findLastFrom', 'findLastIndexFrom'], function(methodName) { + var func = fp[methodName]; + + QUnit.test('`_.' + methodName + '` should provide the correct `predicate` arguments', function(assert) { + assert.expect(1); + + var args; + + func(function() { + args || (args = slice.call(arguments)); + })(1)([1, 2, 3]); + + assert.deepEqual(args, [2]); + }); + }); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.findFrom'); (function() { - QUnit.test('should have an argument order of `iteratee`, `depth`, then `collection`', function(assert) { - assert.expect(2); + function resolve(value) { + return fp.flow(fp.property('a'), fp.eq(value)); + } - function duplicate(n) { - return [[[n, n]]]; - } + QUnit.test('should have an argument order of `value`, `fromIndex`, then `array`', function(assert) { + assert.expect(2); - var array = [1, 2], - object = { 'a': 1, 'b': 2 }, - expected = [[1, 1], [2, 2]]; + var objects = [{ 'a': 1 }, { 'a': 2 }, { 'a': 1 }, { 'a': 2 }]; - assert.deepEqual(fp.flatMapDepth(duplicate)(2)(array), expected); - assert.deepEqual(fp.flatMapDepth(duplicate)(2)(object), expected); + assert.strictEqual(fp.findFrom(resolve(1))(1)(objects), objects[2]); + assert.strictEqual(fp.findFrom(resolve(2))(-2)(objects), objects[3]); }); }()); /*--------------------------------------------------------------------------*/ - QUnit.module('flow methods'); + QUnit.module('fp.findLastFrom'); - _.each(['flow', 'flowRight'], function(methodName) { - var func = fp[methodName], - isFlow = methodName == 'flow'; + (function() { + function resolve(value) { + return fp.flow(fp.property('a'), fp.eq(value)); + } - QUnit.test('`fp.' + methodName + '` should support shortcut fusion', function(assert) { - assert.expect(6); + QUnit.test('should have an argument order of `value`, `fromIndex`, then `array`', function(assert) { + assert.expect(2); - var filterCount, - mapCount, - array = fp.range(0, LARGE_ARRAY_SIZE); + var objects = [{ 'a': 1 }, { 'a': 2 }, { 'a': 1 }, { 'a': 2 }]; - var iteratee = function(value) { - mapCount++; - return value * value; - }; + assert.strictEqual(fp.findLastFrom(resolve(1))(1)(objects), objects[0]); + assert.strictEqual(fp.findLastFrom(resolve(2))(-2)(objects), objects[1]); + }); + }()); - var predicate = function(value) { - filterCount++; - return value % 2 == 0; - }; + /*--------------------------------------------------------------------------*/ - var filter = fp.filter(predicate), - map = fp.map(iteratee), - take = fp.take(2); + QUnit.module('fp.findIndexFrom and fp.indexOfFrom'); - _.times(2, function(index) { - var combined = isFlow - ? func(map, filter, fp.compact, take) - : func(take, fp.compact, filter, map); + _.each(['findIndexFrom', 'indexOfFrom'], function(methodName) { + var func = fp[methodName], + resolve = methodName == 'findIndexFrom' ? fp.eq : _.identity; + + QUnit.test('`_.' + methodName + '` should have an argument order of `value`, `fromIndex`, then `array`', function(assert) { + assert.expect(2); + + var array = [1, 2, 3, 1, 2, 3]; + + assert.deepEqual(func(resolve(1))(2)(array), 3); + assert.deepEqual(func(resolve(2))(-3)(array), 4); + }); + }); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.findLastIndexFrom and fp.lastIndexOfFrom'); + + _.each(['findLastIndexFrom', 'lastIndexOfFrom'], function(methodName) { + var func = fp[methodName], + resolve = methodName == 'findLastIndexFrom' ? fp.eq : _.identity; + + QUnit.test('`_.' + methodName + '` should have an argument order of `value`, `fromIndex`, then `array`', function(assert) { + assert.expect(2); + + var array = [1, 2, 3, 1, 2, 3]; + + assert.deepEqual(func(resolve(2))(3)(array), 1); + assert.deepEqual(func(resolve(3))(-3)(array), 2); + }); + }); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.flatMapDepth'); + + (function() { + QUnit.test('should have an argument order of `iteratee`, `depth`, then `collection`', function(assert) { + assert.expect(2); + + function duplicate(n) { + return [[[n, n]]]; + } + + var array = [1, 2], + object = { 'a': 1, 'b': 2 }, + expected = [[1, 1], [2, 2]]; + + assert.deepEqual(fp.flatMapDepth(duplicate)(2)(array), expected); + assert.deepEqual(fp.flatMapDepth(duplicate)(2)(object), expected); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('flow methods'); + + _.each(['flow', 'flowRight'], function(methodName) { + var func = fp[methodName], + isFlow = methodName == 'flow'; + + QUnit.test('`fp.' + methodName + '` should support shortcut fusion', function(assert) { + assert.expect(6); + + var filterCount, + mapCount, + array = fp.range(0, LARGE_ARRAY_SIZE); + + var iteratee = function(value) { + mapCount++; + return square(value); + }; + + var predicate = function(value) { + filterCount++; + return isEven(value); + }; + + var filter = fp.filter(predicate), + map = fp.map(iteratee), + take = fp.take(2); + + _.times(2, function(index) { + var combined = isFlow + ? func(map, filter, fp.compact, take) + : func(take, fp.compact, filter, map); filterCount = mapCount = 0; @@ -1234,6 +1174,44 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('fp.intersectionBy'); + + (function() { + QUnit.test('should have an argument order of `iteratee`, `array`, then `values`', function(assert) { + assert.expect(1); + + var actual = fp.intersectionBy(Math.floor, [2.1, 1.2], [2.3, 3.4]); + assert.deepEqual(actual, [2.1]); + }); + + QUnit.test('should provide the correct `iteratee` arguments', function(assert) { + assert.expect(1); + + var args; + + fp.intersectionBy(function() { + args || (args = slice.call(arguments)); + })([2.1, 1.2], [2.3, 3.4]); + + assert.deepEqual(args, [2.3]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.intersectionWith'); + + (function() { + QUnit.test('should have an argument order of `comparator`, `array`, then `values`', function(assert) { + assert.expect(1); + + var actual = fp.intersectionWith(fp.eq)([2, 1])([2, 3]); + assert.deepEqual(actual, [2]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('fp.invoke'); (function() { @@ -1286,6 +1264,57 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('fp.isEqualWith'); + + (function() { + QUnit.test('should provide the correct `customizer` arguments', function(assert) { + assert.expect(1); + + var args, + iteration = 0, + objects = [{ 'a': 1 }, { 'a': 2 }], + stack = { '__data__': { '__data__': [objects] } }, + expected = [1, 2, 'a', objects[0], objects[1], stack]; + + fp.isEqualWith(function() { + if (++iteration == 2) { + args = _.map(arguments, _.cloneDeep); + } + })(objects[0])(objects[1]); + + args[5] = _.omitBy(args[5], _.isFunction); + args[5].__data__ = _.omitBy(args[5].__data__, _.isFunction); + + assert.deepEqual(args, expected); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.isMatchWith'); + + (function() { + QUnit.test('should provide the correct `customizer` arguments', function(assert) { + assert.expect(1); + + var args, + objects = [{ 'a': 1 }, { 'a': 2 }], + stack = { '__data__': { '__data__': [] } }, + expected = [2, 1, 'a', objects[1], objects[0], stack]; + + fp.isMatchWith(function() { + args || (args = _.map(arguments, _.cloneDeep)); + })(objects[0])(objects[1]); + + args[5] = _.omitBy(args[5], _.isFunction); + args[5].__data__ = _.omitBy(args[5].__data__, _.isFunction); + + assert.deepEqual(args, expected); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('fp.iteratee'); (function() { @@ -1372,6 +1401,45 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('fp.mergeWith'); + + (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] }, { 'a': [2, 3] }, stack]; + + fp.mergeWith(function() { + args || (args = _.map(arguments, _.cloneDeep)); + })({ 'a': [1] })({ 'a': [2, 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 object = { 'a': { 'b': 2, 'c': 3 } }; + object.a.b = [1]; + + var actual = fp.mergeWith(function(objValue, srcValue) { + if (_.isArray(objValue)) { + return objValue.concat(srcValue); + } + }, object, { 'a': { 'b': [2, 3] } }); + + assert.deepEqual(object, { 'a': { 'b': [1], 'c': 3 } }); + assert.deepEqual(actual, { 'a': { 'b': [1, 2, 3], 'c': 3 } }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('fp.mixin'); (function() { @@ -1492,19 +1560,6 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('fp.update'); - - (function() { - QUnit.test('should not convert end of `path` to an object', function(assert) { - assert.expect(1); - - var actual = fp.update('a.b')(_.identity)({ 'a': { 'b': 1 } }); - assert.strictEqual(typeof actual.a.b, 'number'); - }); - }()); - - /*--------------------------------------------------------------------------*/ - QUnit.module('padChars methods'); _.each(['padChars', 'padCharsStart', 'padCharsEnd'], function(methodName) { @@ -1566,6 +1621,54 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('fp.pull'); + + (function() { + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var array = [1, 2, 3], + actual = fp.pull(2)(array); + + assert.deepEqual(array, [1, 2, 3]); + assert.deepEqual(actual, [1, 3]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.pullAll'); + + (function() { + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var array = [1, 2, 3], + actual = fp.pullAll([1, 3])(array); + + assert.deepEqual(array, [1, 2, 3]); + assert.deepEqual(actual, [2]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.pullAt'); + + (function() { + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var array = [1, 2, 3], + actual = fp.pullAt([0, 2])(array); + + assert.deepEqual(array, [1, 2, 3]); + assert.deepEqual(actual, [2]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('fp.random'); (function() { @@ -1637,6 +1740,22 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('fp.remove'); + + (function() { + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var array = [1, 2, 3], + actual = fp.remove(fp.eq(2))(array); + + assert.deepEqual(array, [1, 2, 3]); + assert.deepEqual(actual, [1, 3]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('fp.restFrom'); (function() { @@ -1653,6 +1772,22 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('fp.reverse'); + + (function() { + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var array = [1, 2, 3], + actual = fp.reverse(array); + + assert.deepEqual(array, [1, 2, 3]); + assert.deepEqual(actual, [3, 2, 1]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('fp.runInContext'); (function() { @@ -1672,6 +1807,50 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('fp.set'); + + (function() { + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var object = { 'a': { 'b': 2, 'c': 3 } }, + actual = fp.set('a.b')(3)(object); + + assert.deepEqual(object, { 'a': { 'b': 2, 'c': 3 } }); + assert.deepEqual(actual, { 'a': { 'b': 3, 'c': 3 } }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.setWith'); + + (function() { + QUnit.test('should provide the correct `customizer` arguments', function(assert) { + assert.expect(1); + + var args; + + fp.setWith(function() { + args || (args = _.map(arguments, _.cloneDeep)); + })('b.c')(2)({ 'a': 1 }); + + assert.deepEqual(args, [undefined, 'b', { 'a': 1 }]); + }); + + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var object = { 'a': { 'b': 2, 'c': 3 } }, + actual = fp.setWith(Object)('d.e')(4)(object); + + assert.deepEqual(object, { 'a': { 'b': 2, 'c': 3 } }); + assert.deepEqual(actual, { 'a': { 'b': 2, 'c': 3 }, 'd': { 'e': 4 } }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('fp.spreadFrom'); (function() { @@ -1714,6 +1893,56 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('fp.unionBy'); + + (function() { + QUnit.test('should have an argument order of `iteratee`, `array`, then `other`', function(assert) { + assert.expect(1); + + var actual = fp.unionBy(Math.floor, [2.1], [1.2, 2.3]); + assert.deepEqual(actual, [2.1, 1.2]); + }); + + QUnit.test('should provide the correct `iteratee` arguments', function(assert) { + assert.expect(1); + + var args; + + fp.unionBy(function() { + args || (args = slice.call(arguments)); + })([2.1], [1.2, 2.3]); + + assert.deepEqual(args, [2.1]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.unionWith'); + + (function() { + QUnit.test('should have an argument order of `comparator`, `array`, then `values`', function(assert) { + assert.expect(1); + + var actual = fp.unionWith(fp.eq)([2, 1])([2, 3]); + assert.deepEqual(actual, [2, 1, 3]); + }); + + QUnit.test('should provide the correct `comparator` arguments', function(assert) { + assert.expect(1); + + var args; + + fp.unionWith(function() { + args || (args = slice.call(arguments)); + })([2, 1])([2, 3]); + + assert.deepEqual(args, [1, 2]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('fp.uniqBy'); (function() { @@ -1746,6 +1975,154 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('fp.uniqWith'); + + (function() { + QUnit.test('should have an argument order of `comparator`, `array`, then `values`', function(assert) { + assert.expect(1); + + var actual = fp.uniqWith(fp.eq)([2, 1, 2]); + assert.deepEqual(actual, [2, 1]); + }); + + QUnit.test('should provide the correct `comparator` arguments', function(assert) { + assert.expect(1); + + var args; + + fp.uniqWith(function() { + args || (args = slice.call(arguments)); + })([2, 1, 2]); + + assert.deepEqual(args, [1, 2]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.update'); + + (function() { + QUnit.test('should not convert end of `path` to an object', function(assert) { + assert.expect(1); + + var actual = fp.update('a.b')(_.identity)({ 'a': { 'b': 1 } }); + assert.strictEqual(typeof actual.a.b, 'number'); + }); + + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var object = { 'a': { 'b': 2, 'c': 3 } }, + actual = fp.update('a.b')(square)(object); + + assert.deepEqual(object, { 'a': { 'b': 2, 'c': 3 } }); + assert.deepEqual(actual, { 'a': { 'b': 4, 'c': 3 } }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.updateWith'); + + (function() { + QUnit.test('should provide the correct `customizer` arguments', function(assert) { + var args; + + fp.updateWith(function() { + args || (args = _.map(arguments, _.cloneDeep)); + })('b.c')(_.constant(2))({ 'a': 1 }); + + assert.deepEqual(args, [undefined, 'b', { 'a': 1 }]); + }); + + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var object = { 'a': { 'b': 2, 'c': 3 } }, + actual = fp.updateWith(Object)('d.e')(_.constant(4))(object); + + assert.deepEqual(object, { 'a': { 'b': 2, 'c': 3 } }); + assert.deepEqual(actual, { 'a': { 'b': 2, 'c': 3 }, 'd': { 'e': 4 } }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.unset'); + + (function() { + QUnit.test('should not mutate values', function(assert) { + assert.expect(2); + + var object = { 'a': { 'b': 2, 'c': 3 } }, + actual = fp.unset('a.b')(object); + + assert.deepEqual(object, { 'a': { 'b': 2, 'c': 3 } }); + assert.deepEqual(actual, { 'a': { 'c': 3 } }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.xorBy'); + + (function() { + QUnit.test('should have an argument order of `iteratee`, `array`, then `other`', function(assert) { + assert.expect(1); + + var actual = fp.xorBy(Math.floor, [2.1, 1.2], [2.3, 3.4]); + assert.deepEqual(actual, [1.2, 3.4]); + }); + + QUnit.test('should provide the correct `iteratee` arguments', function(assert) { + assert.expect(1); + + var args; + + fp.xorBy(function() { + args || (args = slice.call(arguments)); + })([2.1, 1.2], [2.3, 3.4]); + + assert.deepEqual(args, [2.3]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('fp.xorWith'); + + (function() { + QUnit.test('should have an argument order of `comparator`, `array`, then `values`', function(assert) { + assert.expect(1); + + var actual = fp.xorWith(fp.eq)([2, 1])([2, 3]); + assert.deepEqual(actual, [1, 3]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('with methods'); + + _.each(['differenceWith', 'intersectionWith', 'xorWith'], function(methodName) { + var func = fp[methodName]; + + QUnit.test('`fp.' + methodName + '` should provide the correct `comparator` arguments', function(assert) { + assert.expect(1); + + var args; + + func(function() { + args || (args = slice.call(arguments)); + })([2, 1])([2, 3]); + + assert.deepEqual(args, [2, 2]); + }); + }); + + /*--------------------------------------------------------------------------*/ + QUnit.module('fp.zip'); (function() { @@ -1777,11 +2154,8 @@ assert.expect(1); var array1 = [1, 2, 3], - array2 = [4, 5, 6]; - - var actual = fp.zipWith(function(a, b) { - return a + b; - })(array1)(array2); + array2 = [4, 5, 6], + actual = fp.zipWith(add)(array1)(array2); assert.deepEqual(actual, [5, 7, 9]); }); diff --git a/test/test.js b/test/test.js index 30187c03cc..b63a08c73c 100644 --- a/test/test.js +++ b/test/test.js @@ -83,26 +83,26 @@ isEven = function(n) { return n % 2 == 0; }, square = function(n) { return n * n; }; - /** Constant functions. */ - var alwaysA = function() { return 'a'; }, - alwaysB = function() { return 'b'; }, - alwaysC = function() { return 'c'; }; + /** Stub functions. */ + var stubA = function() { return 'a'; }, + stubB = function() { return 'b'; }, + stubC = function() { return 'c'; }; - var alwaysTrue = function() { return true; }, - alwaysFalse = function() { return false; }; + var stubTrue = function() { return true; }, + stubFalse = function() { return false; }; - var alwaysNaN = function() { return NaN; }, - alwaysNull = function() { return null; }; + var stubNaN = function() { return NaN; }, + stubNull = function() { return null; }; - var alwaysZero = function() { return 0; }, - alwaysOne = function() { return 1; }, - alwaysTwo = function() { return 2; }, - alwaysThree = function() { return 3; }, - alwaysFour = function() { return 4; }; + var stubZero = function() { return 0; }, + stubOne = function() { return 1; }, + stubTwo = function() { return 2; }, + stubThree = function() { return 3; }, + stubFour = function() { return 4; }; - var alwaysEmptyArray = function() { return []; }, - alwaysEmptyObject = function() { return {}; }, - alwaysEmptyString = function() { return ''; }; + var stubArray = function() { return []; }, + stubObject = function() { return {}; }, + stubString = function() { return ''; }; /** List of latin-1 supplementary letters to basic latin letters. */ var burredLetters = [ @@ -209,7 +209,7 @@ 'buildPath': filePath, 'loaderPath': '', 'isModularize': /\b(?:amd|commonjs|es|node|npm|(index|main)\.js)\b/.test(filePath), - 'isStrict': /\bes\b/.test(filePath), + 'isStrict': /\bes\b/.test(filePath) || 'default' in require(filePath), 'urlParams': {} }); @@ -233,6 +233,9 @@ // Leak to avoid sporadic `noglobals` fails on Edge in Sauce Labs. root.msWDfn = undefined; + // Assign `setTimeout` to itself to avoid being flagged as a leak. + setProperty(root, 'setTimeout', setTimeout); + // Exit early if going to run tests in a PhantomJS web page. if (phantom && isModularize) { var page = require('webpage').create(); @@ -295,33 +298,23 @@ }); } catch (e) {} - /** Use a single "load" function. */ - var load = (!amd && typeof require == 'function') - ? require - : noop; - /** Load QUnit and extras. */ - var QUnit = root.QUnit || load('qunit-extras'); + var QUnit = root.QUnit || require('qunit-extras'); /** Load stable Lodash. */ var lodashStable = root.lodashStable; if (!lodashStable) { try { - lodashStable = load('../node_modules/lodash/lodash.js'); + lodashStable = interopRequire('../node_modules/lodash/lodash.js'); } catch (e) { console.log('Error: The stable lodash dev dependency should be at least a version behind master branch.'); return; } lodashStable = lodashStable.noConflict(); } - lodashStable = lodashStable.runInContext(root); /** The `lodash` function to test. */ - var _ = root._ || (root._ = ( - _ = load(filePath), - _ = _._ || (isStrict = ui.isStrict = isStrict || 'default' in _, _['default']) || _, - (_.runInContext ? _.runInContext(root) : _) - )); + var _ = root._ || (root._ = interopRequire(filePath)); /** Used to test pseudo private map caches. */ var mapCaches = (function() { @@ -420,6 +413,19 @@ return result; } + /** + * Loads the module of `id`. If the module has an `exports.default`, the + * exported default value is returned as the resolved module. + * + * @private + * @param {string} id The identifier of the module to resolve. + * @returns {*} Returns the resolved module. + */ + function interopRequire(id) { + var result = require(id); + return 'default' in result ? result['default'] : result; + } + /** * Sets a non-enumerable property value on `object`. * @@ -545,7 +551,7 @@ emptyObject(require.cache); // Load lodash and expose it to the bad extensions/shims. - lodashBizarro = (lodashBizarro = require(filePath))._ || lodashBizarro['default'] || lodashBizarro; + lodashBizarro = interopRequire(filePath); root._ = oldDash; // Restore built-in methods. @@ -704,8 +710,7 @@ 'isIndex', 'isIterateeCall' ], function(funcName) { - var func = require(path.join(basePath, '_' + funcName)); - _['_' + funcName] = func[funcName] || func['default'] || func; + _['_' + funcName] = interopRequire(path.join(basePath, '_' + funcName)); }); } }); @@ -905,7 +910,7 @@ if (func) { var values = [[0], ['0'], ['1'], [3, 4], [MAX_SAFE_INTEGER - 1]], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(args) { return func.apply(undefined, args); @@ -923,7 +928,7 @@ if (func) { var values = [['1abc'], ['07'], ['0001'], [-1], [3, 3], [1.1], [MAX_SAFE_INTEGER]], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(args) { return func.apply(undefined, args); @@ -1062,7 +1067,7 @@ (function() { var values = empties.concat(true, 1, 'a'), - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); QUnit.test('should create a new instance when called without the `new` operator', function(assert) { assert.expect(1); @@ -1335,7 +1340,7 @@ }; defineProperty(object, 'a', lodashStable.assign({}, descriptor, { - 'get': alwaysOne + 'get': stubOne })); defineProperty(object, 'b', lodashStable.assign({}, descriptor, { @@ -1343,7 +1348,7 @@ })); defineProperty(object, 'c', lodashStable.assign({}, descriptor, { - 'get': alwaysNaN + 'get': stubNaN })); defineProperty(object, 'constructor', lodashStable.assign({}, descriptor, { @@ -1453,7 +1458,7 @@ result[value] = 1; }, []); - var expected = lodashStable.map(values, alwaysOne), + var expected = lodashStable.map(values, stubOne), actual = _.at(array, values); assert.deepEqual(actual, expected); @@ -1606,7 +1611,7 @@ QUnit.test('should return the caught error', function(assert) { assert.expect(1); - var expected = lodashStable.map(errors, alwaysTrue); + var expected = lodashStable.map(errors, stubTrue); var actual = lodashStable.map(errors, function(error) { return _.attempt(function() { throw error; }) === error; @@ -1633,7 +1638,7 @@ assert.expect(1); if (realm.errors) { - var expected = lodashStable.map(realm.errors, alwaysTrue); + var expected = lodashStable.map(realm.errors, stubTrue); var actual = lodashStable.map(realm.errors, function(error) { return _.attempt(function() { throw error; }) === error; @@ -1938,7 +1943,7 @@ if (typeof createCtor == 'function') { var bound = _.bind(createCtor()), count = 8, - expected = lodashStable.times(count, alwaysTrue); + expected = lodashStable.times(count, stubTrue); var actual = lodashStable.times(count, function(index) { try { @@ -2176,7 +2181,7 @@ return func(string) === expected; }); - assert.deepEqual(actual, lodashStable.map(strings, alwaysTrue)); + assert.deepEqual(actual, lodashStable.map(strings, stubTrue)); }); QUnit.test('`_.' + methodName + '` should handle double-converting strings', function(assert) { @@ -2187,7 +2192,7 @@ return func(func(string)) === expected; }); - assert.deepEqual(actual, lodashStable.map(strings, alwaysTrue)); + assert.deepEqual(actual, lodashStable.map(strings, stubTrue)); }); QUnit.test('`_.' + methodName + '` should deburr letters', function(assert) { @@ -2205,7 +2210,7 @@ return func(burred) === letter; }); - assert.deepEqual(actual, lodashStable.map(burredLetters, alwaysTrue)); + assert.deepEqual(actual, lodashStable.map(burredLetters, stubTrue)); }); QUnit.test('`_.' + methodName + '` should remove contraction apostrophes', function(assert) { @@ -2502,7 +2507,7 @@ assert.expect(1); var values = lodashStable.reject(falsey, lodashStable.isUndefined).concat(-1, -Infinity), - expected = lodashStable.map(values, alwaysEmptyArray); + expected = lodashStable.map(values, stubArray); var actual = lodashStable.map(values, function(n) { return _.chunk(array, n); @@ -2798,7 +2803,7 @@ return object; }); - var expected = lodashStable.map(values, alwaysTrue); + var expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(value) { return func(value).a === 1; @@ -2949,7 +2954,7 @@ } }, []); - var expected = lodashStable.map(objects, alwaysTrue); + var expected = lodashStable.map(objects, stubTrue); var actual = lodashStable.map(objects, function(object) { var Ctor = object.constructor, @@ -3065,15 +3070,13 @@ lodashStable.forOwn(uncloneable, function(value, key) { QUnit.test('`_.' + methodName + '` should work with a `customizer` callback and ' + key, function(assert) { - assert.expect(4); + assert.expect(3); var customizer = function(value) { return lodashStable.isPlainObject(value) ? undefined : value; }; var actual = func(value, customizer); - - assert.deepEqual(actual, value); assert.strictEqual(actual, value); var object = { 'a': value, 'b': { 'c': value } }; @@ -3240,9 +3243,9 @@ assert.expect(3); var cond = _.cond([ - [lodashStable.matches({ 'a': 1 }), alwaysA], - [lodashStable.matchesProperty('b', 1), alwaysB], - [lodashStable.property('c'), alwaysC] + [lodashStable.matches({ 'a': 1 }), stubA], + [lodashStable.matchesProperty('b', 1), stubB], + [lodashStable.property('c'), stubC] ]); assert.strictEqual(cond({ 'a': 1, 'b': 2, 'c': 3 }), 'a'); @@ -3272,9 +3275,9 @@ assert.expect(3); var cond = _.cond([ - [{ 'a': 1 }, alwaysA], - [['b', 1], alwaysB], - ['c', alwaysC] + [{ 'a': 1 }, stubA], + [['b', 1], stubB], + ['c', stubC] ]); assert.strictEqual(cond({ 'a': 1, 'b': 2, 'c': 3 }), 'a'); @@ -3285,7 +3288,7 @@ QUnit.test('should return `undefined` when no condition is met', function(assert) { assert.expect(1); - var cond = _.cond([[alwaysFalse, alwaysA]]); + var cond = _.cond([[stubFalse, stubA]]); assert.strictEqual(cond({ 'a': 1 }), undefined); }); @@ -3293,7 +3296,7 @@ assert.expect(2); lodashStable.each([false, true], function(value) { - assert.raises(function() { _.cond([[alwaysTrue, value]])(); }, TypeError); + assert.raises(function() { _.cond([[stubTrue, value]])(); }, TypeError); }); }); @@ -3418,7 +3421,7 @@ assert.expect(1); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var conforms = _.conforms({ 'a': function(value) { return value > 1; } @@ -3437,7 +3440,7 @@ assert.expect(1); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysTrue), + expected = lodashStable.map(values, stubTrue), conforms = _.conforms({}); var actual = lodashStable.map(values, function(value, index) { @@ -3453,7 +3456,7 @@ assert.expect(1); var object = { 'a': 1 }, - expected = lodashStable.map(empties, alwaysTrue); + expected = lodashStable.map(empties, stubTrue); var actual = lodashStable.map(empties, function(value) { var conforms = _.conforms(value); @@ -3490,27 +3493,24 @@ var object = { 'a': 1 }, values = Array(2).concat(empties, true, 1, 'a'), - constant = _.constant(object), - expected = lodashStable.map(values, function() { return true; }); + constant = _.constant(object); - var actual = lodashStable.map(values, function(value, index) { - if (index == 0) { - var result = constant(); - } else if (index == 1) { - result = constant.call({}); - } else { - result = constant(value); + var results = lodashStable.map(values, function(value, index) { + if (index < 2) { + return index ? constant.call({}) : constant(); } - return result === object; + return constant(value); }); - assert.deepEqual(actual, expected); + assert.ok(lodashStable.every(results, function(result) { + return result === object; + })); }); QUnit.test('should work with falsey values', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, function() { return true; }); + var expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(value, index) { var constant = index ? _.constant(value) : _.constant(), @@ -3685,7 +3685,7 @@ QUnit.test('should accept a falsey `prototype` argument', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysEmptyObject); + var expected = lodashStable.map(falsey, stubObject); var actual = lodashStable.map(falsey, function(prototype, index) { return index ? _.create(prototype) : _.create(); @@ -3697,7 +3697,7 @@ QUnit.test('should ignore primitive `prototype` arguments and use an empty object instead', function(assert) { assert.expect(1); - var expected = lodashStable.map(primitives, alwaysTrue); + var expected = lodashStable.map(primitives, stubTrue); var actual = lodashStable.map(primitives, function(value, index) { return lodashStable.isPlainObject(index ? _.create(value) : _.create()); @@ -3710,7 +3710,7 @@ assert.expect(1); var array = [{ 'a': 1 }, { 'a': 1 }, { 'a': 1 }], - expected = lodashStable.map(array, alwaysTrue), + expected = lodashStable.map(array, stubTrue), objects = lodashStable.map(array, _.create); var actual = lodashStable.map(objects, function(object) { @@ -3756,7 +3756,7 @@ assert.expect(2); var values = ['0', 0.6, 'xyz'], - expected = lodashStable.map(values, alwaysEmptyArray); + expected = lodashStable.map(values, stubArray); var actual = lodashStable.map(values, function(arity) { return _.curry(fn, arity)(); @@ -3914,7 +3914,7 @@ assert.expect(2); var values = ['0', 0.6, 'xyz'], - expected = lodashStable.map(values, alwaysEmptyArray); + expected = lodashStable.map(values, stubArray); var actual = lodashStable.map(values, function(arity) { return _.curryRight(fn, arity)(); @@ -4111,15 +4111,15 @@ return value; }, 32); - var actual = [debounced(0), debounced(1), debounced(2)]; - assert.deepEqual(actual, [undefined, undefined, undefined]); + var results = [debounced('a'), debounced('b'), debounced('c')]; + assert.deepEqual(results, [undefined, undefined, undefined]); assert.strictEqual(callCount, 0); setTimeout(function() { assert.strictEqual(callCount, 1); - var actual = [debounced(3), debounced(4), debounced(5)]; - assert.deepEqual(actual, [2, 2, 2]); + var results = [debounced('d'), debounced('e'), debounced('f')]; + assert.deepEqual(results, ['c', 'c', 'c']); assert.strictEqual(callCount, 1); }, 128); @@ -4135,14 +4135,14 @@ var done = assert.async(); var debounced = _.debounce(identity, 32); - debounced('x'); + debounced('a'); setTimeout(function() { - assert.notEqual(debounced('y'), 'y'); + assert.notEqual(debounced('b'), 'b'); }, 64); setTimeout(function() { - assert.notEqual(debounced('z'), 'z'); + assert.notEqual(debounced('c'), 'c'); done(); }, 128); }); @@ -4220,13 +4220,13 @@ var done = assert.async(); var debounced = _.debounce(identity, 32, { 'leading': true, 'trailing': false }), - result = [debounced('x'), debounced('y')]; + results = [debounced('a'), debounced('b')]; - assert.deepEqual(result, ['x', 'x']); + assert.deepEqual(results, ['a', 'a']); setTimeout(function() { - var result = [debounced('a'), debounced('b')]; - assert.deepEqual(result, ['a', 'a']); + var results = [debounced('c'), debounced('d')]; + assert.deepEqual(results, ['c', 'c']); done(); }, 64); }); @@ -4640,11 +4640,8 @@ var done = assert.async(); - var pass = true; - - var timerId = _.defer(function() { - pass = false; - }); + var pass = true, + timerId = _.defer(function() { pass = false; }); clearTimeout(timerId); @@ -4701,10 +4698,7 @@ var done = assert.async(); var pass = false; - - _.delay(function() { - pass = true; - }); + _.delay(function() { pass = true; }); assert.notOk(pass); @@ -4719,11 +4713,8 @@ var done = assert.async(); - var pass = true; - - var timerId = _.delay(function() { - pass = false; - }, 32); + var pass = true, + timerId = _.delay(function() { pass = false; }, 32); clearTimeout(timerId); @@ -4732,6 +4723,24 @@ done(); }, 64); }); + + QUnit.test('should work with mocked `setTimeout`', function(assert) { + assert.expect(1); + + if (!isPhantom) { + var pass = false, + setTimeout = root.setTimeout; + + setProperty(root, 'setTimeout', function(func) { func(); }); + _.delay(function() { pass = true; }, 32); + setProperty(root, 'setTimeout', setTimeout); + + assert.ok(pass); + } + else { + skipAssert(assert); + } + }); }()); /*--------------------------------------------------------------------------*/ @@ -4742,14 +4751,18 @@ var args = (function() { return arguments; }(1, 2, 3)), func = _[methodName]; - QUnit.test('`_.' + methodName + '` should return the difference of the given arrays', function(assert) { - assert.expect(2); + QUnit.test('`_.' + methodName + '` should return the difference of two arrays', function(assert) { + assert.expect(1); - var actual = func([1, 2, 3, 4, 5], [5, 2, 10]); - assert.deepEqual(actual, [1, 3, 4]); + var actual = func([2, 1], [2, 3]); + assert.deepEqual(actual, [1]); + }); - actual = func([1, 2, 3, 4, 5], [5, 2, 10], [8, 4]); - assert.deepEqual(actual, [1, 3]); + QUnit.test('`_.' + methodName + '` should return the difference of multiple arrays', function(assert) { + assert.expect(1); + + var actual = func([2, 1, 2, 3], [3, 4], [3, 2]); + assert.deepEqual(actual, [1]); }); QUnit.test('`_.' + methodName + '` should treat `-0` as `0`', function(assert) { @@ -4800,7 +4813,7 @@ assert.deepEqual(actual, [[], []]); - var largeArray = lodashStable.times(LARGE_ARRAY_SIZE, alwaysOne); + var largeArray = lodashStable.times(LARGE_ARRAY_SIZE, stubOne); actual = lodashStable.map(func([-0, 1], largeArray), lodashStable.toString); assert.deepEqual(actual, ['0']); }); @@ -4808,7 +4821,7 @@ QUnit.test('`_.' + methodName + '` should work with large arrays of `NaN`', function(assert) { assert.expect(1); - var largeArray = lodashStable.times(LARGE_ARRAY_SIZE, alwaysNaN); + var largeArray = lodashStable.times(LARGE_ARRAY_SIZE, stubNaN); assert.deepEqual(func([1, NaN, 3], largeArray), [1, 3]); }); @@ -4841,8 +4854,8 @@ QUnit.test('should accept an `iteratee` argument', function(assert) { assert.expect(2); - var actual = _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor); - assert.deepEqual(actual, [3.1, 1.3]); + var actual = _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); + assert.deepEqual(actual, [1.2]); actual = _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); assert.deepEqual(actual, [{ 'x': 2 }]); @@ -4853,11 +4866,11 @@ var args; - _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], function() { + _.differenceBy([2.1, 1.2], [2.3, 3.4], function() { args || (args = slice.call(arguments)); }); - assert.deepEqual(args, [4.4]); + assert.deepEqual(args, [2.3]); }); }()); @@ -4879,7 +4892,7 @@ assert.expect(1); var array = [-0, 1], - largeArray = lodashStable.times(LARGE_ARRAY_SIZE, alwaysOne), + largeArray = lodashStable.times(LARGE_ARRAY_SIZE, stubOne), others = [[1], largeArray], expected = lodashStable.map(others, lodashStable.constant(['-0'])); @@ -4947,7 +4960,7 @@ }); }); - QUnit.test('should return an empty array when `n` >= `array.length`', function(assert) { + QUnit.test('should return an empty array when `n` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 4, Math.pow(2, 32), Infinity], function(n) { @@ -5035,7 +5048,7 @@ }); }); - QUnit.test('should return an empty array when `n` >= `array.length`', function(assert) { + QUnit.test('should return an empty array when `n` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 4, Math.pow(2, 32), Infinity], function(n) { @@ -5274,7 +5287,7 @@ assert.strictEqual(_.endsWith(string, 'b', 2), true); }); - QUnit.test('should work with `position` >= `string.length`', function(assert) { + QUnit.test('should work with `position` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 5, MAX_SAFE_INTEGER, Infinity], function(position) { @@ -5285,7 +5298,7 @@ QUnit.test('should treat falsey `position` values, except `undefined`, as `0`', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysTrue); + var expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(position) { return _.endsWith(string, position === undefined ? 'c' : '', position); @@ -5299,7 +5312,7 @@ lodashStable.each([-1, -3, -Infinity], function(position) { assert.ok(lodashStable.every(string, function(chr) { - return _.endsWith(string, chr, position) === false; + return !_.endsWith(string, chr, position); })); assert.strictEqual(_.endsWith(string, '', position), true); }); @@ -5405,7 +5418,7 @@ assert.expect(1); var values = [, null, undefined, ''], - expected = lodashStable.map(values, alwaysEmptyString); + expected = lodashStable.map(values, stubString); var actual = lodashStable.map(values, function(value, index) { return index ? _.escapeRegExp(value) : _.escapeRegExp(); @@ -5429,7 +5442,7 @@ QUnit.test('should return `true` for empty collections', function(assert) { assert.expect(1); - var expected = lodashStable.map(empties, alwaysTrue); + var expected = lodashStable.map(empties, stubTrue); var actual = lodashStable.map(empties, function(value) { try { @@ -5463,7 +5476,7 @@ assert.expect(2); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(value, index) { var array = [0]; @@ -5472,7 +5485,7 @@ assert.deepEqual(actual, expected); - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); actual = lodashStable.map(values, function(value, index) { var array = [1]; return index ? _.every(array, value) : _.every(array); @@ -5538,7 +5551,7 @@ QUnit.module('lodash.fill'); (function() { - QUnit.test('should use a default `start` of `0` and a default `end` of `array.length`', function(assert) { + QUnit.test('should use a default `start` of `0` and a default `end` of `length`', function(assert) { assert.expect(1); var array = [1, 2, 3]; @@ -5564,7 +5577,7 @@ assert.deepEqual(_.fill(array, 'a', 1), [1, 'a', 'a']); }); - QUnit.test('should work with a `start` >= `array.length`', function(assert) { + QUnit.test('should work with a `start` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 4, Math.pow(2, 32), Infinity], function(start) { @@ -5593,7 +5606,7 @@ assert.deepEqual(_.fill(array, 'a', -1), [1, 2, 'a']); }); - QUnit.test('should work with a negative `start` <= negative `array.length`', function(assert) { + QUnit.test('should work with a negative `start` <= negative `length`', function(assert) { assert.expect(3); lodashStable.each([-3, -4, -Infinity], function(start) { @@ -5618,7 +5631,7 @@ assert.deepEqual(_.fill(array, 'a', 0, 1), ['a', 2, 3]); }); - QUnit.test('should work with a `end` >= `array.length`', function(assert) { + QUnit.test('should work with a `end` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 4, Math.pow(2, 32), Infinity], function(end) { @@ -5649,7 +5662,7 @@ assert.deepEqual(_.fill(array, 'a', 0, -1), ['a', 'a', 3]); }); - QUnit.test('should work with a negative `end` <= negative `array.length`', function(assert) { + QUnit.test('should work with a negative `end` <= negative `length`', function(assert) { assert.expect(3); lodashStable.each([-3, -4, -Infinity], function(end) { @@ -5689,8 +5702,8 @@ actual = wrapped.value(); assert.ok(wrapped instanceof _); - assert.deepEqual(actual, ['a', 'a', 'a']); assert.strictEqual(actual, array); + assert.deepEqual(actual, ['a', 'a', 'a']); } else { skipAssert(assert, 3); @@ -5720,7 +5733,7 @@ object = { '1': 'foo', '8': 'bar', '50': 'baz' }; lodashStable.times(1000, function(assert) { - _.filter([], alwaysTrue); + _.filter([], stubTrue); }); _.filter(object, function() { @@ -5747,12 +5760,12 @@ ]; var expected = ({ - 'find': [objects[1], undefined, objects[2], objects[1]], - 'findLast': [objects[2], undefined, objects[2], objects[2]], - 'findIndex': [1, -1, 2, 1], - 'findLastIndex': [2, -1, 2, 2], - 'findKey': ['1', undefined, '2', '1'], - 'findLastKey': ['2', undefined, '2', '2'] + '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]; QUnit.test('`_.' + methodName + '` should return the found value', function(assert) { @@ -5782,7 +5795,7 @@ QUnit.test('`_.' + methodName + '` should work with `_.property` shorthands', function(assert) { assert.expect(1); - assert.strictEqual(func(objects, 'b'), expected[3]); + assert.strictEqual(func(objects, 'b'), expected[0]); }); QUnit.test('`_.' + methodName + '` should return `' + expected[1] + '` for empty collections', function(assert) { @@ -5804,18 +5817,18 @@ (function() { var array = [1, 2, 3, 4]; - var expected = ({ - 'find': 1, - 'findLast': 4, - 'findIndex': 0, - 'findLastIndex': 3, - 'findKey': '0', - 'findLastKey': '3' - })[methodName]; - QUnit.test('`_.' + methodName + '` should return an unwrapped value when implicitly chaining', function(assert) { assert.expect(1); + var expected = ({ + 'find': 1, + 'findLast': 4, + 'findIndex': 0, + 'findLastIndex': 3, + 'findKey': '0', + 'findLastKey': '3' + })[methodName]; + if (!isNpm) { assert.strictEqual(_(array)[methodName](), expected); } @@ -5919,6 +5932,309 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.find and lodash.includes'); + + lodashStable.each(['includes', 'find'], function(methodName) { + var args = (function() { return arguments; }(1, 2, 3, 4)), + func = _[methodName], + isIncludes = methodName == 'includes', + resolve = methodName == 'find' ? lodashStable.curry(lodashStable.eq) : identity; + + lodashStable.each({ + 'an `arguments` object': args, + 'an array': [1, 2, 3, 4] + }, + function(collection, key) { + var values = lodashStable.toArray(collection); + + QUnit.test('`_.' + methodName + '` should work with ' + key + ' and a positive `fromIndex`', function(assert) { + assert.expect(1); + + var expected = [ + isIncludes || values[2], + isIncludes ? false : undefined + ]; + + var actual = [ + func(collection, resolve(values[2]), 2), + func(collection, resolve(values[1]), 2) + ]; + + assert.deepEqual(actual, expected); + }); + + QUnit.test('`_.' + methodName + '` should work with ' + key + ' and a `fromIndex` >= `length`', function(assert) { + assert.expect(1); + + var indexes = [4, 6, Math.pow(2, 32), Infinity]; + + var expected = lodashStable.map(indexes, function() { + var result = isIncludes ? false : undefined; + return [result, result, result]; + }); + + var actual = lodashStable.map(indexes, function(fromIndex) { + return [ + func(collection, resolve(1), fromIndex), + func(collection, resolve(undefined), fromIndex), + func(collection, resolve(''), fromIndex) + ]; + }); + + assert.deepEqual(actual, expected); + }); + + QUnit.test('`_.' + methodName + '` should work with ' + key + ' and treat falsey `fromIndex` values as `0`', function(assert) { + assert.expect(1); + + var expected = lodashStable.map(falsey, lodashStable.constant(isIncludes || values[0])); + + var actual = lodashStable.map(falsey, function(fromIndex) { + return func(collection, resolve(values[0]), fromIndex); + }); + + assert.deepEqual(actual, expected); + }); + + QUnit.test('`_.' + methodName + '` should work with ' + key + ' and coerce `fromIndex` to an integer', function(assert) { + assert.expect(1); + + var expected = [ + isIncludes || values[0], + isIncludes || values[0], + isIncludes ? false : undefined + ]; + + var actual = [ + func(collection, resolve(values[0]), 0.1), + func(collection, resolve(values[0]), NaN), + func(collection, resolve(values[0]), '1') + ]; + + assert.deepEqual(actual, expected); + }); + + QUnit.test('`_.' + methodName + '` should work with ' + key + ' and a negative `fromIndex`', function(assert) { + assert.expect(1); + + var expected = [ + isIncludes || values[2], + isIncludes ? false : undefined + ]; + + var actual = [ + func(collection, resolve(values[2]), -2), + func(collection, resolve(values[1]), -2) + ]; + + assert.deepEqual(actual, expected); + }); + + QUnit.test('`_.' + methodName + '` should work with ' + key + ' and a negative `fromIndex` <= `-length`', function(assert) { + assert.expect(1); + + var indexes = [-4, -6, -Infinity], + expected = lodashStable.map(indexes, lodashStable.constant(isIncludes || values[0])); + + var actual = lodashStable.map(indexes, function(fromIndex) { + return func(collection, resolve(values[0]), fromIndex); + }); + + assert.deepEqual(actual, expected); + }); + }); + }); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('lodash.findIndex and lodash.indexOf'); + + lodashStable.each(['findIndex', 'indexOf'], function(methodName) { + var array = [1, 2, 3, 1, 2, 3], + func = _[methodName], + resolve = methodName == 'findIndex' ? lodashStable.curry(lodashStable.eq) : identity; + + QUnit.test('`_.' + methodName + '` should return the index of the first matched value', function(assert) { + assert.expect(1); + + assert.strictEqual(func(array, resolve(3)), 2); + }); + + QUnit.test('`_.' + methodName + '` should work with a positive `fromIndex`', function(assert) { + assert.expect(1); + + assert.strictEqual(func(array, resolve(1), 2), 3); + }); + + QUnit.test('`_.' + methodName + '` should work with a `fromIndex` >= `length`', function(assert) { + assert.expect(1); + + var values = [6, 8, Math.pow(2, 32), Infinity], + expected = lodashStable.map(values, lodashStable.constant([-1, -1, -1])); + + var actual = lodashStable.map(values, function(fromIndex) { + return [ + func(array, resolve(undefined), fromIndex), + func(array, resolve(1), fromIndex), + func(array, resolve(''), fromIndex) + ]; + }); + + assert.deepEqual(actual, expected); + }); + + QUnit.test('`_.' + methodName + '` should work with a negative `fromIndex`', function(assert) { + assert.expect(1); + + assert.strictEqual(func(array, resolve(2), -3), 4); + }); + + QUnit.test('`_.' + methodName + '` should work with a negative `fromIndex` <= `-length`', function(assert) { + assert.expect(1); + + var values = [-6, -8, -Infinity], + expected = lodashStable.map(values, stubZero); + + var actual = lodashStable.map(values, function(fromIndex) { + return func(array, resolve(1), fromIndex); + }); + + assert.deepEqual(actual, expected); + }); + + QUnit.test('`_.' + methodName + '` should treat falsey `fromIndex` values as `0`', function(assert) { + assert.expect(1); + + var expected = lodashStable.map(falsey, stubZero); + + var actual = lodashStable.map(falsey, function(fromIndex) { + return func(array, resolve(1), fromIndex); + }); + + assert.deepEqual(actual, expected); + }); + + QUnit.test('`_.' + methodName + '` should coerce `fromIndex` to an integer', function(assert) { + assert.expect(1); + + assert.strictEqual(func(array, resolve(2), 1.2), 1); + }); + }); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('lodash.findLast'); + + (function() { + var args = (function() { return arguments; }(1, 2, 3, 4)), + resolve = lodashStable.curry(lodashStable.eq); + + lodashStable.each({ + 'an `arguments` object': args, + 'an array': [1, 2, 3, 4], + }, + function(collection, key) { + var values = lodashStable.toArray(collection); + + QUnit.test('should work with ' + key + ' and a positive `fromIndex`', function(assert) { + assert.expect(1); + + var expected = [ + values[2], + undefined + ]; + + var actual = [ + _.findLast(collection, resolve(values[2]), 2), + _.findLast(collection, resolve(values[3]), 2) + ]; + + assert.deepEqual(actual, expected); + }); + + QUnit.test('should work with ' + key + ' and a `fromIndex` >= `length`', function(assert) { + assert.expect(1); + + var indexes = [4, 6, Math.pow(2, 32), Infinity]; + + var expected = lodashStable.map(indexes, lodashStable.constant([values[0], undefined, undefined])); + + var actual = lodashStable.map(indexes, function(fromIndex) { + return [ + _.findLast(collection, resolve(1), fromIndex), + _.findLast(collection, resolve(undefined), fromIndex), + _.findLast(collection, resolve(''), fromIndex) + ]; + }); + + assert.deepEqual(actual, expected); + }); + + QUnit.test('should work with ' + key + ' and treat falsey `fromIndex` values correctly', function(assert) { + assert.expect(1); + + var expected = lodashStable.map(falsey, function(value) { + return value === undefined ? values[3] : undefined; + }); + + var actual = lodashStable.map(falsey, function(fromIndex) { + return _.findLast(collection, resolve(values[3]), fromIndex); + }); + + assert.deepEqual(actual, expected); + }); + + QUnit.test('should work with ' + key + ' and coerce `fromIndex` to an integer', function(assert) { + assert.expect(1); + + var expected = [ + values[0], + values[0], + undefined + ]; + + var actual = [ + _.findLast(collection, resolve(values[0]), 0.1), + _.findLast(collection, resolve(values[0]), NaN), + _.findLast(collection, resolve(values[2]), '1') + ]; + + assert.deepEqual(actual, expected); + }); + + QUnit.test('should work with ' + key + ' and a negative `fromIndex`', function(assert) { + assert.expect(1); + + var expected = [ + values[2], + undefined + ]; + + var actual = [ + _.findLast(collection, resolve(values[2]), -2), + _.findLast(collection, resolve(values[3]), -2) + ]; + + assert.deepEqual(actual, expected); + }); + + QUnit.test('should work with ' + key + ' and a negative `fromIndex` <= `-length`', function(assert) { + assert.expect(1); + + var indexes = [-4, -6, -Infinity], + expected = lodashStable.map(indexes, lodashStable.constant(values[0])); + + var actual = lodashStable.map(indexes, function(fromIndex) { + return _.findLast(collection, resolve(values[0]), fromIndex); + }); + + assert.deepEqual(actual, expected); + }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.flip'); (function() { @@ -6035,7 +6351,7 @@ QUnit.test('`_.' + methodName + '` should accept a falsey `collection` argument', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysEmptyArray); + var expected = lodashStable.map(falsey, stubArray); var actual = lodashStable.map(falsey, function(collection, index) { try { @@ -6700,7 +7016,7 @@ }; var values = [-1, '1', 1.1, Object(1), MAX_SAFE_INTEGER + 1], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(length) { return isIteratedAsObject({ 'length': length }); @@ -6725,7 +7041,7 @@ isSome = methodName == 'some', isReduce = /^reduce/.test(methodName); - QUnit.test('`_.' + methodName + '` should ignore changes to `array.length`', function(assert) { + QUnit.test('`_.' + methodName + '` should ignore changes to `length`', function(assert) { assert.expect(1); if (func) { @@ -6837,7 +7153,7 @@ var source = { 'a': 1 }, values = [null, undefined], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(value) { var object = func(value, source); @@ -6904,23 +7220,18 @@ assert.expect(4); lodashStable.each(['a', ['a'], { 'a': 1 }, NaN], function(value) { - if (defineProperty) { - var object = {}, - pass = true; - - defineProperty(object, 'a', { - 'enumerable': true, - 'configurable': true, - 'get': lodashStable.constant(value), - 'set': function() { pass = false; } - }); + var object = {}, + pass = true; - func(object, { 'a': value }); - assert.ok(pass); - } - else { - skipAssert(assert); - } + defineProperty(object, 'a', { + 'enumerable': true, + 'configurable': true, + 'get': lodashStable.constant(value), + 'set': function() { pass = false; } + }); + + func(object, { 'a': value }); + assert.ok(pass); }); }); }); @@ -7073,7 +7384,7 @@ QUnit.test('should accept a falsey `array` argument', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysEmptyObject); + var expected = lodashStable.map(falsey, stubObject); var actual = lodashStable.map(falsey, function(array, index) { try { @@ -7356,7 +7667,7 @@ var object = { '-0': 'a', '0': 'b' }, props = [-0, Object(-0), 0, Object(0)], - expected = lodashStable.map(props, alwaysTrue); + expected = lodashStable.map(props, stubTrue); var actual = lodashStable.map(props, function(key) { return func(object, key); @@ -7437,7 +7748,7 @@ delete string[0]; var values = [Array(3), args, string], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(value) { return func(value, 0); @@ -7461,7 +7772,7 @@ assert.expect(2); var values = [null, undefined], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); lodashStable.each(['constructor', ['constructor']], function(path) { var actual = lodashStable.map(values, function(value) { @@ -7476,7 +7787,7 @@ assert.expect(2); var values = [null, undefined], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); lodashStable.each(['constructor.prototype.valueOf', ['constructor', 'prototype', 'valueOf']], function(path) { var actual = lodashStable.map(values, function(value) { @@ -7491,7 +7802,7 @@ assert.expect(2); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); lodashStable.each(['a.b', ['a', 'b']], function(path) { var actual = lodashStable.map(values, function(value, index) { @@ -7619,10 +7930,6 @@ 'a string': '1234' }, function(collection, key) { - var isStr = typeof collection == 'string', - values = lodashStable.toArray(collection), - length = values.length; - QUnit.test('should work with ' + key + ' and return `true` for matched values', function(assert) { assert.expect(1); @@ -7635,58 +7942,6 @@ assert.strictEqual(_.includes(collection, 5), false); }); - QUnit.test('should work with ' + key + ' and a positive `fromIndex`', function(assert) { - assert.expect(2); - - assert.strictEqual(_.includes(collection, values[2], 2), true); - assert.strictEqual(_.includes(collection, values[1], 2), false); - }); - - QUnit.test('should work with ' + key + ' and a `fromIndex` >= `collection.length`', function(assert) { - assert.expect(12); - - lodashStable.each([4, 6, Math.pow(2, 32), Infinity], function(fromIndex) { - assert.strictEqual(_.includes(collection, 1, fromIndex), false); - assert.strictEqual(_.includes(collection, undefined, fromIndex), false); - assert.strictEqual(_.includes(collection, '', fromIndex), (isStr && fromIndex == length)); - }); - }); - - QUnit.test('should work with ' + key + ' and treat falsey `fromIndex` values as `0`', function(assert) { - assert.expect(1); - - var expected = lodashStable.map(falsey, alwaysTrue); - - var actual = lodashStable.map(falsey, function(fromIndex) { - return _.includes(collection, values[0], fromIndex); - }); - - assert.deepEqual(actual, expected); - }); - - QUnit.test('should work with ' + key + ' and coerce non-integer `fromIndex` values to integers', function(assert) { - assert.expect(3); - - assert.strictEqual(_.includes(collection, values[0], '1'), false); - assert.strictEqual(_.includes(collection, values[0], 0.1), true); - assert.strictEqual(_.includes(collection, values[0], NaN), true); - }); - - QUnit.test('should work with ' + key + ' and a negative `fromIndex`', function(assert) { - assert.expect(2); - - assert.strictEqual(_.includes(collection, values[2], -2), true); - assert.strictEqual(_.includes(collection, values[1], -2), false); - }); - - QUnit.test('should work with ' + key + ' and a negative `fromIndex` <= negative `collection.length`', function(assert) { - assert.expect(3); - - lodashStable.each([-4, -6, -Infinity], function(fromIndex) { - assert.strictEqual(_.includes(collection, values[0], fromIndex), true); - }); - }); - QUnit.test('should work with ' + key + ' and floor `position` values', function(assert) { assert.expect(1); @@ -7732,7 +7987,7 @@ QUnit.test('should return `false` for empty collections', function(assert) { assert.expect(1); - var expected = lodashStable.map(empties, alwaysFalse); + var expected = lodashStable.map(empties, stubFalse); var actual = lodashStable.map(empties, function(value) { try { @@ -7743,102 +7998,50 @@ assert.deepEqual(actual, expected); }); - QUnit.test('should match `NaN`', function(assert) { - assert.expect(1); - - assert.strictEqual(_.includes([1, NaN, 3], NaN), true); - }); - - QUnit.test('should match `-0` as `0`', function(assert) { - assert.expect(2); - - assert.strictEqual(_.includes([-0], 0), true); - assert.strictEqual(_.includes([0], -0), true); - }); - - 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]; - - assert.ok(lodashStable.every(array1, lodashStable.partial(_.includes, array2))); - }); - }(1, 2, 3, 4)); - - /*--------------------------------------------------------------------------*/ - - QUnit.module('lodash.indexOf'); - - (function() { - var array = [1, 2, 3, 1, 2, 3]; - - QUnit.test('should return the index of the first matched value', function(assert) { - assert.expect(1); - - assert.strictEqual(_.indexOf(array, 3), 2); - }); - - QUnit.test('should work with a positive `fromIndex`', function(assert) { + QUnit.test('should work with a string and a `fromIndex` >= `length`', function(assert) { assert.expect(1); - assert.strictEqual(_.indexOf(array, 1, 2), 3); - }); - - QUnit.test('should work with `fromIndex` >= `array.length`', function(assert) { - assert.expect(1); + var string = '1234', + length = string.length, + indexes = [4, 6, Math.pow(2, 32), Infinity]; - var values = [6, 8, Math.pow(2, 32), Infinity], - expected = lodashStable.map(values, lodashStable.constant([-1, -1, -1])); + var expected = lodashStable.map(indexes, function(index) { + return [false, false, index == length]; + }); - var actual = lodashStable.map(values, function(fromIndex) { + var actual = lodashStable.map(indexes, function(fromIndex) { return [ - _.indexOf(array, undefined, fromIndex), - _.indexOf(array, 1, fromIndex), - _.indexOf(array, '', fromIndex) + _.includes(string, 1, fromIndex), + _.includes(string, undefined, fromIndex), + _.includes(string, '', fromIndex) ]; }); assert.deepEqual(actual, expected); }); - QUnit.test('should work with a negative `fromIndex`', function(assert) { + QUnit.test('should match `NaN`', function(assert) { assert.expect(1); - assert.strictEqual(_.indexOf(array, 2, -3), 4); + assert.strictEqual(_.includes([1, NaN, 3], NaN), true); }); - QUnit.test('should work with a negative `fromIndex` <= `-array.length`', function(assert) { - assert.expect(1); - - var values = [-6, -8, -Infinity], - expected = lodashStable.map(values, alwaysZero); - - var actual = lodashStable.map(values, function(fromIndex) { - return _.indexOf(array, 1, fromIndex); - }); + QUnit.test('should match `-0` as `0`', function(assert) { + assert.expect(2); - assert.deepEqual(actual, expected); + assert.strictEqual(_.includes([-0], 0), true); + assert.strictEqual(_.includes([0], -0), true); }); - QUnit.test('should treat falsey `fromIndex` values as `0`', function(assert) { + QUnit.test('should work as an iteratee for methods like `_.every`', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysZero); - - var actual = lodashStable.map(falsey, function(fromIndex) { - return _.indexOf(array, 1, fromIndex); - }); - - assert.deepEqual(actual, expected); - }); - - QUnit.test('should coerce `fromIndex` to an integer', function(assert) { - assert.expect(1); + var array1 = [1, 2, 3], + array2 = [2, 3, 1]; - assert.strictEqual(_.indexOf(array, 2, 1.2), 1); + assert.ok(lodashStable.every(array1, lodashStable.partial(_.includes, array2))); }); - }()); + }(1, 2, 3, 4)); /*--------------------------------------------------------------------------*/ @@ -7850,7 +8053,7 @@ QUnit.test('should accept a falsey `array` argument', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysEmptyArray); + var expected = lodashStable.map(falsey, stubArray); var actual = lodashStable.map(falsey, function(array, index) { try { @@ -7971,7 +8174,7 @@ assert.expect(1); var actual = [_.inRange(0, '0', 1), _.inRange(0, '1'), _.inRange(0, 0, '1'), _.inRange(0, NaN, 1), _.inRange(-1, -1, NaN)], - expected = lodashStable.map(actual, alwaysTrue); + expected = lodashStable.map(actual, stubTrue); assert.deepEqual(actual, expected); }); @@ -7986,23 +8189,17 @@ func = _[methodName]; QUnit.test('`_.' + methodName + '` should return the intersection of two arrays', function(assert) { - assert.expect(2); - - var actual = func([1, 3, 2], [5, 2, 1, 4]); - assert.deepEqual(actual, [1, 2]); + assert.expect(1); - actual = func([5, 2, 1, 4], [1, 3, 2]); - assert.deepEqual(actual, [2, 1]); + var actual = func([2, 1], [2, 3]); + assert.deepEqual(actual, [2]); }); QUnit.test('`_.' + methodName + '` should return the intersection of multiple arrays', function(assert) { - assert.expect(2); - - var actual = func([1, 3, 2], [5, 2, 1, 4], [2, 1]); - assert.deepEqual(actual, [1, 2]); + assert.expect(1); - actual = func([5, 2, 1, 4], [2, 1], [1, 3, 2]); - assert.deepEqual(actual, [2, 1]); + var actual = func([2, 1, 2, 3], [3, 4], [3, 2]); + assert.deepEqual(actual, [3]); }); QUnit.test('`_.' + methodName + '` should return an array of unique values', function(assert) { @@ -8066,7 +8263,7 @@ QUnit.test('`_.' + methodName + '` should work with large arrays of `NaN`', function(assert) { assert.expect(1); - var largeArray = lodashStable.times(LARGE_ARRAY_SIZE, alwaysNaN); + var largeArray = lodashStable.times(LARGE_ARRAY_SIZE, stubNaN); assert.deepEqual(func([1, NaN, 3], largeArray), [NaN]); }); @@ -8111,7 +8308,7 @@ QUnit.test('should accept an `iteratee` argument', function(assert) { assert.expect(2); - var actual = _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); + var actual = _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor); assert.deepEqual(actual, [2.1]); actual = _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); @@ -8123,11 +8320,11 @@ var args; - _.intersectionBy([2.1, 1.2], [4.3, 2.4], function() { + _.intersectionBy([2.1, 1.2], [2.3, 3.4], function() { args || (args = slice.call(arguments)); }); - assert.deepEqual(args, [4.3]); + assert.deepEqual(args, [2.3]); }); }()); @@ -8150,7 +8347,7 @@ assert.expect(1); var array = [-0], - largeArray = lodashStable.times(LARGE_ARRAY_SIZE, alwaysZero), + largeArray = lodashStable.times(LARGE_ARRAY_SIZE, stubZero), others = [[0], largeArray], expected = lodashStable.map(others, lodashStable.constant(['-0'])); @@ -8304,7 +8501,7 @@ QUnit.test('should preserve the sign of `0`', function(assert) { assert.expect(1); - var object = { '-0': alwaysA, '0': alwaysB }, + var object = { '-0': stubA, '0': stubB }, props = [-0, Object(-0), 0, Object(0)]; var actual = lodashStable.map(props, function(key) { @@ -8339,7 +8536,7 @@ assert.expect(1); if (!isNpm) { - var object = { 'a': alwaysOne }; + var object = { 'a': stubOne }; assert.strictEqual(_(object).invoke('a'), 1); } else { @@ -8351,7 +8548,7 @@ assert.expect(1); if (!isNpm) { - var object = { 'a': alwaysOne }; + var object = { 'a': stubOne }; assert.ok(_(object).chain().invoke('a') instanceof _); } else { @@ -8425,7 +8622,7 @@ QUnit.test('should not error on elements with missing properties', function(assert) { assert.expect(1); - var objects = lodashStable.map([null, undefined, alwaysOne], function(value) { + var objects = lodashStable.map([null, undefined, stubOne], function(value) { return { 'a': value }; }); @@ -8513,7 +8710,7 @@ QUnit.test('should return `false` for non `arguments` objects', function(assert) { assert.expect(12); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isArguments(value) : _.isArguments(); @@ -8562,7 +8759,7 @@ QUnit.test('should return `false` for non-arrays', function(assert) { assert.expect(12); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isArray(value) : _.isArray(); @@ -8616,7 +8813,7 @@ QUnit.test('should return `false` for non array buffers', function(assert) { assert.expect(13); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isArrayBuffer(value) : _.isArrayBuffer(); @@ -8661,7 +8858,7 @@ assert.expect(1); var values = [args, [1, 2, 3], { '0': 1, 'length': 1 }, 'a'], - expected = lodashStable.map(values, alwaysTrue), + expected = lodashStable.map(values, stubTrue), actual = lodashStable.map(values, _.isArrayLike); assert.deepEqual(actual, expected); @@ -8697,7 +8894,7 @@ if (realm.object) { var values = [realm.arguments, realm.array, realm.string], - expected = lodashStable.map(values, alwaysTrue), + expected = lodashStable.map(values, stubTrue), actual = lodashStable.map(values, _.isArrayLike); assert.deepEqual(actual, expected); @@ -8783,7 +8980,7 @@ QUnit.test('should return `false` for non-buffers', function(assert) { assert.expect(13); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isBuffer(value) : _.isBuffer(); @@ -8833,7 +9030,7 @@ QUnit.test('should return `false` for non-dates', function(assert) { assert.expect(12); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isDate(value) : _.isDate(); @@ -8894,7 +9091,7 @@ QUnit.test('should return `false` for non DOM elements', function(assert) { assert.expect(13); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isElement(value) : _.isElement(); @@ -8938,7 +9135,7 @@ QUnit.test('should return `true` for empty values', function(assert) { assert.expect(10); - var expected = lodashStable.map(empties, alwaysTrue), + var expected = lodashStable.map(empties, stubTrue), actual = lodashStable.map(empties, _.isEmpty); assert.deepEqual(actual, expected); @@ -9427,7 +9624,7 @@ var primitive, object = { 'toString': function() { return primitive; } }, values = [true, null, 1, 'a', undefined], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(value) { primitive = value; @@ -9897,11 +10094,11 @@ QUnit.test('should return a boolean value even when `customizer` does not', function(assert) { assert.expect(2); - var actual = _.isEqualWith('a', 'b', alwaysC); + var actual = _.isEqualWith('a', 'b', stubC); assert.strictEqual(actual, true); var values = _.without(falsey, undefined), - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); actual = []; lodashStable.each(values, function(value) { @@ -9981,7 +10178,7 @@ QUnit.test('should return `true` for error objects', function(assert) { assert.expect(1); - var expected = lodashStable.map(errors, alwaysTrue); + var expected = lodashStable.map(errors, stubTrue); var actual = lodashStable.map(errors, function(error) { return _.isError(error) === true; @@ -9999,7 +10196,7 @@ QUnit.test('should return `false` for non error objects', function(assert) { assert.expect(12); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isError(value) : _.isError(); @@ -10024,7 +10221,7 @@ assert.expect(1); if (realm.errors) { - var expected = lodashStable.map(realm.errors, alwaysTrue); + var expected = lodashStable.map(realm.errors, stubTrue); var actual = lodashStable.map(realm.errors, function(error) { return _.isError(error) === true; @@ -10049,7 +10246,7 @@ assert.expect(1); var values = [0, 1, 3.14, -1], - expected = lodashStable.map(values, alwaysTrue), + expected = lodashStable.map(values, stubTrue), actual = lodashStable.map(values, _.isFinite); assert.deepEqual(actual, expected); @@ -10059,7 +10256,7 @@ assert.expect(1); var values = [NaN, Infinity, -Infinity, Object(1)], - expected = lodashStable.map(values, alwaysFalse), + expected = lodashStable.map(values, stubFalse), actual = lodashStable.map(values, _.isFinite); assert.deepEqual(actual, expected); @@ -10069,7 +10266,7 @@ assert.expect(10); var values = [undefined, [], true, '', ' ', '2px'], - expected = lodashStable.map(values, alwaysFalse), + expected = lodashStable.map(values, stubFalse), actual = lodashStable.map(values, _.isFinite); assert.deepEqual(actual, expected); @@ -10089,7 +10286,7 @@ assert.expect(1); var values = ['2', '0', '08'], - expected = lodashStable.map(values, alwaysFalse), + expected = lodashStable.map(values, stubFalse), actual = lodashStable.map(values, _.isFinite); assert.deepEqual(actual, expected); @@ -10133,7 +10330,7 @@ QUnit.test('should return `false` for non-functions', function(assert) { assert.expect(12); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isFunction(value) : _.isFunction(); @@ -10200,7 +10397,7 @@ assert.expect(2); var values = [-1, 0, 1], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(value) { return func(value); @@ -10214,7 +10411,7 @@ assert.expect(1); var values = [NaN, Infinity, -Infinity, Object(1), 3.14], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(value) { return func(value); @@ -10257,7 +10454,7 @@ assert.expect(1); var values = [0, 3, MAX_SAFE_INTEGER], - expected = lodashStable.map(values, alwaysTrue), + expected = lodashStable.map(values, stubTrue), actual = lodashStable.map(values, _.isLength); assert.deepEqual(actual, expected); @@ -10267,7 +10464,7 @@ assert.expect(1); var values = [-1, '1', 1.1, MAX_SAFE_INTEGER + 1], - expected = lodashStable.map(values, alwaysFalse), + expected = lodashStable.map(values, stubFalse), actual = lodashStable.map(values, _.isLength); assert.deepEqual(actual, expected); @@ -10295,7 +10492,7 @@ QUnit.test('should return `false` for non-maps', function(assert) { assert.expect(14); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isMap(value) : _.isMap(); @@ -10322,7 +10519,7 @@ assert.expect(1); var values = [false, true], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(value) { return _.isMap({ 'constructor': value }); @@ -10382,7 +10579,7 @@ var objects = [{ 'a': 1 }, { 'a': 1, 'b': 2 }], source = new Foo, - expected = lodashStable.map(objects, alwaysTrue); + expected = lodashStable.map(objects, stubTrue); var actual = lodashStable.map(objects, function(object) { return _.isMatch(object, source); @@ -10628,7 +10825,7 @@ assert.expect(1); var values = [null, undefined], - expected = lodashStable.map(values, alwaysFalse), + expected = lodashStable.map(values, stubFalse), source = { 'a': 1 }; var actual = lodashStable.map(values, function(value) { @@ -10644,7 +10841,7 @@ assert.expect(1); var values = [null, undefined], - expected = lodashStable.map(values, alwaysTrue), + expected = lodashStable.map(values, stubTrue), source = {}; var actual = lodashStable.map(values, function(value) { @@ -10660,7 +10857,7 @@ assert.expect(1); var object = { 'a': 1 }, - expected = lodashStable.map(empties, alwaysTrue); + expected = lodashStable.map(empties, stubTrue); var actual = lodashStable.map(empties, function(value) { return _.isMatch(object, value); @@ -10752,11 +10949,11 @@ assert.expect(2); var object = { 'a': 1 }, - actual = _.isMatchWith(object, { 'a': 1 }, alwaysA); + actual = _.isMatchWith(object, { 'a': 1 }, stubA); assert.strictEqual(actual, true); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); actual = []; lodashStable.each(falsey, function(value) { @@ -10914,7 +11111,7 @@ QUnit.test('should return `false` for non-native methods', function(assert) { assert.expect(12); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isNative(value) : _.isNative(); @@ -10951,6 +11148,48 @@ skipAssert(assert); } }); + + QUnit.test('should throw an error if core-js is detected', function(assert) { + assert.expect(1); + + if (!isModularize) { + var lodash = _.runInContext({ + '__core-js_shared__': {} + }); + + assert.raises(function() { lodash.isNative(noop); }); + } + else { + skipAssert(assert); + } + }); + + QUnit.test('should detect methods masquerading as native', function(assert) { + assert.expect(2); + + if (_._baseEach) { + var path = require('path'), + basePath = path.dirname(filePath), + uid = 'e0gvgyrad1jor', + coreKey = '__core-js_shared__', + fakeSrcKey = 'Symbol(src)_1.' + uid; + + root[coreKey] = { 'keys': { 'IE_PROTO': 'Symbol(IE_PROTO)_3.' + uid } }; + emptyObject(require.cache); + + var baseIsNative = interopRequire(path.join(basePath, '_baseIsNative')); + assert.strictEqual(baseIsNative(slice), true); + + slice[fakeSrcKey] = slice + ''; + assert.strictEqual(baseIsNative(slice), false); + + delete slice[fakeSrcKey]; + delete root[coreKey]; + } + else { + skipAssert(assert, 2); + } + }); }(1, 2, 3)); /*--------------------------------------------------------------------------*/ @@ -11165,7 +11404,7 @@ assert.expect(1); var values = falsey.concat(true, 1, 'a', symbol), - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(value, index) { return index ? _.isObject(value) : _.isObject(); @@ -11239,7 +11478,7 @@ assert.expect(1); var values = falsey.concat(true, _, slice, 1, 'a', symbol), - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(value, index) { return index ? _.isObjectLike(value) : _.isObjectLike(); @@ -11351,7 +11590,7 @@ QUnit.test('should return `false` for non-objects', function(assert) { assert.expect(4); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isPlainObject(value) : _.isPlainObject(); @@ -11393,7 +11632,7 @@ QUnit.test('should return `false` for non-regexes', function(assert) { assert.expect(12); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isRegExp(value) : _.isRegExp(); @@ -11447,7 +11686,7 @@ QUnit.test('should return `false` for non-sets', function(assert) { assert.expect(14); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isSet(value) : _.isSet(); @@ -11474,7 +11713,7 @@ assert.expect(1); var values = [false, true], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(value) { return _.isSet({ 'constructor': value }); @@ -11569,7 +11808,7 @@ QUnit.test('should return `false` for non-symbols', function(assert) { assert.expect(12); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isSymbol(value) : _.isSymbol(); @@ -11627,7 +11866,7 @@ QUnit.test('should return `false` for non typed arrays', function(assert) { assert.expect(13); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isTypedArray(value) : _.isTypedArray(); @@ -11752,7 +11991,7 @@ QUnit.test('should return `false` for non weak maps', function(assert) { assert.expect(14); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isWeakMap(value) : _.isWeakMap(); @@ -11779,7 +12018,7 @@ assert.expect(1); var values = [false, true], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(value) { return _.isWeakMap({ 'constructor': value }); @@ -11821,7 +12060,7 @@ QUnit.test('should return `false` for non weak sets', function(assert) { assert.expect(14); - var expected = lodashStable.map(falsey, alwaysFalse); + var expected = lodashStable.map(falsey, stubFalse); var actual = lodashStable.map(falsey, function(value, index) { return index ? _.isWeakSet(value) : _.isWeakSet(); @@ -12088,7 +12327,7 @@ var fn = function() { return this instanceof Number; }, array = [fn, fn, fn], iteratees = lodashStable.map(array, _.iteratee), - expected = lodashStable.map(array, alwaysFalse); + expected = lodashStable.map(array, stubFalse); var actual = lodashStable.map(iteratees, function(iteratee) { return iteratee(); @@ -13114,24 +13353,26 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('lodash.lastIndexOf'); + QUnit.module('lodash.findLastIndex and lodash.lastIndexOf'); - (function() { - var array = [1, 2, 3, 1, 2, 3]; + lodashStable.each(['findLastIndex', 'lastIndexOf'], function(methodName) { + var array = [1, 2, 3, 1, 2, 3], + func = _[methodName], + resolve = methodName == 'findLastIndex' ? lodashStable.curry(lodashStable.eq) : identity; - QUnit.test('should return the index of the last matched value', function(assert) { + QUnit.test('`_.' + methodName + '` should return the index of the last matched value', function(assert) { assert.expect(1); - assert.strictEqual(_.lastIndexOf(array, 3), 5); + assert.strictEqual(func(array, resolve(3)), 5); }); - QUnit.test('should work with a positive `fromIndex`', function(assert) { + QUnit.test('`_.' + methodName + '` should work with a positive `fromIndex`', function(assert) { assert.expect(1); - assert.strictEqual(_.lastIndexOf(array, 1, 2), 0); + assert.strictEqual(func(array, resolve(1), 2), 0); }); - QUnit.test('should work with `fromIndex` >= `array.length`', function(assert) { + QUnit.test('`_.' + methodName + '` should work with a `fromIndex` >= `length`', function(assert) { assert.expect(1); var values = [6, 8, Math.pow(2, 32), Infinity], @@ -13139,35 +13380,35 @@ var actual = lodashStable.map(values, function(fromIndex) { return [ - _.lastIndexOf(array, undefined, fromIndex), - _.lastIndexOf(array, 1, fromIndex), - _.lastIndexOf(array, '', fromIndex) + func(array, resolve(undefined), fromIndex), + func(array, resolve(1), fromIndex), + func(array, resolve(''), fromIndex) ]; }); assert.deepEqual(actual, expected); }); - QUnit.test('should work with a negative `fromIndex`', function(assert) { + QUnit.test('`_.' + methodName + '` should work with a negative `fromIndex`', function(assert) { assert.expect(1); - assert.strictEqual(_.lastIndexOf(array, 2, -3), 1); + assert.strictEqual(func(array, resolve(2), -3), 1); }); - QUnit.test('should work with a negative `fromIndex` <= `-array.length`', function(assert) { + QUnit.test('`_.' + methodName + '` should work with a negative `fromIndex` <= `-length`', function(assert) { assert.expect(1); var values = [-6, -8, -Infinity], - expected = lodashStable.map(values, alwaysZero); + expected = lodashStable.map(values, stubZero); var actual = lodashStable.map(values, function(fromIndex) { - return _.lastIndexOf(array, 1, fromIndex); + return func(array, resolve(1), fromIndex); }); assert.deepEqual(actual, expected); }); - QUnit.test('should treat falsey `fromIndex` values correctly', function(assert) { + QUnit.test('`_.' + methodName + '` should treat falsey `fromIndex` values correctly', function(assert) { assert.expect(1); var expected = lodashStable.map(falsey, function(value) { @@ -13175,18 +13416,18 @@ }); var actual = lodashStable.map(falsey, function(fromIndex) { - return _.lastIndexOf(array, 3, fromIndex); + return func(array, resolve(3), fromIndex); }); assert.deepEqual(actual, expected); }); - QUnit.test('should coerce `fromIndex` to an integer', function(assert) { + QUnit.test('`_.' + methodName + '` should coerce `fromIndex` to an integer', function(assert) { assert.expect(1); - assert.strictEqual(_.lastIndexOf(array, 2, 4.2), 4); + assert.strictEqual(func(array, resolve(2), 4.2), 4); }); - }()); + }); /*--------------------------------------------------------------------------*/ @@ -13316,7 +13557,7 @@ QUnit.test('should accept a falsey `collection` argument', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysEmptyArray); + var expected = lodashStable.map(falsey, stubArray); var actual = lodashStable.map(falsey, function(collection, index) { try { @@ -13528,7 +13769,7 @@ QUnit.test('`_.' + methodName + '` should accept a falsey `object` argument', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysEmptyObject); + var expected = lodashStable.map(falsey, stubObject); var actual = lodashStable.map(falsey, function(object, index) { try { @@ -13605,7 +13846,7 @@ var objects = [{ 'a': 1 }, { 'a': 1, 'b': 2 }], source = new Foo, actual = lodashStable.map(objects, _.matches(source)), - expected = lodashStable.map(objects, alwaysTrue); + expected = lodashStable.map(objects, stubTrue); assert.deepEqual(actual, expected); }); @@ -13830,7 +14071,7 @@ assert.expect(1); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysFalse), + expected = lodashStable.map(values, stubFalse), matches = _.matches({ 'a': 1 }); var actual = lodashStable.map(values, function(value, index) { @@ -13846,7 +14087,7 @@ assert.expect(1); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysTrue), + expected = lodashStable.map(values, stubTrue), matches = _.matches({}); var actual = lodashStable.map(values, function(value, index) { @@ -13862,7 +14103,7 @@ assert.expect(1); var object = { 'a': 1 }, - expected = lodashStable.map(empties, alwaysTrue); + expected = lodashStable.map(empties, stubTrue); var actual = lodashStable.map(empties, function(value) { var matches = _.matches(value); @@ -14032,7 +14273,7 @@ assert.expect(2); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); lodashStable.each(['constructor.prototype.valueOf', ['constructor', 'prototype', 'valueOf']], function(path) { var matches = _.matchesProperty(path, 1); @@ -14070,7 +14311,7 @@ Foo.prototype.b = 2; var objects = [{ 'a': { 'a': 1 } }, { 'a': { 'a': 1, 'b': 2 } }], - expected = lodashStable.map(objects, alwaysTrue); + expected = lodashStable.map(objects, stubTrue); lodashStable.each(['a', ['a']], function(path) { assert.deepEqual(lodashStable.map(objects, _.matchesProperty(path, new Foo)), expected); @@ -14289,7 +14530,7 @@ assert.expect(2); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); lodashStable.each(['constructor', ['constructor']], function(path) { var matches = _.matchesProperty(path, 1); @@ -14389,7 +14630,7 @@ QUnit.test('should return `NaN` when passing empty `array` values', function(assert) { assert.expect(1); - var expected = lodashStable.map(empties, alwaysNaN), + var expected = lodashStable.map(empties, stubNaN), actual = lodashStable.map(empties, _.mean); assert.deepEqual(actual, expected); @@ -14483,7 +14724,7 @@ QUnit.test('should not error if `resolver` is falsey', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysTrue); + var expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(resolver, index) { try { @@ -14846,7 +15087,7 @@ function Foo() {} var values = [new Foo, new Boolean, new Date, Foo, new Number, new String, new RegExp], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(value) { var object = _.merge({}, { 'value': value }); @@ -14865,7 +15106,7 @@ var props = ['0', 'a', 'buffer'], values = [[{ 'a': 1 }], { 'a': [1] }, typedArray], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(value, index) { var key = props[index], @@ -14948,23 +15189,18 @@ QUnit.test('should skip merging when `object` and `source` are the same value', function(assert) { assert.expect(1); - if (defineProperty) { - var object = {}, - pass = true; + var object = {}, + pass = true; - defineProperty(object, 'a', { - 'enumerable': true, - 'configurable': true, - 'get': function() { pass = false; }, - 'set': function() { pass = false; } - }); + defineProperty(object, 'a', { + 'enumerable': true, + 'configurable': true, + 'get': function() { pass = false; }, + 'set': function() { pass = false; } + }); - _.merge(object, object); - assert.ok(pass); - } - else { - skipAssert(assert); - } + _.merge(object, object); + assert.ok(pass); }); QUnit.test('should convert values to arrays when merging arrays of `source`', function(assert) { @@ -14994,7 +15230,7 @@ var object1 = { 'el': document && document.createElement('div') }, object2 = { 'el': document && document.createElement('div') }, pairs = [[{}, object1], [object1, object2]], - expected = lodashStable.map(pairs, alwaysTrue); + expected = lodashStable.map(pairs, stubTrue); var actual = lodashStable.map(pairs, function(pair) { try { @@ -15089,7 +15325,7 @@ QUnit.test('should create a function that calls a method of a given object', function(assert) { assert.expect(4); - var object = { 'a': alwaysOne }; + var object = { 'a': stubOne }; lodashStable.each(['a', ['a']], function(path) { var method = _.method(path); @@ -15101,7 +15337,7 @@ QUnit.test('should work with deep property values', function(assert) { assert.expect(2); - var object = { 'a': { 'b': alwaysTwo } }; + var object = { 'a': { 'b': stubTwo } }; lodashStable.each(['a.b', ['a', 'b']], function(path) { var method = _.method(path); @@ -15127,7 +15363,7 @@ fn.toString = lodashStable.constant('fn'); var expected = [1, 1, 2, 2, 3, 3, 4, 4], - objects = [{ 'null': alwaysOne }, { 'undefined': alwaysTwo }, { 'fn': alwaysThree }, { '[object Object]': alwaysFour }], + objects = [{ 'null': stubOne }, { 'undefined': stubTwo }, { 'fn': stubThree }, { '[object Object]': stubFour }], values = [null, undefined, fn, {}]; var actual = lodashStable.transform(objects, function(result, object, index) { @@ -15145,7 +15381,7 @@ assert.expect(2); function Foo() {} - Foo.prototype.a = alwaysOne; + Foo.prototype.a = stubOne; lodashStable.each(['a', ['a']], function(path) { var method = _.method(path); @@ -15156,7 +15392,7 @@ QUnit.test('should use a key over a path', function(assert) { assert.expect(2); - var object = { 'a.b': alwaysOne, 'a': { 'b': alwaysTwo } }; + var object = { 'a.b': stubOne, 'a': { 'b': stubTwo } }; lodashStable.each(['a.b', ['a.b']], function(path) { var method = _.method(path); @@ -15244,7 +15480,7 @@ QUnit.test('should create a function that calls a method of a given key', function(assert) { assert.expect(4); - var object = { 'a': alwaysOne }; + var object = { 'a': stubOne }; lodashStable.each(['a', ['a']], function(path) { var methodOf = _.methodOf(object); @@ -15256,7 +15492,7 @@ QUnit.test('should work with deep property values', function(assert) { assert.expect(2); - var object = { 'a': { 'b': alwaysTwo } }; + var object = { 'a': { 'b': stubTwo } }; lodashStable.each(['a.b', ['a', 'b']], function(path) { var methodOf = _.methodOf(object); @@ -15282,7 +15518,7 @@ fn.toString = lodashStable.constant('fn'); var expected = [1, 1, 2, 2, 3, 3, 4, 4], - objects = [{ 'null': alwaysOne }, { 'undefined': alwaysTwo }, { 'fn': alwaysThree }, { '[object Object]': alwaysFour }], + objects = [{ 'null': stubOne }, { 'undefined': stubTwo }, { 'fn': stubThree }, { '[object Object]': stubFour }], values = [null, undefined, fn, {}]; var actual = lodashStable.transform(objects, function(result, object, index) { @@ -15300,7 +15536,7 @@ assert.expect(2); function Foo() {} - Foo.prototype.a = alwaysOne; + Foo.prototype.a = stubOne; lodashStable.each(['a', ['a']], function(path) { var methodOf = _.methodOf(new Foo); @@ -15311,7 +15547,7 @@ QUnit.test('should use a key over a path', function(assert) { assert.expect(2); - var object = { 'a.b': alwaysOne, 'a': { 'b': alwaysTwo } }; + var object = { 'a.b': stubOne, 'a': { 'b': stubTwo } }; lodashStable.each(['a.b', ['a.b']], function(path) { var methodOf = _.methodOf(object); @@ -15560,7 +15796,7 @@ if (!isNpm) { _.mixin(source); - _.a = alwaysB; + _.a = stubB; assert.strictEqual(_.a(array), 'b'); assert.strictEqual(_(array).a().value(), 'a'); @@ -15933,25 +16169,6 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('lodash.noop'); - - (function() { - QUnit.test('should return `undefined`', function(assert) { - assert.expect(1); - - var values = empties.concat(true, new Date, _, 1, /x/, 'a'), - expected = lodashStable.map(values, noop); - - var actual = lodashStable.map(values, function(value, index) { - return index ? _.noop(value) : _.noop(); - }); - - assert.deepEqual(actual, expected); - }); - }()); - - /*--------------------------------------------------------------------------*/ - QUnit.module('lodash.noConflict'); (function() { @@ -16023,6 +16240,18 @@ done(); }, 32); }); + + QUnit.test('should work with mocked `Date.now`', function(assert) { + assert.expect(1); + + var now = Date.now; + Date.now = stubA; + + var actual = _.now(); + Date.now = now; + + assert.strictEqual(actual, 'a'); + }); }()); /*--------------------------------------------------------------------------*/ @@ -16056,7 +16285,7 @@ assert.expect(2); var values = falsey, - expected = lodashStable.map(values, alwaysA); + expected = lodashStable.map(values, stubA); var actual = lodashStable.map(values, function(n) { return n ? _.nth(array, n) : _.nth(array); @@ -16065,7 +16294,7 @@ assert.deepEqual(actual, expected); values = ['1', 1.6]; - expected = lodashStable.map(values, alwaysB); + expected = lodashStable.map(values, stubB); actual = lodashStable.map(values, function(n) { return _.nth(array, n); @@ -16137,7 +16366,7 @@ assert.expect(2); var values = falsey, - expected = lodashStable.map(values, alwaysA); + expected = lodashStable.map(values, stubA); var actual = lodashStable.map(values, function(n) { var func = n ? _.nthArg(n) : _.nthArg(); @@ -16147,7 +16376,7 @@ assert.deepEqual(actual, expected); values = ['1', 1.6]; - expected = lodashStable.map(values, alwaysB); + expected = lodashStable.map(values, stubB); actual = lodashStable.map(values, function(n) { var func = _.nthArg(n); @@ -16255,10 +16484,10 @@ var expected = { 'b': 2, 'd': 4 }, func = _[methodName], object = { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, - prop = lodashStable.nthArg(1); + resolve = lodashStable.nthArg(1); if (methodName == 'omitBy') { - prop = function(object, props) { + resolve = function(object, props) { props = lodashStable.castArray(props); return function(value) { return lodashStable.some(props, function(key) { @@ -16271,8 +16500,8 @@ QUnit.test('`_.' + methodName + '` should create an object with omitted string keyed properties', function(assert) { assert.expect(2); - assert.deepEqual(func(object, prop(object, 'a')), { 'b': 2, 'c': 3, 'd': 4 }); - assert.deepEqual(func(object, prop(object, ['a', 'c'])), expected); + assert.deepEqual(func(object, resolve(object, 'a')), { 'b': 2, 'c': 3, 'd': 4 }); + assert.deepEqual(func(object, resolve(object, ['a', 'c'])), expected); }); QUnit.test('`_.' + methodName + '` should include inherited string keyed properties', function(assert) { @@ -16281,7 +16510,7 @@ function Foo() {} Foo.prototype = object; - assert.deepEqual(func(new Foo, prop(object, ['a', 'c'])), expected); + assert.deepEqual(func(new Foo, resolve(object, ['a', 'c'])), expected); }); QUnit.test('`_.' + methodName + '` should preserve the sign of `0`', function(assert) { @@ -16292,7 +16521,7 @@ expected = [{ '0': 'b' }, { '0': 'b' }, { '-0': 'a' }, { '-0': 'a' }]; var actual = lodashStable.map(props, function(key) { - return func(object, prop(object, key)); + return func(object, resolve(object, key)); }); assert.deepEqual(actual, expected); @@ -16311,7 +16540,7 @@ Foo.prototype[symbol2] = 2; var foo = new Foo, - actual = func(foo, prop(foo, 'a')); + actual = func(foo, resolve(foo, 'a')); assert.strictEqual(actual[symbol], 1); assert.strictEqual(actual[symbol2], 2); @@ -16334,13 +16563,13 @@ Foo.prototype[symbol2] = 2; var foo = new Foo, - actual = func(foo, prop(foo, symbol)); + actual = func(foo, resolve(foo, symbol)); assert.strictEqual(actual.a, 0); assert.strictEqual(actual[symbol], undefined); assert.strictEqual(actual[symbol2], 2); - actual = func(foo, prop(foo, symbol2)); + actual = func(foo, resolve(foo, symbol2)); assert.strictEqual(actual.a, 0); assert.strictEqual(actual[symbol], 1); @@ -16355,7 +16584,7 @@ assert.expect(1); var array = [1, 2, 3]; - assert.deepEqual(func(array, prop(array, ['0', '2'])), { '1': 2 }); + assert.deepEqual(func(array, resolve(array, ['0', '2'])), { '1': 2 }); }); }); @@ -16493,7 +16722,7 @@ QUnit.test('should create a function that returns `true` if all predicates return truthy', function(assert) { assert.expect(1); - var over = _.overEvery(alwaysTrue, alwaysOne, alwaysA); + var over = _.overEvery(stubTrue, stubOne, stubA); assert.strictEqual(over(), true); }); @@ -16563,7 +16792,7 @@ QUnit.test('should flatten `predicates`', function(assert) { assert.expect(1); - var over = _.overEvery(alwaysTrue, [alwaysFalse]); + var over = _.overEvery(stubTrue, [stubFalse]); assert.strictEqual(over(), false); }); @@ -16601,10 +16830,10 @@ QUnit.test('should create a function that returns `true` if any predicates return truthy', function(assert) { assert.expect(2); - var over = _.overSome(alwaysFalse, alwaysOne, alwaysEmptyString); + var over = _.overSome(stubFalse, stubOne, stubString); assert.strictEqual(over(), true); - over = _.overSome(alwaysNull, alwaysA, alwaysZero); + over = _.overSome(stubNull, stubA, stubZero); assert.strictEqual(over(), true); }); @@ -16623,10 +16852,10 @@ QUnit.test('should return `false` if all predicates return falsey', function(assert) { assert.expect(2); - var over = _.overSome(alwaysFalse, alwaysFalse, alwaysFalse); + var over = _.overSome(stubFalse, stubFalse, stubFalse); assert.strictEqual(over(), false); - over = _.overSome(alwaysNull, alwaysZero, alwaysEmptyString); + over = _.overSome(stubNull, stubZero, stubString); assert.strictEqual(over(), false); }); @@ -16684,7 +16913,7 @@ QUnit.test('should flatten `predicates`', function(assert) { assert.expect(1); - var over = _.overSome(alwaysFalse, [alwaysTrue]); + var over = _.overSome(stubFalse, [stubTrue]); assert.strictEqual(over(), true); }); @@ -16745,7 +16974,7 @@ assert.expect(1); var values = [Object(string), { 'toString': lodashStable.constant(string) }], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(value) { return _.pad(value, 6) === ' abc '; @@ -16785,7 +17014,7 @@ assert.expect(1); var values = [Object(string), { 'toString': lodashStable.constant(string) }], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(value) { return _.padEnd(value, 6) === 'abc '; @@ -16825,7 +17054,7 @@ assert.expect(1); var values = [Object(string), { 'toString': lodashStable.constant(string) }], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(value) { return _.padStart(value, 6) === ' abc'; @@ -16974,7 +17203,7 @@ QUnit.test('should coerce `radix` to a number', function(assert) { assert.expect(2); - var object = { 'valueOf': alwaysZero }; + var object = { 'valueOf': stubZero }; assert.strictEqual(_.parseInt('08', object), 8); assert.strictEqual(_.parseInt('0x20', object), 32); }); @@ -17368,8 +17597,8 @@ assert.expect(3); assert.deepEqual(_.partition([], identity), [[], []]); - assert.deepEqual(_.partition(array, alwaysTrue), [array, []]); - assert.deepEqual(_.partition(array, alwaysFalse), [[], array]); + assert.deepEqual(_.partition(array, stubTrue), [array, []]); + assert.deepEqual(_.partition(array, stubFalse), [[], array]); }); QUnit.test('should use `_.identity` when `predicate` is nullish', function(assert) { @@ -17483,10 +17712,10 @@ var expected = { 'a': 1, 'c': 3 }, func = _[methodName], object = { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, - prop = lodashStable.nthArg(1); + resolve = lodashStable.nthArg(1); if (methodName == 'pickBy') { - prop = function(object, props) { + resolve = function(object, props) { props = lodashStable.castArray(props); return function(value) { return lodashStable.some(props, function(key) { @@ -17499,8 +17728,8 @@ QUnit.test('`_.' + methodName + '` should create an object of picked string keyed properties', function(assert) { assert.expect(2); - assert.deepEqual(func(object, prop(object, 'a')), { 'a': 1 }); - assert.deepEqual(func(object, prop(object, ['a', 'c'])), expected); + assert.deepEqual(func(object, resolve(object, 'a')), { 'a': 1 }); + assert.deepEqual(func(object, resolve(object, ['a', 'c'])), expected); }); QUnit.test('`_.' + methodName + '` should pick inherited string keyed properties', function(assert) { @@ -17510,7 +17739,7 @@ Foo.prototype = object; var foo = new Foo; - assert.deepEqual(func(foo, prop(foo, ['a', 'c'])), expected); + assert.deepEqual(func(foo, resolve(foo, ['a', 'c'])), expected); }); QUnit.test('`_.' + methodName + '` should preserve the sign of `0`', function(assert) { @@ -17521,7 +17750,7 @@ expected = [{ '-0': 'a' }, { '-0': 'a' }, { '0': 'b' }, { '0': 'b' }]; var actual = lodashStable.map(props, function(key) { - return func(object, prop(object, key)); + return func(object, resolve(object, key)); }); assert.deepEqual(actual, expected); @@ -17539,7 +17768,7 @@ Foo.prototype[symbol2] = 2; var foo = new Foo, - actual = func(foo, prop(foo, [symbol, symbol2])); + actual = func(foo, resolve(foo, [symbol, symbol2])); assert.strictEqual(actual[symbol], 1); assert.strictEqual(actual[symbol2], 2); @@ -17553,7 +17782,7 @@ assert.expect(1); var array = [1, 2, 3]; - assert.deepEqual(func(array, prop(array, '1')), { '1': 2 }); + assert.deepEqual(func(array, resolve(array, '1')), { '1': 2 }); }); }); @@ -17843,6 +18072,21 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.pullAll'); + + (function() { + QUnit.test('should work with the same value for `array` and `values`', function(assert) { + assert.expect(1); + + var array = [{ 'a': 1 }, { 'b': 2 }], + actual = _.pullAll(array, array); + + assert.deepEqual(actual, []); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.pullAllBy'); (function() { @@ -17908,8 +18152,8 @@ var array = [1, 2, 3], actual = pull(array, [1, 3]); + assert.strictEqual(actual, array); assert.deepEqual(array, [2]); - assert.ok(actual === array); }); QUnit.test('`_.' + methodName + '` should preserve holes in arrays', function(assert) { @@ -18027,7 +18271,7 @@ result[value] = 1; }, []); - var expected = lodashStable.map(values, alwaysOne), + var expected = lodashStable.map(values, stubOne), actual = _.pullAt(array, values); assert.deepEqual(actual, expected); @@ -18109,7 +18353,7 @@ var min = 5, max = 10; - assert.ok(_.some(array, function() { + assert.ok(lodashStable.some(array, function() { var result = _.random(min, max); return result >= min && result <= max; })); @@ -18121,7 +18365,7 @@ var min = 0, max = 5; - assert.ok(_.some(array, function() { + assert.ok(lodashStable.some(array, function() { var result = _.random(max); return result >= min && result <= max; })); @@ -18152,8 +18396,8 @@ return result >= min && result <= max; })); - assert.ok(_.some(array, function() { - return _.random(MAX_INTEGER) > 0; + assert.ok(lodashStable.some(array, function() { + return _.random(MAX_INTEGER); })); }); @@ -18192,7 +18436,7 @@ assert.expect(1); var array = [1, 2, 3], - expected = lodashStable.map(array, alwaysTrue), + expected = lodashStable.map(array, stubTrue), randoms = lodashStable.map(array, _.random); var actual = lodashStable.map(randoms, function(result, index) { @@ -18751,11 +18995,8 @@ QUnit.test('should modify the array and return removed elements', function(assert) { assert.expect(2); - var array = [1, 2, 3, 4]; - - var actual = _.remove(array, function(n) { - return n % 2 == 0; - }); + var array = [1, 2, 3, 4], + actual = _.remove(array, isEven); assert.deepEqual(array, [1, 3]); assert.deepEqual(actual, [2, 4]); @@ -18883,7 +19124,7 @@ assert.strictEqual(_.repeat(string, '2'), 'abcabc'); assert.strictEqual(_.repeat(string, 2.6), 'abcabc'); - assert.strictEqual(_.repeat('*', { 'valueOf': alwaysThree }), '***'); + assert.strictEqual(_.repeat('*', { 'valueOf': stubThree }), '***'); }); QUnit.test('should coerce `string` to a string', function(assert) { @@ -18920,7 +19161,7 @@ QUnit.module('lodash.result'); (function() { - var object = { 'a': 1, 'b': alwaysB }; + var object = { 'a': 1, 'b': stubB }; QUnit.test('should invoke function values', function(assert) { assert.expect(1); @@ -18938,7 +19179,7 @@ QUnit.test('should invoke nested function values', function(assert) { assert.expect(2); - var value = { 'a': lodashStable.constant({ 'b': alwaysB }) }; + var value = { 'a': lodashStable.constant({ 'b': stubB }) }; lodashStable.each(['a.b', ['a', 'b']], function(path) { assert.strictEqual(_.result(value, path), 'b'); @@ -19027,10 +19268,10 @@ assert.strictEqual(func(object, ['a', 'b', 'c']), 4); }); - QUnit.test('`_.' + methodName + '` should ignore empty brackets', function(assert) { + QUnit.test('`_.' + methodName + '` should not ignore empty brackets', function(assert) { assert.expect(1); - var object = { 'a': 1 }; + var object = { 'a': { '': 1 } }; assert.strictEqual(func(object, 'a[]'), 1); }); @@ -19220,8 +19461,8 @@ var array = [1, 2, 3], actual = _.reverse(array); - assert.deepEqual(array, [3, 2, 1]); assert.strictEqual(actual, array); + assert.deepEqual(array, [3, 2, 1]); }); QUnit.test('should return the wrapped reversed `array`', function(assert) { @@ -19415,6 +19656,20 @@ assert.deepEqual(actual, expected); }); + + QUnit.test('`_.' + methodName + '` should not return `NaN` for large `precision` values', function(assert) { + assert.expect(1); + + var results = [ + _.round(10.0000001, 1000), + _.round(MAX_SAFE_INTEGER, 293) + ]; + + var expected = lodashStable.map(results, stubFalse), + actual = lodashStable.map(results, lodashStable.isNaN); + + assert.deepEqual(actual, expected); + }); }); /*--------------------------------------------------------------------------*/ @@ -19427,9 +19682,7 @@ if (!isModularize) { var lodash = _.runInContext({ - 'setTimeout': function(callback) { - callback(); - } + 'setTimeout': function(func) { func(); } }); var pass = false; @@ -19546,7 +19799,7 @@ }); }); - QUnit.test('should return all elements when `n` >= `array.length`', function(assert) { + QUnit.test('should return all elements when `n` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 4, Math.pow(2, 32), Infinity], function(n) { @@ -19565,7 +19818,7 @@ QUnit.test('should return an empty array for empty collections', function(assert) { assert.expect(1); - var expected = lodashStable.map(empties, alwaysEmptyArray); + var expected = lodashStable.map(empties, stubArray); var actual = lodashStable.transform(empties, function(result, value) { try { @@ -19704,13 +19957,13 @@ assert.strictEqual(object.a.b.c, value); }); - QUnit.test('`_.' + methodName + '` should ignore empty brackets', function(assert) { + QUnit.test('`_.' + methodName + '` should not ignore empty brackets', function(assert) { assert.expect(1); var object = {}; func(object, 'a[]', updater); - assert.deepEqual(object, { 'a': value }); + assert.deepEqual(object, { 'a': { '': value } }); }); QUnit.test('`_.' + methodName + '` should handle empty paths', function(assert) { @@ -19827,24 +20080,19 @@ assert.expect(4); lodashStable.each(['a', ['a'], { 'a': 1 }, NaN], function(value) { - if (defineProperty) { - var object = {}, - pass = true, - updater = isUpdate ? lodashStable.constant(value) : value; - - defineProperty(object, 'a', { - 'enumerable': true, - 'configurable': true, - 'get': lodashStable.constant(value), - 'set': function() { pass = false; } - }); + var object = {}, + pass = true, + updater = isUpdate ? lodashStable.constant(value) : value; - func(object, 'a', updater); - assert.ok(pass); - } - else { - skipAssert(assert); - } + defineProperty(object, 'a', { + 'enumerable': true, + 'configurable': true, + 'get': lodashStable.constant(value), + 'set': function() { pass = false; } + }); + + func(object, 'a', updater); + assert.ok(pass); }); }); }); @@ -19910,7 +20158,7 @@ QUnit.test('should accept a falsey `object` argument', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysZero); + var expected = lodashStable.map(falsey, stubZero); var actual = lodashStable.map(falsey, function(object, index) { try { @@ -19996,7 +20244,7 @@ (function() { var array = [1, 2, 3]; - QUnit.test('should use a default `start` of `0` and a default `end` of `array.length`', function(assert) { + QUnit.test('should use a default `start` of `0` and a default `end` of `length`', function(assert) { assert.expect(2); var actual = _.slice(array); @@ -20011,7 +20259,7 @@ assert.deepEqual(_.slice(array, 1, 3), [2, 3]); }); - QUnit.test('should work with a `start` >= `array.length`', function(assert) { + QUnit.test('should work with a `start` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 4, Math.pow(2, 32), Infinity], function(start) { @@ -20037,7 +20285,7 @@ assert.deepEqual(_.slice(array, -1), [3]); }); - QUnit.test('should work with a negative `start` <= negative `array.length`', function(assert) { + QUnit.test('should work with a negative `start` <= negative `length`', function(assert) { assert.expect(3); lodashStable.each([-3, -4, -Infinity], function(start) { @@ -20059,7 +20307,7 @@ assert.deepEqual(_.slice(array, 0, 1), [1]); }); - QUnit.test('should work with a `end` >= `array.length`', function(assert) { + QUnit.test('should work with a `end` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 4, Math.pow(2, 32), Infinity], function(end) { @@ -20087,7 +20335,7 @@ assert.deepEqual(_.slice(array, 0, -1), [1, 2]); }); - QUnit.test('should work with a negative `end` <= negative `array.length`', function(assert) { + QUnit.test('should work with a negative `end` <= negative `length`', function(assert) { assert.expect(3); lodashStable.each([-3, -4, -Infinity], function(end) { @@ -20172,7 +20420,7 @@ QUnit.test('should return `false` for empty collections', function(assert) { assert.expect(1); - var expected = lodashStable.map(empties, alwaysFalse); + var expected = lodashStable.map(empties, stubFalse); var actual = lodashStable.map(empties, function(value) { try { @@ -20207,7 +20455,7 @@ assert.expect(2); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(value, index) { var array = [0, 0]; @@ -20216,7 +20464,7 @@ assert.deepEqual(actual, expected); - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); actual = lodashStable.map(values, function(value, index) { var array = [0, 1]; return index ? _.some(array, value) : _.some(array); @@ -20693,8 +20941,8 @@ QUnit.test('should accept a falsey `array` argument', function(assert) { assert.expect(1); - var spread = _.spread(alwaysTrue), - expected = lodashStable.map(falsey, alwaysTrue); + var spread = _.spread(stubTrue), + expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(array, index) { try { @@ -20786,7 +21034,7 @@ assert.strictEqual(_.startsWith(string, 'b', 1), true); }); - QUnit.test('should work with `position` >= `string.length`', function(assert) { + QUnit.test('should work with `position` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 5, MAX_SAFE_INTEGER, Infinity], function(position) { @@ -20797,7 +21045,7 @@ QUnit.test('should treat falsey `position` values as `0`', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysTrue); + var expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(position) { return _.startsWith(string, 'a', position); @@ -20866,6 +21114,39 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('stub methods'); + + lodashStable.each(['noop', 'stubTrue', 'stubFalse', 'stubArray', 'stubObject', 'stubString'], function(methodName) { + var func = _[methodName]; + + var pair = ({ + 'stubArray': [[], 'an empty array'], + 'stubFalse': [false, '`false`'], + 'stubObject': [{}, 'an empty object'], + 'stubString': ['', 'an empty string'], + 'stubTrue': [true, '`true`'], + 'noop': [undefined, '`undefined`'] + })[methodName]; + + var values = Array(2).concat(empties, true, 1, 'a'), + expected = lodashStable.map(values, lodashStable.constant(pair[0])); + + QUnit.test('`_.' + methodName + '` should return ' + pair[1], function(assert) { + assert.expect(1); + + var actual = lodashStable.map(values, function(value, index) { + if (index < 2) { + return index ? func.call({}) : func(); + } + return func(value); + }); + + assert.deepEqual(actual, expected); + }); + }); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.subtract'); (function() { @@ -21022,7 +21303,7 @@ QUnit.test('`_.' + methodName + '` should return `0` when passing empty `array` values', function(assert) { assert.expect(1); - var expected = lodashStable.map(empties, alwaysZero); + var expected = lodashStable.map(empties, stubZero); var actual = lodashStable.map(empties, function(value) { return func(value); @@ -21060,7 +21341,7 @@ QUnit.test('should accept a falsey `array` argument', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysEmptyArray); + var expected = lodashStable.map(falsey, stubArray); var actual = lodashStable.map(falsey, function(array, index) { try { @@ -21184,7 +21465,7 @@ }); }); - QUnit.test('should return all elements when `n` >= `array.length`', function(assert) { + QUnit.test('should return all elements when `n` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 4, Math.pow(2, 32), Infinity], function(n) { @@ -21266,7 +21547,7 @@ }); }); - QUnit.test('should return all elements when `n` >= `array.length`', function(assert) { + QUnit.test('should return all elements when `n` >= `length`', function(assert) { assert.expect(4); lodashStable.each([3, 4, Math.pow(2, 32), Infinity], function(n) { @@ -22025,7 +22306,7 @@ assert.expect(1); var values = [, null, undefined, ''], - expected = lodashStable.map(values, alwaysEmptyString), + expected = lodashStable.map(values, stubString), data = { 'a': 1 }; var actual = lodashStable.map(values, function(value, index) { @@ -22111,7 +22392,7 @@ var compiled = _.template('x'), values = [String(compiled), compiled.source], - expected = lodashStable.map(values, alwaysTrue); + expected = lodashStable.map(values, stubTrue); var actual = lodashStable.map(values, function(value) { return lodashStable.includes(value, '__p'); @@ -22143,7 +22424,7 @@ } catch (e) { values[1] = e.source; } - var expected = lodashStable.map(values, alwaysFalse); + var expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(values, function(value) { return lodashStable.includes(value, 'sourceURL'); @@ -22272,7 +22553,7 @@ throttled(); var lastCount = callCount; - assert.ok(callCount > 0); + assert.ok(callCount); setTimeout(function() { assert.ok(callCount > lastCount); @@ -22286,17 +22567,17 @@ var done = assert.async(); var throttled = _.throttle(identity, 32), - result = [throttled('a'), throttled('b')]; + results = [throttled('a'), throttled('b')]; - assert.deepEqual(result, ['a', 'a']); + assert.deepEqual(results, ['a', 'a']); setTimeout(function() { - var result = [throttled('x'), throttled('y')]; - assert.notEqual(result[0], 'a'); - assert.notStrictEqual(result[0], undefined); + var results = [throttled('c'), throttled('d')]; + assert.notEqual(results[0], 'a'); + assert.notStrictEqual(results[0], undefined); - assert.notEqual(result[1], 'y'); - assert.notStrictEqual(result[1], undefined); + assert.notEqual(results[1], 'd'); + assert.notStrictEqual(results[1], undefined); done(); }, 64); }); @@ -22310,19 +22591,13 @@ var callCount = 0, dateCount = 0; - var getTime = function() { - return ++dateCount == 5 - ? Infinity - : +new Date; - }; - - var lodash = _.runInContext(lodashStable.assign({}, root, { - 'Date': lodashStable.assign(function() { - return { 'getTime': getTime }; - }, { - 'now': Date.now - }) - })); + var lodash = _.runInContext({ + 'Date': { + 'now': function() { + return ++dateCount == 5 ? Infinity : +new Date; + } + } + }); var throttled = lodash.throttle(function() { callCount++; }, 32); @@ -22491,11 +22766,48 @@ done(); }, 192); }); - }()); - /*--------------------------------------------------------------------------*/ + QUnit.test('should work with a system time of `0`', function(assert) { + assert.expect(3); - QUnit.module('lodash.debounce and lodash.throttle'); + var done = assert.async(); + + if (!isModularize) { + var callCount = 0, + dateCount = 0; + + var lodash = _.runInContext({ + 'Date': { + 'now': function() { + return ++dateCount < 4 ? 0 : +new Date; + } + } + }); + + var throttled = lodash.throttle(function(value) { + callCount++; + return value; + }, 32); + + var results = [throttled('a'), throttled('b'), throttled('c')]; + assert.deepEqual(results, ['a', 'a', 'a']); + assert.strictEqual(callCount, 1); + + setTimeout(function() { + assert.strictEqual(callCount, 2); + done(); + }, 64); + } + else { + skipAssert(assert, 3); + done(); + } + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('lodash.debounce and lodash.throttle'); lodashStable.each(['debounce', 'throttle'], function(methodName) { var func = _[methodName], @@ -22590,19 +22902,15 @@ var callCount = 0, dateCount = 0; - var getTime = function() { - return ++dateCount === 4 - ? +new Date(2012, 3, 23, 23, 27, 18) - : +new Date; - }; - - var lodash = _.runInContext(lodashStable.assign({}, root, { - 'Date': lodashStable.assign(function() { - return { 'getTime': getTime, 'valueOf': getTime }; - }, { - 'now': Date.now - }) - })); + var lodash = _.runInContext({ + 'Date': { + 'now': function() { + return ++dateCount == 4 + ? +new Date(2012, 3, 23, 23, 27, 18) + : +new Date; + } + } + }); var funced = lodash[methodName](function() { callCount++; @@ -22758,7 +23066,7 @@ assert.expect(1); var values = falsey.concat(-1, -Infinity), - expected = lodashStable.map(values, alwaysEmptyArray); + expected = lodashStable.map(values, stubArray); var actual = lodashStable.map(values, function(value, index) { return index ? _.times(value) : _.times(); @@ -23410,14 +23718,14 @@ assert.deepEqual(actual, ['a', '-1.23', '["b"]', 'c', "['d']", '\ne\n', 'f', 'g']); }); - QUnit.test('should ignore consecutive brackets and dots', function(assert) { + QUnit.test('should not ignore consecutive brackets and dots', function(assert) { assert.expect(4); - var expected = ['a']; + var expected = ['a', '']; assert.deepEqual(_.toPath('a.'), expected); assert.deepEqual(_.toPath('a[]'), expected); - expected = ['a', 'b']; + expected = ['a', '', 'b']; assert.deepEqual(_.toPath('a..b'), expected); assert.deepEqual(_.toPath('a[][]b'), expected); }); @@ -23470,7 +23778,7 @@ assert.expect(1); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysEmptyString); + expected = lodashStable.map(values, stubString); var actual = lodashStable.map(values, function(value, index) { return index ? _.toString(value) : _.toString(); @@ -23533,7 +23841,7 @@ var accumulators = [, null, undefined], object = new Foo, - expected = lodashStable.map(accumulators, alwaysTrue); + expected = lodashStable.map(accumulators, stubTrue); var iteratee = function(result, value, key) { result[key] = square(value); @@ -23571,7 +23879,7 @@ QUnit.test('should create regular arrays from typed arrays', function(assert) { assert.expect(1); - var expected = lodashStable.map(typedArrays, alwaysTrue); + var expected = lodashStable.map(typedArrays, stubTrue); var actual = lodashStable.map(typedArrays, function(type) { var Ctor = root[type], @@ -23642,7 +23950,7 @@ var Ctors = [Boolean, Boolean, Number, Number, Number, String, String], values = [false, true, 0, 1, NaN, '', 'a'], - expected = lodashStable.map(values, alwaysEmptyObject); + expected = lodashStable.map(values, stubObject); var results = lodashStable.map(values, function(value) { return _.transform(value); @@ -23650,7 +23958,7 @@ assert.deepEqual(results, expected); - expected = lodashStable.map(values, alwaysFalse); + expected = lodashStable.map(values, stubFalse); var actual = lodashStable.map(results, function(value, index) { return value instanceof Ctors[index]; @@ -23670,7 +23978,7 @@ QUnit.test('should create an empty object when given a falsey `object` argument', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysEmptyObject); + var expected = lodashStable.map(falsey, stubObject); var actual = lodashStable.map(falsey, function(object, index) { return index ? _.transform(object) : _.transform(); @@ -23711,7 +24019,7 @@ return lodashStable.isObject(value) && !lodashStable.isElement(value); }); - var expected = lodashStable.map(objects, alwaysTrue); + var expected = lodashStable.map(objects, stubTrue); var actual = lodashStable.map(objects, function(object) { var Ctor = object.constructor, @@ -24081,61 +24389,24 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('lodash.unionBy'); - - (function() { - QUnit.test('should accept an `iteratee` argument', function(assert) { - assert.expect(2); - - var actual = _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); - assert.deepEqual(actual, [2.1, 1.2, 4.3]); - - actual = _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); - assert.deepEqual(actual, [{ 'x': 1 }, { 'x': 2 }]); - }); - - QUnit.test('should provide the correct `iteratee` arguments', function(assert) { - assert.expect(1); - - var args; - - _.unionBy([2.1, 1.2], [4.3, 2.4], function() { - args || (args = slice.call(arguments)); - }); - - assert.deepEqual(args, [2.1]); - }); - }()); - - /*--------------------------------------------------------------------------*/ - - QUnit.module('lodash.unionWith'); - - (function() { - QUnit.test('should work with a `comparator` argument', function(assert) { - assert.expect(1); - - var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }], - others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }], - actual = _.unionWith(objects, others, lodashStable.isEqual); - - assert.deepEqual(actual, [objects[0], objects[1], others[0]]); - }); - }()); - - /*--------------------------------------------------------------------------*/ - QUnit.module('union methods'); lodashStable.each(['union', 'unionBy', 'unionWith'], function(methodName) { var args = (function() { return arguments; }(1, 2, 3)), func = _[methodName]; - QUnit.test('`_.' + methodName + '` should return the union of the given arrays', function(assert) { + QUnit.test('`_.' + methodName + '` should return the union of two arrays', function(assert) { + assert.expect(1); + + var actual = func([2], [1, 2]); + assert.deepEqual(actual, [2, 1]); + }); + + QUnit.test('`_.' + methodName + '` should return the union of multiple arrays', function(assert) { assert.expect(1); - var actual = func([1, 3, 2], [5, 2, 1, 4], [2, 1]); - assert.deepEqual(actual, [1, 3, 2, 5, 4]); + var actual = func([2], [1, 2], [2, 3]); + assert.deepEqual(actual, [2, 1, 3]); }); QUnit.test('`_.' + methodName + '` should not flatten nested arrays', function(assert) { @@ -24157,131 +24428,45 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('lodash.uniq'); + QUnit.module('lodash.unionBy'); (function() { - QUnit.test('should perform an unsorted uniq when used as an iteratee for methods like `_.map`', function(assert) { - assert.expect(1); - - var array = [[2, 1, 2], [1, 2, 1]], - actual = lodashStable.map(array, lodashStable.uniq); - - assert.deepEqual(actual, [[2, 1], [1, 2]]); - }); - }()); - - /*--------------------------------------------------------------------------*/ - - QUnit.module('uniqBy methods'); - - lodashStable.each(['uniqBy', 'sortedUniqBy'], function(methodName) { - var func = _[methodName], - isSorted = methodName == 'sortedUniqBy', - objects = [{ 'a': 2 }, { 'a': 3 }, { 'a': 1 }, { 'a': 2 }, { 'a': 3 }, { 'a': 1 }]; - - if (isSorted) { - objects = _.sortBy(objects, 'a'); - } - QUnit.test('`_.' + methodName + '` should work with an `iteratee` argument', function(assert) { - assert.expect(1); - - var expected = isSorted ? [{ 'a': 1 }, { 'a': 2 }, { 'a': 3 }] : objects.slice(0, 3); - - var actual = func(objects, function(object) { - return object.a; - }); - - assert.deepEqual(actual, expected); - }); - - QUnit.test('should work with large arrays', function(assert) { + QUnit.test('should accept an `iteratee` argument', function(assert) { assert.expect(2); - var largeArray = lodashStable.times(LARGE_ARRAY_SIZE, function() { - return [1, 2]; - }); - - var actual = func(largeArray, String); + var actual = _.unionBy([2.1], [1.2, 2.3], Math.floor); + assert.deepEqual(actual, [2.1, 1.2]); - assert.deepEqual(actual, [[1, 2]]); - assert.strictEqual(actual[0], largeArray[0]); + actual = _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); + assert.deepEqual(actual, [{ 'x': 1 }, { 'x': 2 }]); }); - QUnit.test('`_.' + methodName + '` should provide the correct `iteratee` arguments', function(assert) { + QUnit.test('should provide the correct `iteratee` arguments', function(assert) { assert.expect(1); var args; - func(objects, function() { + _.unionBy([2.1], [1.2, 2.3], function() { args || (args = slice.call(arguments)); }); - assert.deepEqual(args, [objects[0]]); - }); - - QUnit.test('`_.' + methodName + '` should work with `_.property` shorthands', function(assert) { - assert.expect(2); - - var expected = isSorted ? [{ 'a': 1 }, { 'a': 2 }, { 'a': 3 }] : objects.slice(0, 3), - actual = func(objects, 'a'); - - assert.deepEqual(actual, expected); - - var arrays = [[2], [3], [1], [2], [3], [1]]; - if (isSorted) { - arrays = lodashStable.sortBy(arrays, 0); - } - expected = isSorted ? [[1], [2], [3]] : arrays.slice(0, 3); - actual = func(arrays, 0); - - assert.deepEqual(actual, expected); - }); - - lodashStable.each({ - 'an array': [0, 'a'], - 'an object': { '0': 'a' }, - 'a number': 0, - 'a string': '0' - }, - function(iteratee, key) { - QUnit.test('`_.' + methodName + '` should work with ' + key + ' for `iteratee`', function(assert) { - assert.expect(1); - - var actual = func([['a'], ['a'], ['b']], iteratee); - assert.deepEqual(actual, [['a'], ['b']]); - }); + assert.deepEqual(args, [2.1]); }); - }); + }()); /*--------------------------------------------------------------------------*/ - QUnit.module('lodash.uniqWith'); + QUnit.module('lodash.unionWith'); (function() { 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 }], - actual = _.uniqWith(objects, lodashStable.isEqual); - - assert.deepEqual(actual, [objects[0], objects[1]]); - }); - - QUnit.test('should preserve the sign of `0`', function(assert) { - assert.expect(1); - - var largeArray = lodashStable.times(LARGE_ARRAY_SIZE, function(index) { - return isEven(index) ? -0 : 0; - }); - - var arrays = [[-0, 0], largeArray], - expected = lodashStable.map(arrays, lodashStable.constant(['-0'])); - - var actual = lodashStable.map(arrays, function(array) { - return lodashStable.map(_.uniqWith(array, lodashStable.eq), lodashStable.toString); - }); + var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }], + others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }], + actual = _.unionWith(objects, others, lodashStable.isEqual); - assert.deepEqual(actual, expected); + assert.deepEqual(actual, [objects[0], objects[1], others[0]]); }); }()); @@ -24301,15 +24486,15 @@ QUnit.test('`_.' + methodName + '` should return unique values of an unsorted array', function(assert) { assert.expect(1); - var array = [2, 3, 1, 2, 3, 1]; - assert.deepEqual(func(array), [2, 3, 1]); + var array = [2, 1, 2]; + assert.deepEqual(func(array), [2, 1]); }); } QUnit.test('`_.' + methodName + '` should return unique values of a sorted array', function(assert) { assert.expect(1); - var array = [1, 1, 2, 2, 3]; - assert.deepEqual(func(array), [1, 2, 3]); + var array = [1, 2, 2]; + assert.deepEqual(func(array), [1, 2]); }); QUnit.test('`_.' + methodName + '` should treat object instances as unique', function(assert) { @@ -24436,6 +24621,135 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.uniq'); + + (function() { + QUnit.test('should perform an unsorted uniq when used as an iteratee for methods like `_.map`', function(assert) { + assert.expect(1); + + var array = [[2, 1, 2], [1, 2, 1]], + actual = lodashStable.map(array, lodashStable.uniq); + + assert.deepEqual(actual, [[2, 1], [1, 2]]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('uniqBy methods'); + + lodashStable.each(['uniqBy', 'sortedUniqBy'], function(methodName) { + var func = _[methodName], + isSorted = methodName == 'sortedUniqBy', + objects = [{ 'a': 2 }, { 'a': 3 }, { 'a': 1 }, { 'a': 2 }, { 'a': 3 }, { 'a': 1 }]; + + if (isSorted) { + objects = _.sortBy(objects, 'a'); + } + QUnit.test('`_.' + methodName + '` should work with an `iteratee` argument', function(assert) { + assert.expect(1); + + var expected = isSorted ? [{ 'a': 1 }, { 'a': 2 }, { 'a': 3 }] : objects.slice(0, 3); + + var actual = func(objects, function(object) { + return object.a; + }); + + assert.deepEqual(actual, expected); + }); + + QUnit.test('should work with large arrays', function(assert) { + assert.expect(2); + + var largeArray = lodashStable.times(LARGE_ARRAY_SIZE, function() { + return [1, 2]; + }); + + var actual = func(largeArray, String); + assert.strictEqual(actual[0], largeArray[0]); + assert.deepEqual(actual, [[1, 2]]); + }); + + QUnit.test('`_.' + methodName + '` should provide the correct `iteratee` arguments', function(assert) { + assert.expect(1); + + var args; + + func(objects, function() { + args || (args = slice.call(arguments)); + }); + + assert.deepEqual(args, [objects[0]]); + }); + + QUnit.test('`_.' + methodName + '` should work with `_.property` shorthands', function(assert) { + assert.expect(2); + + var expected = isSorted ? [{ 'a': 1 }, { 'a': 2 }, { 'a': 3 }] : objects.slice(0, 3), + actual = func(objects, 'a'); + + assert.deepEqual(actual, expected); + + var arrays = [[2], [3], [1], [2], [3], [1]]; + if (isSorted) { + arrays = lodashStable.sortBy(arrays, 0); + } + expected = isSorted ? [[1], [2], [3]] : arrays.slice(0, 3); + actual = func(arrays, 0); + + assert.deepEqual(actual, expected); + }); + + lodashStable.each({ + 'an array': [0, 'a'], + 'an object': { '0': 'a' }, + 'a number': 0, + 'a string': '0' + }, + function(iteratee, key) { + QUnit.test('`_.' + methodName + '` should work with ' + key + ' for `iteratee`', function(assert) { + assert.expect(1); + + var actual = func([['a'], ['a'], ['b']], iteratee); + assert.deepEqual(actual, [['a'], ['b']]); + }); + }); + }); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('lodash.uniqWith'); + + (function() { + 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 }], + actual = _.uniqWith(objects, lodashStable.isEqual); + + assert.deepEqual(actual, [objects[0], objects[1]]); + }); + + QUnit.test('should preserve the sign of `0`', function(assert) { + assert.expect(1); + + var largeArray = lodashStable.times(LARGE_ARRAY_SIZE, function(index) { + return isEven(index) ? -0 : 0; + }); + + var arrays = [[-0, 0], largeArray], + expected = lodashStable.map(arrays, lodashStable.constant(['-0'])); + + var actual = lodashStable.map(arrays, function(array) { + return lodashStable.map(_.uniqWith(array, lodashStable.eq), lodashStable.toString); + }); + + assert.deepEqual(actual, expected); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.uniqueId'); (function() { @@ -24593,7 +24907,7 @@ var object = {}; - if (!isStrict && defineProperty) { + if (!isStrict) { defineProperty(object, 'a', { 'configurable': false, 'enumerable': true, @@ -24660,7 +24974,7 @@ QUnit.test('should work with a `customizer` callback', function(assert) { assert.expect(1); - var actual = _.updateWith({ '0': {} }, '[0][1][2]', alwaysThree, function(value) { + var actual = _.updateWith({ '0': {} }, '[0][1][2]', stubThree, function(value) { return lodashStable.isObject(value) ? undefined : {}; }); @@ -24670,7 +24984,7 @@ QUnit.test('should work with a `customizer` that returns `undefined`', function(assert) { assert.expect(1); - var actual = _.updateWith({}, 'a[0].b.c', alwaysFour, noop); + var actual = _.updateWith({}, 'a[0].b.c', stubFour, noop); assert.deepEqual(actual, { 'a': [{ 'b': { 'c': 4 } }] }); }); }()); @@ -24790,6 +25104,13 @@ QUnit.module('lodash.without'); (function() { + QUnit.test('should return the difference of values', function(assert) { + assert.expect(1); + + var actual = _.without([2, 1, 2, 3], 1, 2); + assert.deepEqual(actual, [3]); + }); + QUnit.test('should use strict equality to determine the values to reject', function(assert) { assert.expect(2); @@ -24832,7 +25153,7 @@ assert.expect(1); var operators = ['\xac', '\xb1', '\xd7', '\xf7'], - expected = lodashStable.map(operators, alwaysEmptyArray), + expected = lodashStable.map(operators, stubArray), actual = lodashStable.map(operators, _.words); assert.deepEqual(actual, expected); @@ -24847,7 +25168,7 @@ '\u205d', '\u205e' ]; - var expected = lodashStable.map(marks, alwaysEmptyArray), + var expected = lodashStable.map(marks, stubArray), actual = lodashStable.map(marks, _.words); assert.deepEqual(actual, expected); @@ -24945,7 +25266,7 @@ assert.expect(1); var values = [, null, undefined], - expected = lodashStable.map(values, alwaysA); + expected = lodashStable.map(values, stubA); var actual = lodashStable.map(values, function(value, index) { var wrapped = index ? _.wrap('a', value) : _.wrap('a'); @@ -24975,11 +25296,18 @@ var args = (function() { return arguments; }(1, 2, 3)), func = _[methodName]; - QUnit.test('`_.' + methodName + '` should return the symmetric difference of the given arrays', function(assert) { + QUnit.test('`_.' + methodName + '` should return the symmetric difference of two arrays', function(assert) { assert.expect(1); - var actual = func([1, 2, 5], [2, 3, 5], [3, 4, 5]); - assert.deepEqual(actual, [1, 4, 5]); + var actual = func([2, 1], [2, 3]); + assert.deepEqual(actual, [1, 3]); + }); + + QUnit.test('`_.' + methodName + '` should return the symmetric difference of multiple arrays', function(assert) { + assert.expect(1); + + var actual = func([2, 1], [2, 3], [3, 4]); + assert.deepEqual(actual, [1, 4]); }); QUnit.test('`_.' + methodName + '` should return an array of unique values', function(assert) { @@ -25054,8 +25382,8 @@ QUnit.test('should accept an `iteratee` argument', function(assert) { assert.expect(2); - var actual = _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); - assert.deepEqual(actual, [1.2, 4.3]); + var actual = _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor); + assert.deepEqual(actual, [1.2, 3.4]); actual = _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); assert.deepEqual(actual, [{ 'x': 2 }]); @@ -25066,11 +25394,11 @@ var args; - _.xorBy([2.1, 1.2], [4.3, 2.4], function() { + _.xorBy([2.1, 1.2], [2.3, 3.4], function() { args || (args = slice.call(arguments)); }); - assert.deepEqual(args, [4.3]); + assert.deepEqual(args, [2.3]); }); }()); @@ -25253,7 +25581,7 @@ QUnit.test('`_.' + methodName + '` should treat falsey values as empty arrays', function(assert) { assert.expect(1); - var expected = lodashStable.map(falsey, alwaysEmptyArray); + var expected = lodashStable.map(falsey, stubArray); var actual = lodashStable.map(falsey, function(value) { return func([value, value, value]); @@ -25488,8 +25816,8 @@ assert.strictEqual(wrapped.pop(), 1); var actual = wrapped.value(); - assert.deepEqual(actual, []); assert.strictEqual(actual, array); + assert.deepEqual(actual, []); } else { skipAssert(assert, 5); @@ -25500,7 +25828,7 @@ assert.expect(1); if (!isNpm) { - var expected = lodashStable.map(falsey, alwaysTrue); + var expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(value, index) { try { @@ -25542,7 +25870,7 @@ assert.expect(1); if (!isNpm) { - var expected = lodashStable.map(falsey, alwaysTrue); + var expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(value, index) { try { @@ -25576,8 +25904,8 @@ assert.strictEqual(wrapped.shift(), 2); var actual = wrapped.value(); - assert.deepEqual(actual, []); assert.strictEqual(actual, array); + assert.deepEqual(actual, []); } else { skipAssert(assert, 5); @@ -25588,7 +25916,7 @@ assert.expect(1); if (!isNpm) { - var expected = lodashStable.map(falsey, alwaysTrue); + var expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(value, index) { try { @@ -25630,7 +25958,7 @@ assert.expect(1); if (!isNpm) { - var expected = lodashStable.map(falsey, alwaysTrue); + var expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(value, index) { try { @@ -25664,8 +25992,8 @@ assert.deepEqual(wrapped.splice(0, 2).value(), [1, 3]); var actual = wrapped.value(); - assert.deepEqual(actual, []); assert.strictEqual(actual, array); + assert.deepEqual(actual, []); } else { skipAssert(assert, 5); @@ -25676,7 +26004,7 @@ assert.expect(1); if (!isNpm) { - var expected = lodashStable.map(falsey, alwaysTrue); + var expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(value, index) { try { @@ -25718,7 +26046,7 @@ assert.expect(1); if (!isNpm) { - var expected = lodashStable.map(falsey, alwaysTrue); + var expected = lodashStable.map(falsey, stubTrue); var actual = lodashStable.map(falsey, function(value, index) { try { @@ -26118,7 +26446,7 @@ assert.expect(1); var values = [, null, undefined, ''], - expected = lodashStable.map(values, alwaysEmptyString); + expected = lodashStable.map(values, stubString); var actual = lodashStable.map(values, function(value, index) { return index ? func(value) : func(); @@ -26222,12 +26550,12 @@ var acceptFalsey = lodashStable.difference(allMethods, rejectFalsey); QUnit.test('should accept falsey arguments', function(assert) { - assert.expect(309); + assert.expect(314); - var emptyArrays = lodashStable.map(falsey, alwaysEmptyArray); + var arrays = lodashStable.map(falsey, stubArray); lodashStable.each(acceptFalsey, function(methodName) { - var expected = emptyArrays, + var expected = arrays, func = _[methodName], pass = true; @@ -26289,7 +26617,7 @@ assert.expect(24); lodashStable.each(rejectFalsey, function(methodName) { - var expected = lodashStable.map(falsey, alwaysTrue), + var expected = lodashStable.map(falsey, stubTrue), func = _[methodName]; var actual = lodashStable.map(falsey, function(value, index) {