diff --git a/README.md b/README.md index a18f4c0c4..fab253ddd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash-es v4.14.0 +# lodash-es v4.14.1 The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules. @@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli): $ lodash modularize exports=es -o ./ ``` -See the [package source](https://github.com/lodash/lodash/tree/4.14.0-es) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.14.1-es) for more details. diff --git a/_baseClone.js b/_baseClone.js index e4fd8f36b..bd734712c 100644 --- a/_baseClone.js +++ b/_baseClone.js @@ -133,9 +133,6 @@ function baseClone(value, isDeep, isFull, customizer, key, object, stack) { // Recursively populate clone (susceptible to call stack limits). assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); }); - if (!isFull) { - stack['delete'](value); - } return result; } diff --git a/_createRange.js b/_createRange.js index 1807d2c39..51b427e67 100644 --- a/_createRange.js +++ b/_createRange.js @@ -1,6 +1,6 @@ import baseRange from './_baseRange.js'; import isIterateeCall from './_isIterateeCall.js'; -import toNumber from './toNumber.js'; +import toFinite from './toFinite.js'; /** * Creates a `_.range` or `_.rangeRight` function. @@ -15,15 +15,14 @@ function createRange(fromRight) { end = step = undefined; } // Ensure the sign of `-0` is preserved. - start = toNumber(start); - start = start === start ? start : 0; + start = toFinite(start); if (end === undefined) { end = start; start = 0; } else { - end = toNumber(end) || 0; + end = toFinite(end); } - step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0); + step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); return baseRange(start, end, step, fromRight); }; } diff --git a/_equalArrays.js b/_equalArrays.js index b851a2904..2a2ecfaf7 100644 --- a/_equalArrays.js +++ b/_equalArrays.js @@ -76,6 +76,7 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { } } stack['delete'](array); + stack['delete'](other); return result; } diff --git a/_equalObjects.js b/_equalObjects.js index fbd4b3a2a..77a365de3 100644 --- a/_equalObjects.js +++ b/_equalObjects.js @@ -78,6 +78,7 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { } } stack['delete'](object); + stack['delete'](other); return result; } diff --git a/_getSymbolsIn.js b/_getSymbolsIn.js index a4c3b1aa9..0e810a4b7 100644 --- a/_getSymbolsIn.js +++ b/_getSymbolsIn.js @@ -1,6 +1,7 @@ import arrayPush from './_arrayPush.js'; import getPrototype from './_getPrototype.js'; import getSymbols from './_getSymbols.js'; +import stubArray from './stubArray.js'; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols; @@ -13,7 +14,7 @@ var nativeGetSymbols = Object.getOwnPropertySymbols; * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ -var getSymbolsIn = !nativeGetSymbols ? getSymbols : function(object) { +var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { var result = []; while (object) { arrayPush(result, getSymbols(object)); diff --git a/_isFlattenable.js b/_isFlattenable.js index 854147fe1..3bdef9652 100644 --- a/_isFlattenable.js +++ b/_isFlattenable.js @@ -14,7 +14,7 @@ var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]) + !!(spreadableSymbol && value && value[spreadableSymbol]); } export default isFlattenable; diff --git a/_nodeUtil.js b/_nodeUtil.js index b4a9b47b0..0f0e0c8b6 100644 --- a/_nodeUtil.js +++ b/_nodeUtil.js @@ -1,10 +1,10 @@ import freeGlobal from './_freeGlobal.js'; /** Detect free variable `exports`. */ -var freeExports = freeGlobal && typeof exports == 'object' && exports; +var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ -var freeModule = freeExports && typeof module == 'object' && module; +var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; diff --git a/_stringToPath.js b/_stringToPath.js index 7279d4525..0df430cff 100644 --- a/_stringToPath.js +++ b/_stringToPath.js @@ -2,7 +2,8 @@ import memoize from './memoize.js'; import toString from './toString.js'; /** Used to match property names within property paths. */ -var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g; +var reLeadingDot = /^\./, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; @@ -15,8 +16,13 @@ var reEscapeChar = /\\(\\)?/g; * @returns {Array} Returns the property path array. */ var stringToPath = memoize(function(string) { + string = toString(string); + var result = []; - toString(string).replace(rePropName, function(match, number, quote, string) { + if (reLeadingDot.test(string)) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, string) { result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); }); return result; diff --git a/conforms.js b/conforms.js index 6b24146b3..21a3c8696 100644 --- a/conforms.js +++ b/conforms.js @@ -6,6 +6,9 @@ import baseConforms from './_baseConforms.js'; * the corresponding property values of a given object, returning `true` if * all predicates return truthy, else `false`. * + * **Note:** The created function is equivalent to `_.conformsTo` with + * `source` partially applied. + * * @static * @memberOf _ * @since 4.0.0 diff --git a/conformsTo.js b/conformsTo.js index fbd377fcb..6f011ba93 100644 --- a/conformsTo.js +++ b/conformsTo.js @@ -2,9 +2,11 @@ import baseConformsTo from './_baseConformsTo.js'; import keys from './keys.js'; /** - * Checks if `object` conforms to `source` by invoking the predicate properties - * of `source` with the corresponding property values of `object`. This method - * is equivalent to a `_.conforms` function when `source` is partially applied. + * Checks if `object` conforms to `source` by invoking the predicate + * properties of `source` with the corresponding property values of `object`. + * + * **Note:** This method is equivalent to `_.conforms` when `source` is + * partially applied. * * @static * @memberOf _ diff --git a/debounce.js b/debounce.js index 29599b8bb..d2cfcc71e 100644 --- a/debounce.js +++ b/debounce.js @@ -14,14 +14,18 @@ var nativeMax = Math.max, * milliseconds have elapsed since the last time the debounced function was * invoked. The debounced function comes with a `cancel` method to cancel * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide an options object to indicate whether `func` should be invoked on - * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent calls - * to the debounced function return the result of the last `func` invocation. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. * - * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the debounced function is - * invoked more than once during the `wait` timeout. + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.debounce` and `_.throttle`. diff --git a/inRange.js b/inRange.js index 866ad4c8e..0e130ab96 100644 --- a/inRange.js +++ b/inRange.js @@ -1,4 +1,5 @@ import baseInRange from './_baseInRange.js'; +import toFinite from './toFinite.js'; import toNumber from './toNumber.js'; /** @@ -40,12 +41,12 @@ import toNumber from './toNumber.js'; * // => true */ function inRange(number, start, end) { - start = toNumber(start) || 0; + start = toFinite(start); if (end === undefined) { end = start; start = 0; } else { - end = toNumber(end) || 0; + end = toFinite(end); } number = toNumber(number); return baseInRange(number, start, end); diff --git a/isBuffer.js b/isBuffer.js index f140301fe..d7ba0788d 100644 --- a/isBuffer.js +++ b/isBuffer.js @@ -1,12 +1,11 @@ -import freeGlobal from './_freeGlobal.js'; import root from './_root.js'; import stubFalse from './stubFalse.js'; /** Detect free variable `exports`. */ -var freeExports = freeGlobal && typeof exports == 'object' && exports; +var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ -var freeModule = freeExports && typeof module == 'object' && module; +var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; diff --git a/isMatch.js b/isMatch.js index 74ab75d26..de5028417 100644 --- a/isMatch.js +++ b/isMatch.js @@ -3,10 +3,10 @@ import getMatchData from './_getMatchData.js'; /** * Performs a partial deep comparison between `object` and `source` to - * determine if `object` contains equivalent property values. This method is - * equivalent to a `_.matches` function when `source` is partially applied. + * determine if `object` contains equivalent property values. * - * **Note:** This method supports comparing the same values as `_.isEqual`. + * **Note:** This method supports comparing the same values as `_.isEqual` + * and is equivalent to `_.matches` when `source` is partially applied. * * @static * @memberOf _ diff --git a/lodash.default.js b/lodash.default.js index 641672357..80eed9a06 100644 --- a/lodash.default.js +++ b/lodash.default.js @@ -45,7 +45,7 @@ import toInteger from './toInteger.js'; import lodash from './wrapperLodash.js'; /** Used as the semantic version number. */ -var VERSION = '4.14.0'; +var VERSION = '4.14.1'; /** Used to compose bitmasks for function metadata. */ var BIND_KEY_FLAG = 2; diff --git a/matches.js b/matches.js index 72c2aed44..e4d2139c2 100644 --- a/matches.js +++ b/matches.js @@ -4,10 +4,10 @@ import baseMatches from './_baseMatches.js'; /** * Creates a function that performs a partial deep comparison between a given * object and `source`, returning `true` if the given object has equivalent - * property values, else `false`. The created function is equivalent to - * `_.isMatch` with a `source` partially applied. + * property values, else `false`. * - * **Note:** This method supports comparing the same values as `_.isEqual`. + * **Note:** The created function supports comparing the same values as + * `_.isEqual` is equivalent to `_.isMatch` with `source` partially applied. * * @static * @memberOf _ diff --git a/package.json b/package.json index e73875cd4..43c2dff46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash-es", - "version": "4.14.0", + "version": "4.14.1", "description": "Lodash exported as ES modules.", "keywords": "es6, modules, stdlib, util", "homepage": "https://lodash.com/custom-builds", diff --git a/random.js b/random.js index 5ebf0a094..b97563dbc 100644 --- a/random.js +++ b/random.js @@ -1,6 +1,6 @@ import baseRandom from './_baseRandom.js'; import isIterateeCall from './_isIterateeCall.js'; -import toNumber from './toNumber.js'; +import toFinite from './toFinite.js'; /** Built-in method references without a dependency on `root`. */ var freeParseFloat = parseFloat; @@ -59,12 +59,12 @@ function random(lower, upper, floating) { upper = 1; } else { - lower = toNumber(lower) || 0; + lower = toFinite(lower); if (upper === undefined) { upper = lower; lower = 0; } else { - upper = toNumber(upper) || 0; + upper = toFinite(upper); } } if (lower > upper) { diff --git a/throttle.js b/throttle.js index b9c089b5f..b6264e02a 100644 --- a/throttle.js +++ b/throttle.js @@ -8,8 +8,8 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * Creates a throttled function that only invokes `func` at most once per * every `wait` milliseconds. The throttled function comes with a `cancel` * method to cancel delayed `func` invocations and a `flush` method to - * immediately invoke them. Provide an options object to indicate whether - * `func` should be invoked on the leading and/or trailing edge of the `wait` + * immediately invoke them. Provide `options` to indicate whether `func` + * should be invoked on the leading and/or trailing edge of the `wait` * timeout. The `func` is invoked with the last arguments provided to the * throttled function. Subsequent calls to the throttled function return the * result of the last `func` invocation. @@ -18,6 +18,9 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * invoked on the trailing edge of the timeout only if the throttled function * is invoked more than once during the `wait` timeout. * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) * for details over the differences between `_.throttle` and `_.debounce`. *