diff --git a/README.md b/README.md index 2a589a5f2..a2ecd4cfb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash-es v4.11.0 +# lodash-es v4.11.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.11.0-es) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.11.1-es) for more details. diff --git a/debounce.js b/debounce.js index eaeacd277..4e14a433c 100644 --- a/debounce.js +++ b/debounce.js @@ -62,12 +62,13 @@ var nativeMax = Math.max, function debounce(func, wait, options) { var lastArgs, lastThis, + maxWait, result, timerId, lastCallTime = 0, lastInvokeTime = 0, leading = false, - maxWait = false, + maxing = false, trailing = true; if (typeof func != 'function') { @@ -76,7 +77,8 @@ function debounce(func, wait, options) { wait = toNumber(wait) || 0; if (isObject(options)) { leading = !!options.leading; - maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait); + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; trailing = 'trailing' in options ? !!options.trailing : trailing; } @@ -104,7 +106,7 @@ function debounce(func, wait, options) { timeSinceLastInvoke = time - lastInvokeTime, result = wait - timeSinceLastCall; - return maxWait === false ? result : nativeMin(result, maxWait - timeSinceLastInvoke); + return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; } function shouldInvoke(time) { @@ -115,7 +117,7 @@ function debounce(func, wait, options) { // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (!lastCallTime || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxWait !== false && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -164,10 +166,12 @@ function debounce(func, wait, options) { if (timerId === undefined) { return leadingEdge(lastCallTime); } - // Handle invocations in a tight loop. - clearTimeout(timerId); - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); + if (maxing) { + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } } if (timerId === undefined) { timerId = setTimeout(timerExpired, wait); diff --git a/lodash.default.js b/lodash.default.js index c950b63fc..327efaa5e 100644 --- a/lodash.default.js +++ b/lodash.default.js @@ -1,6 +1,6 @@ /** * @license - * lodash 4.11.0 (Custom Build) + * lodash 4.11.1 (Custom Build) * Build: `lodash modularize exports="es" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license @@ -44,7 +44,7 @@ import toInteger from './toInteger'; import lodash from './wrapperLodash'; /** Used as the semantic version number. */ -var VERSION = '4.11.0'; +var VERSION = '4.11.1'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_KEY_FLAG = 2; diff --git a/lodash.js b/lodash.js index f63008d36..651444289 100644 --- a/lodash.js +++ b/lodash.js @@ -1,6 +1,6 @@ /** * @license - * lodash 4.11.0 (Custom Build) + * lodash 4.11.1 (Custom Build) * Build: `lodash modularize exports="es" -o ./` * Copyright jQuery Foundation and other contributors * Released under MIT license diff --git a/mixin.js b/mixin.js index 82915aaf0..91fa4644b 100644 --- a/mixin.js +++ b/mixin.js @@ -46,7 +46,7 @@ function mixin(object, source, options) { var props = keys(source), methodNames = baseFunctions(source, props); - var chain = (isObject(options) && 'chain' in options) ? options.chain : true, + var chain = !(isObject(options) && 'chain' in options) || !!options.chain, isFunc = isFunction(object); arrayEach(methodNames, function(methodName) { diff --git a/package.json b/package.json index 07eacb0bf..00a985812 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash-es", - "version": "4.11.0", + "version": "4.11.1", "description": "Lodash exported as ES modules.", "homepage": "https://lodash.com/custom-builds", "license": "MIT",