diff --git a/README.md b/README.md
index 2e518b463..2d6f4f44d 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# lodash-amd v4.11.0
+# lodash-amd v4.11.1
The [Lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
@@ -27,4 +27,4 @@ require({
});
```
-See the [package source](https://github.com/lodash/lodash/tree/4.11.0-amd) for more details.
+See the [package source](https://github.com/lodash/lodash/tree/4.11.1-amd) for more details.
diff --git a/debounce.js b/debounce.js
index 4ffbae3ad..929e94256 100644
--- a/debounce.js
+++ b/debounce.js
@@ -63,12 +63,13 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
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') {
@@ -77,7 +78,8 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
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;
}
@@ -105,7 +107,7 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
timeSinceLastInvoke = time - lastInvokeTime,
result = wait - timeSinceLastCall;
- return maxWait === false ? result : nativeMin(result, maxWait - timeSinceLastInvoke);
+ return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
}
function shouldInvoke(time) {
@@ -116,7 +118,7 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
// 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() {
@@ -165,10 +167,12 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
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/main.js b/main.js
index 859189a26..dfbcf52a7 100644
--- a/main.js
+++ b/main.js
@@ -1,6 +1,6 @@
/**
* @license
- * lodash 4.11.0 (Custom Build)
+ * lodash 4.11.1 (Custom Build)
* Build: `lodash exports="amd" -d -o ./main.js`
* Copyright jQuery Foundation and other contributors
* Released under MIT license
@@ -13,7 +13,7 @@
var undefined;
/** Used as the semantic version number. */
- var VERSION = '4.11.0';
+ var VERSION = '4.11.1';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
@@ -9373,12 +9373,13 @@
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') {
@@ -9387,7 +9388,8 @@
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;
}
@@ -9415,7 +9417,7 @@
timeSinceLastInvoke = time - lastInvokeTime,
result = wait - timeSinceLastCall;
- return maxWait === false ? result : nativeMin(result, maxWait - timeSinceLastInvoke);
+ return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
}
function shouldInvoke(time) {
@@ -9426,7 +9428,7 @@
// 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() {
@@ -9475,10 +9477,12 @@
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);
@@ -14699,7 +14703,7 @@
object = this;
methodNames = baseFunctions(source, keys(source));
}
- 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/mixin.js b/mixin.js
index 7e54a7ff6..734b4d51f 100644
--- a/mixin.js
+++ b/mixin.js
@@ -40,7 +40,7 @@ define(['./_arrayEach', './_arrayPush', './_baseFunctions', './_copyArray', './i
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 81520e679..68ae9ff7c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash-amd",
- "version": "4.11.0",
+ "version": "4.11.1",
"description": "Lodash exported as AMD modules.",
"homepage": "https://lodash.com/custom-builds",
"license": "MIT",