mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
692aabae13 |
@@ -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.
|
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 ./
|
$ 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.
|
||||||
|
|||||||
20
debounce.js
20
debounce.js
@@ -62,12 +62,13 @@ var nativeMax = Math.max,
|
|||||||
function debounce(func, wait, options) {
|
function debounce(func, wait, options) {
|
||||||
var lastArgs,
|
var lastArgs,
|
||||||
lastThis,
|
lastThis,
|
||||||
|
maxWait,
|
||||||
result,
|
result,
|
||||||
timerId,
|
timerId,
|
||||||
lastCallTime = 0,
|
lastCallTime = 0,
|
||||||
lastInvokeTime = 0,
|
lastInvokeTime = 0,
|
||||||
leading = false,
|
leading = false,
|
||||||
maxWait = false,
|
maxing = false,
|
||||||
trailing = true;
|
trailing = true;
|
||||||
|
|
||||||
if (typeof func != 'function') {
|
if (typeof func != 'function') {
|
||||||
@@ -76,7 +77,8 @@ function debounce(func, wait, options) {
|
|||||||
wait = toNumber(wait) || 0;
|
wait = toNumber(wait) || 0;
|
||||||
if (isObject(options)) {
|
if (isObject(options)) {
|
||||||
leading = !!options.leading;
|
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;
|
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +106,7 @@ function debounce(func, wait, options) {
|
|||||||
timeSinceLastInvoke = time - lastInvokeTime,
|
timeSinceLastInvoke = time - lastInvokeTime,
|
||||||
result = wait - timeSinceLastCall;
|
result = wait - timeSinceLastCall;
|
||||||
|
|
||||||
return maxWait === false ? result : nativeMin(result, maxWait - timeSinceLastInvoke);
|
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldInvoke(time) {
|
function shouldInvoke(time) {
|
||||||
@@ -115,7 +117,7 @@ function debounce(func, wait, options) {
|
|||||||
// trailing edge, the system time has gone backwards and we're treating
|
// trailing edge, the system time has gone backwards and we're treating
|
||||||
// it as the trailing edge, or we've hit the `maxWait` limit.
|
// it as the trailing edge, or we've hit the `maxWait` limit.
|
||||||
return (!lastCallTime || (timeSinceLastCall >= wait) ||
|
return (!lastCallTime || (timeSinceLastCall >= wait) ||
|
||||||
(timeSinceLastCall < 0) || (maxWait !== false && timeSinceLastInvoke >= maxWait));
|
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
||||||
}
|
}
|
||||||
|
|
||||||
function timerExpired() {
|
function timerExpired() {
|
||||||
@@ -164,10 +166,12 @@ function debounce(func, wait, options) {
|
|||||||
if (timerId === undefined) {
|
if (timerId === undefined) {
|
||||||
return leadingEdge(lastCallTime);
|
return leadingEdge(lastCallTime);
|
||||||
}
|
}
|
||||||
// Handle invocations in a tight loop.
|
if (maxing) {
|
||||||
clearTimeout(timerId);
|
// Handle invocations in a tight loop.
|
||||||
timerId = setTimeout(timerExpired, wait);
|
clearTimeout(timerId);
|
||||||
return invokeFunc(lastCallTime);
|
timerId = setTimeout(timerExpired, wait);
|
||||||
|
return invokeFunc(lastCallTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (timerId === undefined) {
|
if (timerId === undefined) {
|
||||||
timerId = setTimeout(timerExpired, wait);
|
timerId = setTimeout(timerExpired, wait);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
* lodash 4.11.0 (Custom Build) <https://lodash.com/>
|
* lodash 4.11.1 (Custom Build) <https://lodash.com/>
|
||||||
* Build: `lodash modularize exports="es" -o ./`
|
* Build: `lodash modularize exports="es" -o ./`
|
||||||
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||||
* Released under MIT license <https://lodash.com/license>
|
* Released under MIT license <https://lodash.com/license>
|
||||||
@@ -44,7 +44,7 @@ import toInteger from './toInteger';
|
|||||||
import lodash from './wrapperLodash';
|
import lodash from './wrapperLodash';
|
||||||
|
|
||||||
/** Used as the semantic version number. */
|
/** Used as the semantic version number. */
|
||||||
var VERSION = '4.11.0';
|
var VERSION = '4.11.1';
|
||||||
|
|
||||||
/** Used to compose bitmasks for wrapper metadata. */
|
/** Used to compose bitmasks for wrapper metadata. */
|
||||||
var BIND_KEY_FLAG = 2;
|
var BIND_KEY_FLAG = 2;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
* lodash 4.11.0 (Custom Build) <https://lodash.com/>
|
* lodash 4.11.1 (Custom Build) <https://lodash.com/>
|
||||||
* Build: `lodash modularize exports="es" -o ./`
|
* Build: `lodash modularize exports="es" -o ./`
|
||||||
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||||
* Released under MIT license <https://lodash.com/license>
|
* Released under MIT license <https://lodash.com/license>
|
||||||
|
|||||||
2
mixin.js
2
mixin.js
@@ -46,7 +46,7 @@ function mixin(object, source, options) {
|
|||||||
var props = keys(source),
|
var props = keys(source),
|
||||||
methodNames = baseFunctions(source, props);
|
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);
|
isFunc = isFunction(object);
|
||||||
|
|
||||||
arrayEach(methodNames, function(methodName) {
|
arrayEach(methodNames, function(methodName) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash-es",
|
"name": "lodash-es",
|
||||||
"version": "4.11.0",
|
"version": "4.11.1",
|
||||||
"description": "Lodash exported as ES modules.",
|
"description": "Lodash exported as ES modules.",
|
||||||
"homepage": "https://lodash.com/custom-builds",
|
"homepage": "https://lodash.com/custom-builds",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
Reference in New Issue
Block a user