mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Compare commits
2 Commits
4.10.0-amd
...
4.11.1-amd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29c408ee8a | ||
|
|
63d9a3fc42 |
@@ -1,4 +1,4 @@
|
|||||||
# lodash-amd v4.10.0
|
# lodash-amd v4.11.1
|
||||||
|
|
||||||
The [Lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
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.10.0-amd) for more details.
|
See the [package source](https://github.com/lodash/lodash/tree/4.11.1-amd) for more details.
|
||||||
|
|||||||
24
_baseNth.js
Normal file
24
_baseNth.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
define(['./_isIndex'], function(isIndex) {
|
||||||
|
|
||||||
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
|
var undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.nth` which doesn't coerce `n` to an integer.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Array} array The array to query.
|
||||||
|
* @param {number} n The index of the element to return.
|
||||||
|
* @returns {*} Returns the nth element of `array`.
|
||||||
|
*/
|
||||||
|
function baseNth(array, n) {
|
||||||
|
var length = array.length;
|
||||||
|
if (!length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
n += n < 0 ? length : 0;
|
||||||
|
return isIndex(n, length) ? array[n] : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseNth;
|
||||||
|
});
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_arrayMap', './_baseIteratee', './_baseMap', './_baseSortBy', './_compareMultiple', './identity'], function(arrayMap, baseIteratee, baseMap, baseSortBy, compareMultiple, identity) {
|
define(['./_arrayMap', './_baseIteratee', './_baseMap', './_baseSortBy', './_baseUnary', './_compareMultiple', './identity'], function(arrayMap, baseIteratee, baseMap, baseSortBy, baseUnary, compareMultiple, identity) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.orderBy` without param guards.
|
* The base implementation of `_.orderBy` without param guards.
|
||||||
@@ -11,7 +11,7 @@ define(['./_arrayMap', './_baseIteratee', './_baseMap', './_baseSortBy', './_com
|
|||||||
*/
|
*/
|
||||||
function baseOrderBy(collection, iteratees, orders) {
|
function baseOrderBy(collection, iteratees, orders) {
|
||||||
var index = -1;
|
var index = -1;
|
||||||
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseIteratee);
|
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
|
||||||
|
|
||||||
var result = baseMap(collection, function(value, key, collection) {
|
var result = baseMap(collection, function(value, key, collection) {
|
||||||
var criteria = arrayMap(iteratees, function(iteratee) {
|
var criteria = arrayMap(iteratees, function(iteratee) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_copyObjectWith'], function(copyObjectWith) {
|
define(['./_assignValue'], function(assignValue) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies properties of `source` to `object`.
|
* Copies properties of `source` to `object`.
|
||||||
@@ -7,10 +7,25 @@ define(['./_copyObjectWith'], function(copyObjectWith) {
|
|||||||
* @param {Object} source The object to copy properties from.
|
* @param {Object} source The object to copy properties from.
|
||||||
* @param {Array} props The property identifiers to copy.
|
* @param {Array} props The property identifiers to copy.
|
||||||
* @param {Object} [object={}] The object to copy properties to.
|
* @param {Object} [object={}] The object to copy properties to.
|
||||||
|
* @param {Function} [customizer] The function to customize copied values.
|
||||||
* @returns {Object} Returns `object`.
|
* @returns {Object} Returns `object`.
|
||||||
*/
|
*/
|
||||||
function copyObject(source, props, object) {
|
function copyObject(source, props, object, customizer) {
|
||||||
return copyObjectWith(source, props, object);
|
object || (object = {});
|
||||||
|
|
||||||
|
var index = -1,
|
||||||
|
length = props.length;
|
||||||
|
|
||||||
|
while (++index < length) {
|
||||||
|
var key = props[index];
|
||||||
|
|
||||||
|
var newValue = customizer
|
||||||
|
? customizer(object[key], source[key], key, object, source)
|
||||||
|
: source[key];
|
||||||
|
|
||||||
|
assignValue(object, key, newValue);
|
||||||
|
}
|
||||||
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
return copyObject;
|
return copyObject;
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
define(['./_assignValue'], function(assignValue) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is like `copyObject` except that it accepts a function to
|
|
||||||
* customize copied values.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} source The object to copy properties from.
|
|
||||||
* @param {Array} props The property identifiers to copy.
|
|
||||||
* @param {Object} [object={}] The object to copy properties to.
|
|
||||||
* @param {Function} [customizer] The function to customize copied values.
|
|
||||||
* @returns {Object} Returns `object`.
|
|
||||||
*/
|
|
||||||
function copyObjectWith(source, props, object, customizer) {
|
|
||||||
object || (object = {});
|
|
||||||
|
|
||||||
var index = -1,
|
|
||||||
length = props.length;
|
|
||||||
|
|
||||||
while (++index < length) {
|
|
||||||
var key = props[index];
|
|
||||||
|
|
||||||
var newValue = customizer
|
|
||||||
? customizer(object[key], source[key], key, object, source)
|
|
||||||
: source[key];
|
|
||||||
|
|
||||||
assignValue(object, key, newValue);
|
|
||||||
}
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
return copyObjectWith;
|
|
||||||
});
|
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
define(['./_arrayReduce', './deburr', './words'], function(arrayReduce, deburr, words) {
|
define(['./_arrayReduce', './deburr', './words'], function(arrayReduce, deburr, words) {
|
||||||
|
|
||||||
|
/** Used to compose unicode capture groups. */
|
||||||
|
var rsApos = "['\u2019]";
|
||||||
|
|
||||||
|
/** Used to match apostrophes. */
|
||||||
|
var reApos = RegExp(rsApos, 'g');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function like `_.camelCase`.
|
* Creates a function like `_.camelCase`.
|
||||||
*
|
*
|
||||||
@@ -9,7 +15,7 @@ define(['./_arrayReduce', './deburr', './words'], function(arrayReduce, deburr,
|
|||||||
*/
|
*/
|
||||||
function createCompounder(callback) {
|
function createCompounder(callback) {
|
||||||
return function(string) {
|
return function(string) {
|
||||||
return arrayReduce(words(deburr(string)), callback, '');
|
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './_isFlattenableIteratee', './rest'], function(apply, arrayMap, baseFlatten, baseIteratee, isFlattenableIteratee, rest) {
|
define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './_baseUnary', './isArray', './_isFlattenableIteratee', './rest'], function(apply, arrayMap, baseFlatten, baseIteratee, baseUnary, isArray, isFlattenableIteratee, rest) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function like `_.over`.
|
* Creates a function like `_.over`.
|
||||||
@@ -9,7 +9,10 @@ define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './_isFl
|
|||||||
*/
|
*/
|
||||||
function createOver(arrayFunc) {
|
function createOver(arrayFunc) {
|
||||||
return rest(function(iteratees) {
|
return rest(function(iteratees) {
|
||||||
iteratees = arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseIteratee);
|
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
|
||||||
|
? arrayMap(iteratees[0], baseUnary(baseIteratee))
|
||||||
|
: arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseUnary(baseIteratee));
|
||||||
|
|
||||||
return rest(function(args) {
|
return rest(function(args) {
|
||||||
var thisArg = this;
|
var thisArg = this;
|
||||||
return arrayFunc(iteratees, function(iteratee) {
|
return arrayFunc(iteratees, function(iteratee) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_copyArray', './_isLaziable', './_setData'], function(copyArray, isLaziable, setData) {
|
define(['./_isLaziable', './_setData'], function(isLaziable, setData) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
@@ -31,7 +31,6 @@ define(['./_copyArray', './_isLaziable', './_setData'], function(copyArray, isLa
|
|||||||
*/
|
*/
|
||||||
function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
|
function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
|
||||||
var isCurry = bitmask & CURRY_FLAG,
|
var isCurry = bitmask & CURRY_FLAG,
|
||||||
newArgPos = argPos ? copyArray(argPos) : undefined,
|
|
||||||
newHolders = isCurry ? holders : undefined,
|
newHolders = isCurry ? holders : undefined,
|
||||||
newHoldersRight = isCurry ? undefined : holders,
|
newHoldersRight = isCurry ? undefined : holders,
|
||||||
newPartials = isCurry ? partials : undefined,
|
newPartials = isCurry ? partials : undefined,
|
||||||
@@ -45,7 +44,7 @@ define(['./_copyArray', './_isLaziable', './_setData'], function(copyArray, isLa
|
|||||||
}
|
}
|
||||||
var newData = [
|
var newData = [
|
||||||
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
||||||
newHoldersRight, newArgPos, ary, arity
|
newHoldersRight, argPos, ary, arity
|
||||||
];
|
];
|
||||||
|
|
||||||
var result = wrapFunc.apply(undefined, newData);
|
var result = wrapFunc.apply(undefined, newData);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_composeArgs', './_composeArgsRight', './_copyArray', './_replaceHolders'], function(composeArgs, composeArgsRight, copyArray, replaceHolders) {
|
define(['./_composeArgs', './_composeArgsRight', './_replaceHolders'], function(composeArgs, composeArgsRight, replaceHolders) {
|
||||||
|
|
||||||
/** Used as the internal argument placeholder. */
|
/** Used as the internal argument placeholder. */
|
||||||
var PLACEHOLDER = '__lodash_placeholder__';
|
var PLACEHOLDER = '__lodash_placeholder__';
|
||||||
@@ -55,20 +55,20 @@ define(['./_composeArgs', './_composeArgsRight', './_copyArray', './_replaceHold
|
|||||||
var value = source[3];
|
var value = source[3];
|
||||||
if (value) {
|
if (value) {
|
||||||
var partials = data[3];
|
var partials = data[3];
|
||||||
data[3] = partials ? composeArgs(partials, value, source[4]) : copyArray(value);
|
data[3] = partials ? composeArgs(partials, value, source[4]) : value;
|
||||||
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : copyArray(source[4]);
|
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
|
||||||
}
|
}
|
||||||
// Compose partial right arguments.
|
// Compose partial right arguments.
|
||||||
value = source[5];
|
value = source[5];
|
||||||
if (value) {
|
if (value) {
|
||||||
partials = data[5];
|
partials = data[5];
|
||||||
data[5] = partials ? composeArgsRight(partials, value, source[6]) : copyArray(value);
|
data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
|
||||||
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : copyArray(source[6]);
|
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
|
||||||
}
|
}
|
||||||
// Use source `argPos` if available.
|
// Use source `argPos` if available.
|
||||||
value = source[7];
|
value = source[7];
|
||||||
if (value) {
|
if (value) {
|
||||||
data[7] = copyArray(value);
|
data[7] = value;
|
||||||
}
|
}
|
||||||
// Use source `ary` if it's smaller.
|
// Use source `ary` if it's smaller.
|
||||||
if (srcBitmask & ARY_FLAG) {
|
if (srcBitmask & ARY_FLAG) {
|
||||||
|
|||||||
3
array.js
3
array.js
@@ -1,4 +1,4 @@
|
|||||||
define(['./chunk', './compact', './concat', './difference', './differenceBy', './differenceWith', './drop', './dropRight', './dropRightWhile', './dropWhile', './fill', './findIndex', './findLastIndex', './flatten', './flattenDeep', './flattenDepth', './fromPairs', './head', './indexOf', './initial', './intersection', './intersectionBy', './intersectionWith', './join', './last', './lastIndexOf', './pull', './pullAll', './pullAllBy', './pullAllWith', './pullAt', './remove', './reverse', './slice', './sortedIndex', './sortedIndexBy', './sortedIndexOf', './sortedLastIndex', './sortedLastIndexBy', './sortedLastIndexOf', './sortedUniq', './sortedUniqBy', './tail', './take', './takeRight', './takeRightWhile', './takeWhile', './union', './unionBy', './unionWith', './uniq', './uniqBy', './uniqWith', './unzip', './unzipWith', './without', './xor', './xorBy', './xorWith', './zip', './zipObject', './zipObjectDeep', './zipWith'], function(chunk, compact, concat, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, findIndex, findLastIndex, flatten, flattenDeep, flattenDepth, fromPairs, head, indexOf, initial, intersection, intersectionBy, intersectionWith, join, last, lastIndexOf, pull, pullAll, pullAllBy, pullAllWith, pullAt, remove, reverse, slice, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy, tail, take, takeRight, takeRightWhile, takeWhile, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, without, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith) {
|
define(['./chunk', './compact', './concat', './difference', './differenceBy', './differenceWith', './drop', './dropRight', './dropRightWhile', './dropWhile', './fill', './findIndex', './findLastIndex', './flatten', './flattenDeep', './flattenDepth', './fromPairs', './head', './indexOf', './initial', './intersection', './intersectionBy', './intersectionWith', './join', './last', './lastIndexOf', './nth', './pull', './pullAll', './pullAllBy', './pullAllWith', './pullAt', './remove', './reverse', './slice', './sortedIndex', './sortedIndexBy', './sortedIndexOf', './sortedLastIndex', './sortedLastIndexBy', './sortedLastIndexOf', './sortedUniq', './sortedUniqBy', './tail', './take', './takeRight', './takeRightWhile', './takeWhile', './union', './unionBy', './unionWith', './uniq', './uniqBy', './uniqWith', './unzip', './unzipWith', './without', './xor', './xorBy', './xorWith', './zip', './zipObject', './zipObjectDeep', './zipWith'], function(chunk, compact, concat, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, findIndex, findLastIndex, flatten, flattenDeep, flattenDepth, fromPairs, head, indexOf, initial, intersection, intersectionBy, intersectionWith, join, last, lastIndexOf, nth, pull, pullAll, pullAllBy, pullAllWith, pullAt, remove, reverse, slice, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy, tail, take, takeRight, takeRightWhile, takeWhile, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, without, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith) {
|
||||||
return {
|
return {
|
||||||
'chunk': chunk,
|
'chunk': chunk,
|
||||||
'compact': compact,
|
'compact': compact,
|
||||||
@@ -26,6 +26,7 @@ define(['./chunk', './compact', './concat', './difference', './differenceBy', '.
|
|||||||
'join': join,
|
'join': join,
|
||||||
'last': last,
|
'last': last,
|
||||||
'lastIndexOf': lastIndexOf,
|
'lastIndexOf': lastIndexOf,
|
||||||
|
'nth': nth,
|
||||||
'pull': pull,
|
'pull': pull,
|
||||||
'pullAll': pullAll,
|
'pullAll': pullAll,
|
||||||
'pullAllBy': pullAllBy,
|
'pullAllBy': pullAllBy,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_copyObjectWith', './_createAssigner', './keysIn'], function(copyObjectWith, createAssigner, keysIn) {
|
define(['./_copyObject', './_createAssigner', './keysIn'], function(copyObject, createAssigner, keysIn) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.assignIn` except that it accepts `customizer`
|
* This method is like `_.assignIn` except that it accepts `customizer`
|
||||||
@@ -29,7 +29,7 @@ define(['./_copyObjectWith', './_createAssigner', './keysIn'], function(copyObje
|
|||||||
* // => { 'a': 1, 'b': 2 }
|
* // => { 'a': 1, 'b': 2 }
|
||||||
*/
|
*/
|
||||||
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
|
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
|
||||||
copyObjectWith(source, keysIn(source), object, customizer);
|
copyObject(source, keysIn(source), object, customizer);
|
||||||
});
|
});
|
||||||
|
|
||||||
return assignInWith;
|
return assignInWith;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_copyObjectWith', './_createAssigner', './keys'], function(copyObjectWith, createAssigner, keys) {
|
define(['./_copyObject', './_createAssigner', './keys'], function(copyObject, createAssigner, keys) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.assign` except that it accepts `customizer`
|
* This method is like `_.assign` except that it accepts `customizer`
|
||||||
@@ -28,7 +28,7 @@ define(['./_copyObjectWith', './_createAssigner', './keys'], function(copyObject
|
|||||||
* // => { 'a': 1, 'b': 2 }
|
* // => { 'a': 1, 'b': 2 }
|
||||||
*/
|
*/
|
||||||
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
|
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
|
||||||
copyObjectWith(source, keys(source), object, customizer);
|
copyObject(source, keys(source), object, customizer);
|
||||||
});
|
});
|
||||||
|
|
||||||
return assignWith;
|
return assignWith;
|
||||||
|
|||||||
20
debounce.js
20
debounce.js
@@ -63,12 +63,13 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
|||||||
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') {
|
||||||
@@ -77,7 +78,8 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +107,7 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
|||||||
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) {
|
||||||
@@ -116,7 +118,7 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
|||||||
// 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() {
|
||||||
@@ -165,10 +167,12 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
|||||||
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);
|
||||||
|
|||||||
2
head.js
2
head.js
@@ -22,7 +22,7 @@ define([], function() {
|
|||||||
* // => undefined
|
* // => undefined
|
||||||
*/
|
*/
|
||||||
function head(array) {
|
function head(array) {
|
||||||
return array ? array[0] : undefined;
|
return (array && array.length) ? array[0] : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return head;
|
return head;
|
||||||
|
|||||||
169
main.js
169
main.js
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
* lodash 4.10.0 (Custom Build) <https://lodash.com/>
|
* lodash 4.11.1 (Custom Build) <https://lodash.com/>
|
||||||
* Build: `lodash exports="amd" -d -o ./main.js`
|
* Build: `lodash exports="amd" -d -o ./main.js`
|
||||||
* 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>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
var undefined;
|
var undefined;
|
||||||
|
|
||||||
/** Used as the semantic version number. */
|
/** Used as the semantic version number. */
|
||||||
var VERSION = '4.10.0';
|
var VERSION = '4.11.1';
|
||||||
|
|
||||||
/** Used as the size to enable large array optimizations. */
|
/** Used as the size to enable large array optimizations. */
|
||||||
var LARGE_ARRAY_SIZE = 200;
|
var LARGE_ARRAY_SIZE = 200;
|
||||||
@@ -188,7 +188,8 @@
|
|||||||
rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;
|
rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;
|
||||||
|
|
||||||
/** Used to compose unicode capture groups. */
|
/** Used to compose unicode capture groups. */
|
||||||
var rsAstral = '[' + rsAstralRange + ']',
|
var rsApos = "['\u2019]",
|
||||||
|
rsAstral = '[' + rsAstralRange + ']',
|
||||||
rsBreak = '[' + rsBreakRange + ']',
|
rsBreak = '[' + rsBreakRange + ']',
|
||||||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||||
rsDigits = '\\d+',
|
rsDigits = '\\d+',
|
||||||
@@ -206,6 +207,8 @@
|
|||||||
/** Used to compose unicode regexes. */
|
/** Used to compose unicode regexes. */
|
||||||
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
|
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
|
||||||
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
|
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
|
||||||
|
rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
||||||
|
rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
||||||
reOptMod = rsModifier + '?',
|
reOptMod = rsModifier + '?',
|
||||||
rsOptVar = '[' + rsVarRange + ']?',
|
rsOptVar = '[' + rsVarRange + ']?',
|
||||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||||
@@ -213,6 +216,9 @@
|
|||||||
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
|
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
|
||||||
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
||||||
|
|
||||||
|
/** Used to match apostrophes. */
|
||||||
|
var reApos = RegExp(rsApos, 'g');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
||||||
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
||||||
@@ -224,10 +230,10 @@
|
|||||||
|
|
||||||
/** Used to match complex or compound words. */
|
/** Used to match complex or compound words. */
|
||||||
var reComplexWord = RegExp([
|
var reComplexWord = RegExp([
|
||||||
rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
||||||
rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
||||||
rsUpper + '?' + rsLowerMisc + '+',
|
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
|
||||||
rsUpper + '+',
|
rsUpper + '+' + rsOptUpperContr,
|
||||||
rsDigits,
|
rsDigits,
|
||||||
rsEmoji
|
rsEmoji
|
||||||
].join('|'), 'g');
|
].join('|'), 'g');
|
||||||
@@ -1382,7 +1388,8 @@
|
|||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var arrayProto = context.Array.prototype,
|
var arrayProto = context.Array.prototype,
|
||||||
objectProto = context.Object.prototype;
|
objectProto = context.Object.prototype,
|
||||||
|
stringProto = context.String.prototype;
|
||||||
|
|
||||||
/** Used to resolve the decompiled source of functions. */
|
/** Used to resolve the decompiled source of functions. */
|
||||||
var funcToString = context.Function.prototype.toString;
|
var funcToString = context.Function.prototype.toString;
|
||||||
@@ -1437,7 +1444,9 @@
|
|||||||
nativeMin = Math.min,
|
nativeMin = Math.min,
|
||||||
nativeParseInt = context.parseInt,
|
nativeParseInt = context.parseInt,
|
||||||
nativeRandom = Math.random,
|
nativeRandom = Math.random,
|
||||||
nativeReverse = arrayProto.reverse;
|
nativeReplace = stringProto.replace,
|
||||||
|
nativeReverse = arrayProto.reverse,
|
||||||
|
nativeSplit = stringProto.split;
|
||||||
|
|
||||||
/* Built-in method references that are verified to be native. */
|
/* Built-in method references that are verified to be native. */
|
||||||
var DataView = getNative(context, 'DataView'),
|
var DataView = getNative(context, 'DataView'),
|
||||||
@@ -1550,7 +1559,7 @@
|
|||||||
* `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,
|
* `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,
|
||||||
* `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,
|
* `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,
|
||||||
* `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`,
|
* `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`,
|
||||||
* `noConflict`, `noop`, `now`, `pad`, `padEnd`, `padStart`, `parseInt`,
|
* `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`,
|
||||||
* `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
|
* `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
|
||||||
* `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
* `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
||||||
* `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
|
* `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
|
||||||
@@ -3291,6 +3300,23 @@
|
|||||||
assignMergeValue(object, key, newValue);
|
assignMergeValue(object, key, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.nth` which doesn't coerce `n` to an integer.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Array} array The array to query.
|
||||||
|
* @param {number} n The index of the element to return.
|
||||||
|
* @returns {*} Returns the nth element of `array`.
|
||||||
|
*/
|
||||||
|
function baseNth(array, n) {
|
||||||
|
var length = array.length;
|
||||||
|
if (!length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
n += n < 0 ? length : 0;
|
||||||
|
return isIndex(n, length) ? array[n] : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.orderBy` without param guards.
|
* The base implementation of `_.orderBy` without param guards.
|
||||||
*
|
*
|
||||||
@@ -3302,7 +3328,7 @@
|
|||||||
*/
|
*/
|
||||||
function baseOrderBy(collection, iteratees, orders) {
|
function baseOrderBy(collection, iteratees, orders) {
|
||||||
var index = -1;
|
var index = -1;
|
||||||
iteratees = arrayMap(iteratees.length ? iteratees : [identity], getIteratee());
|
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
|
||||||
|
|
||||||
var result = baseMap(collection, function(value, key, collection) {
|
var result = baseMap(collection, function(value, key, collection) {
|
||||||
var criteria = arrayMap(iteratees, function(iteratee) {
|
var criteria = arrayMap(iteratees, function(iteratee) {
|
||||||
@@ -4175,24 +4201,10 @@
|
|||||||
* @param {Object} source The object to copy properties from.
|
* @param {Object} source The object to copy properties from.
|
||||||
* @param {Array} props The property identifiers to copy.
|
* @param {Array} props The property identifiers to copy.
|
||||||
* @param {Object} [object={}] The object to copy properties to.
|
* @param {Object} [object={}] The object to copy properties to.
|
||||||
* @returns {Object} Returns `object`.
|
|
||||||
*/
|
|
||||||
function copyObject(source, props, object) {
|
|
||||||
return copyObjectWith(source, props, object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is like `copyObject` except that it accepts a function to
|
|
||||||
* customize copied values.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} source The object to copy properties from.
|
|
||||||
* @param {Array} props The property identifiers to copy.
|
|
||||||
* @param {Object} [object={}] The object to copy properties to.
|
|
||||||
* @param {Function} [customizer] The function to customize copied values.
|
* @param {Function} [customizer] The function to customize copied values.
|
||||||
* @returns {Object} Returns `object`.
|
* @returns {Object} Returns `object`.
|
||||||
*/
|
*/
|
||||||
function copyObjectWith(source, props, object, customizer) {
|
function copyObject(source, props, object, customizer) {
|
||||||
object || (object = {});
|
object || (object = {});
|
||||||
|
|
||||||
var index = -1,
|
var index = -1,
|
||||||
@@ -4383,7 +4395,7 @@
|
|||||||
*/
|
*/
|
||||||
function createCompounder(callback) {
|
function createCompounder(callback) {
|
||||||
return function(string) {
|
return function(string) {
|
||||||
return arrayReduce(words(deburr(string)), callback, '');
|
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4619,7 +4631,10 @@
|
|||||||
*/
|
*/
|
||||||
function createOver(arrayFunc) {
|
function createOver(arrayFunc) {
|
||||||
return rest(function(iteratees) {
|
return rest(function(iteratees) {
|
||||||
iteratees = arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), getIteratee());
|
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
|
||||||
|
? arrayMap(iteratees[0], baseUnary(getIteratee()))
|
||||||
|
: arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseUnary(getIteratee()));
|
||||||
|
|
||||||
return rest(function(args) {
|
return rest(function(args) {
|
||||||
var thisArg = this;
|
var thisArg = this;
|
||||||
return arrayFunc(iteratees, function(iteratee) {
|
return arrayFunc(iteratees, function(iteratee) {
|
||||||
@@ -4733,7 +4748,6 @@
|
|||||||
*/
|
*/
|
||||||
function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
|
function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
|
||||||
var isCurry = bitmask & CURRY_FLAG,
|
var isCurry = bitmask & CURRY_FLAG,
|
||||||
newArgPos = argPos ? copyArray(argPos) : undefined,
|
|
||||||
newHolders = isCurry ? holders : undefined,
|
newHolders = isCurry ? holders : undefined,
|
||||||
newHoldersRight = isCurry ? undefined : holders,
|
newHoldersRight = isCurry ? undefined : holders,
|
||||||
newPartials = isCurry ? partials : undefined,
|
newPartials = isCurry ? partials : undefined,
|
||||||
@@ -4747,7 +4761,7 @@
|
|||||||
}
|
}
|
||||||
var newData = [
|
var newData = [
|
||||||
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
||||||
newHoldersRight, newArgPos, ary, arity
|
newHoldersRight, argPos, ary, arity
|
||||||
];
|
];
|
||||||
|
|
||||||
var result = wrapFunc.apply(undefined, newData);
|
var result = wrapFunc.apply(undefined, newData);
|
||||||
@@ -5660,20 +5674,20 @@
|
|||||||
var value = source[3];
|
var value = source[3];
|
||||||
if (value) {
|
if (value) {
|
||||||
var partials = data[3];
|
var partials = data[3];
|
||||||
data[3] = partials ? composeArgs(partials, value, source[4]) : copyArray(value);
|
data[3] = partials ? composeArgs(partials, value, source[4]) : value;
|
||||||
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : copyArray(source[4]);
|
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
|
||||||
}
|
}
|
||||||
// Compose partial right arguments.
|
// Compose partial right arguments.
|
||||||
value = source[5];
|
value = source[5];
|
||||||
if (value) {
|
if (value) {
|
||||||
partials = data[5];
|
partials = data[5];
|
||||||
data[5] = partials ? composeArgsRight(partials, value, source[6]) : copyArray(value);
|
data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
|
||||||
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : copyArray(source[6]);
|
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
|
||||||
}
|
}
|
||||||
// Use source `argPos` if available.
|
// Use source `argPos` if available.
|
||||||
value = source[7];
|
value = source[7];
|
||||||
if (value) {
|
if (value) {
|
||||||
data[7] = copyArray(value);
|
data[7] = value;
|
||||||
}
|
}
|
||||||
// Use source `ary` if it's smaller.
|
// Use source `ary` if it's smaller.
|
||||||
if (srcBitmask & ARY_FLAG) {
|
if (srcBitmask & ARY_FLAG) {
|
||||||
@@ -6428,7 +6442,7 @@
|
|||||||
* // => undefined
|
* // => undefined
|
||||||
*/
|
*/
|
||||||
function head(array) {
|
function head(array) {
|
||||||
return array ? array[0] : undefined;
|
return (array && array.length) ? array[0] : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6664,6 +6678,31 @@
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the nth element of `array`. If `n` is negative, the nth element
|
||||||
|
* from the end is returned.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @since 4.11.0
|
||||||
|
* @category Array
|
||||||
|
* @param {Array} array The array to query.
|
||||||
|
* @param {number} [n=0] The index of the element to return.
|
||||||
|
* @returns {*} Returns the nth element of `array`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var array = ['a', 'b', 'c', 'd'];
|
||||||
|
*
|
||||||
|
* _.nth(array, 1);
|
||||||
|
* // => 'b'
|
||||||
|
*
|
||||||
|
* _.nth(array, -2);
|
||||||
|
* // => 'c';
|
||||||
|
*/
|
||||||
|
function nth(array, n) {
|
||||||
|
return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all given values from `array` using
|
* Removes all given values from `array` using
|
||||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||||
@@ -8967,7 +9006,11 @@
|
|||||||
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
||||||
iteratees = [iteratees[0]];
|
iteratees = [iteratees[0]];
|
||||||
}
|
}
|
||||||
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
|
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
|
||||||
|
? iteratees[0]
|
||||||
|
: baseFlatten(iteratees, 1, isFlattenableIteratee);
|
||||||
|
|
||||||
|
return baseOrderBy(collection, iteratees, []);
|
||||||
});
|
});
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
@@ -9330,12 +9373,13 @@
|
|||||||
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') {
|
||||||
@@ -9344,7 +9388,8 @@
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9372,7 +9417,7 @@
|
|||||||
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) {
|
||||||
@@ -9383,7 +9428,7 @@
|
|||||||
// 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() {
|
||||||
@@ -9432,10 +9477,12 @@
|
|||||||
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);
|
||||||
@@ -9665,7 +9712,10 @@
|
|||||||
* // => [100, 10]
|
* // => [100, 10]
|
||||||
*/
|
*/
|
||||||
var overArgs = rest(function(func, transforms) {
|
var overArgs = rest(function(func, transforms) {
|
||||||
transforms = arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), getIteratee());
|
transforms = (transforms.length == 1 && isArray(transforms[0]))
|
||||||
|
? arrayMap(transforms[0], baseUnary(getIteratee()))
|
||||||
|
: arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseUnary(getIteratee()));
|
||||||
|
|
||||||
var funcsLength = transforms.length;
|
var funcsLength = transforms.length;
|
||||||
return rest(function(args) {
|
return rest(function(args) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
@@ -11671,7 +11721,7 @@
|
|||||||
* // => { 'a': 1, 'b': 2 }
|
* // => { 'a': 1, 'b': 2 }
|
||||||
*/
|
*/
|
||||||
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
|
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
|
||||||
copyObjectWith(source, keysIn(source), object, customizer);
|
copyObject(source, keysIn(source), object, customizer);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11702,7 +11752,7 @@
|
|||||||
* // => { 'a': 1, 'b': 2 }
|
* // => { 'a': 1, 'b': 2 }
|
||||||
*/
|
*/
|
||||||
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
|
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
|
||||||
copyObjectWith(source, keys(source), object, customizer);
|
copyObject(source, keys(source), object, customizer);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13529,7 +13579,7 @@
|
|||||||
var args = arguments,
|
var args = arguments,
|
||||||
string = toString(args[0]);
|
string = toString(args[0]);
|
||||||
|
|
||||||
return args.length < 3 ? string : string.replace(args[1], args[2]);
|
return args.length < 3 ? string : nativeReplace.call(string, args[1], args[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13594,7 +13644,7 @@
|
|||||||
return castSlice(stringToArray(string), 0, limit);
|
return castSlice(stringToArray(string), 0, limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return string.split(separator, limit);
|
return nativeSplit.call(string, separator, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14653,7 +14703,7 @@
|
|||||||
object = this;
|
object = this;
|
||||||
methodNames = baseFunctions(source, keys(source));
|
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);
|
isFunc = isFunction(object);
|
||||||
|
|
||||||
arrayEach(methodNames, function(methodName) {
|
arrayEach(methodNames, function(methodName) {
|
||||||
@@ -14718,7 +14768,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that returns its nth argument.
|
* Creates a function that returns its nth argument. If `n` is negative,
|
||||||
|
* the nth argument from the end is returned.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -14729,15 +14780,18 @@
|
|||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var func = _.nthArg(1);
|
* var func = _.nthArg(1);
|
||||||
*
|
* func('a', 'b', 'c', 'd');
|
||||||
* func('a', 'b', 'c');
|
|
||||||
* // => 'b'
|
* // => 'b'
|
||||||
|
*
|
||||||
|
* var func = _.nthArg(-2);
|
||||||
|
* func('a', 'b', 'c', 'd');
|
||||||
|
* // => 'c'
|
||||||
*/
|
*/
|
||||||
function nthArg(n) {
|
function nthArg(n) {
|
||||||
n = toInteger(n);
|
n = toInteger(n);
|
||||||
return function() {
|
return rest(function(args) {
|
||||||
return arguments[n];
|
return baseNth(args, n);
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15645,6 +15699,7 @@
|
|||||||
lodash.min = min;
|
lodash.min = min;
|
||||||
lodash.minBy = minBy;
|
lodash.minBy = minBy;
|
||||||
lodash.multiply = multiply;
|
lodash.multiply = multiply;
|
||||||
|
lodash.nth = nth;
|
||||||
lodash.noConflict = noConflict;
|
lodash.noConflict = noConflict;
|
||||||
lodash.noop = noop;
|
lodash.noop = noop;
|
||||||
lodash.now = now;
|
lodash.now = now;
|
||||||
|
|||||||
2
mixin.js
2
mixin.js
@@ -40,7 +40,7 @@ define(['./_arrayEach', './_arrayPush', './_baseFunctions', './_copyArray', './i
|
|||||||
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) {
|
||||||
|
|||||||
32
nth.js
Normal file
32
nth.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
define(['./_baseNth', './toInteger'], function(baseNth, toInteger) {
|
||||||
|
|
||||||
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
|
var undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the nth element of `array`. If `n` is negative, the nth element
|
||||||
|
* from the end is returned.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @since 4.11.0
|
||||||
|
* @category Array
|
||||||
|
* @param {Array} array The array to query.
|
||||||
|
* @param {number} [n=0] The index of the element to return.
|
||||||
|
* @returns {*} Returns the nth element of `array`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var array = ['a', 'b', 'c', 'd'];
|
||||||
|
*
|
||||||
|
* _.nth(array, 1);
|
||||||
|
* // => 'b'
|
||||||
|
*
|
||||||
|
* _.nth(array, -2);
|
||||||
|
* // => 'c';
|
||||||
|
*/
|
||||||
|
function nth(array, n) {
|
||||||
|
return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nth;
|
||||||
|
});
|
||||||
18
nthArg.js
18
nthArg.js
@@ -1,7 +1,8 @@
|
|||||||
define(['./toInteger'], function(toInteger) {
|
define(['./_baseNth', './rest', './toInteger'], function(baseNth, rest, toInteger) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that returns its nth argument.
|
* Creates a function that returns its nth argument. If `n` is negative,
|
||||||
|
* the nth argument from the end is returned.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -12,15 +13,18 @@ define(['./toInteger'], function(toInteger) {
|
|||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var func = _.nthArg(1);
|
* var func = _.nthArg(1);
|
||||||
*
|
* func('a', 'b', 'c', 'd');
|
||||||
* func('a', 'b', 'c');
|
|
||||||
* // => 'b'
|
* // => 'b'
|
||||||
|
*
|
||||||
|
* var func = _.nthArg(-2);
|
||||||
|
* func('a', 'b', 'c', 'd');
|
||||||
|
* // => 'c'
|
||||||
*/
|
*/
|
||||||
function nthArg(n) {
|
function nthArg(n) {
|
||||||
n = toInteger(n);
|
n = toInteger(n);
|
||||||
return function() {
|
return rest(function(args) {
|
||||||
return arguments[n];
|
return baseNth(args, n);
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return nthArg;
|
return nthArg;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './_isFlattenableIteratee', './rest'], function(apply, arrayMap, baseFlatten, baseIteratee, isFlattenableIteratee, rest) {
|
define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './_baseUnary', './isArray', './_isFlattenableIteratee', './rest'], function(apply, arrayMap, baseFlatten, baseIteratee, baseUnary, isArray, isFlattenableIteratee, rest) {
|
||||||
|
|
||||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
var nativeMin = Math.min;
|
var nativeMin = Math.min;
|
||||||
@@ -36,7 +36,10 @@ define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './_isFl
|
|||||||
* // => [100, 10]
|
* // => [100, 10]
|
||||||
*/
|
*/
|
||||||
var overArgs = rest(function(func, transforms) {
|
var overArgs = rest(function(func, transforms) {
|
||||||
transforms = arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseIteratee);
|
transforms = (transforms.length == 1 && isArray(transforms[0]))
|
||||||
|
? arrayMap(transforms[0], baseUnary(baseIteratee))
|
||||||
|
: arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseUnary(baseIteratee));
|
||||||
|
|
||||||
var funcsLength = transforms.length;
|
var funcsLength = transforms.length;
|
||||||
return rest(function(args) {
|
return rest(function(args) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash-amd",
|
"name": "lodash-amd",
|
||||||
"version": "4.10.0",
|
"version": "4.11.1",
|
||||||
"description": "Lodash exported as AMD modules.",
|
"description": "Lodash exported as AMD modules.",
|
||||||
"homepage": "https://lodash.com/custom-builds",
|
"homepage": "https://lodash.com/custom-builds",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
define(['./toString'], function(toString) {
|
define(['./toString'], function(toString) {
|
||||||
|
|
||||||
|
/** Used for built-in method references. */
|
||||||
|
var stringProto = String.prototype;
|
||||||
|
|
||||||
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
|
var nativeReplace = stringProto.replace;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces matches for `pattern` in `string` with `replacement`.
|
* Replaces matches for `pattern` in `string` with `replacement`.
|
||||||
*
|
*
|
||||||
@@ -23,7 +29,7 @@ define(['./toString'], function(toString) {
|
|||||||
var args = arguments,
|
var args = arguments,
|
||||||
string = toString(args[0]);
|
string = toString(args[0]);
|
||||||
|
|
||||||
return args.length < 3 ? string : string.replace(args[1], args[2]);
|
return args.length < 3 ? string : nativeReplace.call(string, args[1], args[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return replace;
|
return replace;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseFlatten', './_baseOrderBy', './_isIterateeCall', './rest'], function(baseFlatten, baseOrderBy, isIterateeCall, rest) {
|
define(['./_baseFlatten', './_baseOrderBy', './isArray', './_isFlattenableIteratee', './_isIterateeCall', './rest'], function(baseFlatten, baseOrderBy, isArray, isFlattenableIteratee, isIterateeCall, rest) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array of elements, sorted in ascending order by the results of
|
* Creates an array of elements, sorted in ascending order by the results of
|
||||||
@@ -44,7 +44,11 @@ define(['./_baseFlatten', './_baseOrderBy', './_isIterateeCall', './rest'], func
|
|||||||
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
||||||
iteratees = [iteratees[0]];
|
iteratees = [iteratees[0]];
|
||||||
}
|
}
|
||||||
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
|
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
|
||||||
|
? iteratees[0]
|
||||||
|
: baseFlatten(iteratees, 1, isFlattenableIteratee);
|
||||||
|
|
||||||
|
return baseOrderBy(collection, iteratees, []);
|
||||||
});
|
});
|
||||||
|
|
||||||
return sortBy;
|
return sortBy;
|
||||||
|
|||||||
8
split.js
8
split.js
@@ -6,6 +6,12 @@ define(['./_castSlice', './_isIterateeCall', './isRegExp', './_reHasComplexSymbo
|
|||||||
/** Used as references for the maximum length and index of an array. */
|
/** Used as references for the maximum length and index of an array. */
|
||||||
var MAX_ARRAY_LENGTH = 4294967295;
|
var MAX_ARRAY_LENGTH = 4294967295;
|
||||||
|
|
||||||
|
/** Used for built-in method references. */
|
||||||
|
var stringProto = String.prototype;
|
||||||
|
|
||||||
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
|
var nativeSplit = stringProto.split;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splits `string` by `separator`.
|
* Splits `string` by `separator`.
|
||||||
*
|
*
|
||||||
@@ -43,7 +49,7 @@ define(['./_castSlice', './_isIterateeCall', './isRegExp', './_reHasComplexSymbo
|
|||||||
return castSlice(stringToArray(string), 0, limit);
|
return castSlice(stringToArray(string), 0, limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return string.split(separator, limit);
|
return nativeSplit.call(string, separator, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
return split;
|
return split;
|
||||||
|
|||||||
13
words.js
13
words.js
@@ -21,7 +21,8 @@ define(['./toString'], function(toString) {
|
|||||||
rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;
|
rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;
|
||||||
|
|
||||||
/** Used to compose unicode capture groups. */
|
/** Used to compose unicode capture groups. */
|
||||||
var rsBreak = '[' + rsBreakRange + ']',
|
var rsApos = "['\u2019]",
|
||||||
|
rsBreak = '[' + rsBreakRange + ']',
|
||||||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||||
rsDigits = '\\d+',
|
rsDigits = '\\d+',
|
||||||
rsDingbat = '[' + rsDingbatRange + ']',
|
rsDingbat = '[' + rsDingbatRange + ']',
|
||||||
@@ -38,6 +39,8 @@ define(['./toString'], function(toString) {
|
|||||||
/** Used to compose unicode regexes. */
|
/** Used to compose unicode regexes. */
|
||||||
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
|
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
|
||||||
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
|
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
|
||||||
|
rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
||||||
|
rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
||||||
reOptMod = rsModifier + '?',
|
reOptMod = rsModifier + '?',
|
||||||
rsOptVar = '[' + rsVarRange + ']?',
|
rsOptVar = '[' + rsVarRange + ']?',
|
||||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||||
@@ -46,10 +49,10 @@ define(['./toString'], function(toString) {
|
|||||||
|
|
||||||
/** Used to match complex or compound words. */
|
/** Used to match complex or compound words. */
|
||||||
var reComplexWord = RegExp([
|
var reComplexWord = RegExp([
|
||||||
rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
||||||
rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
||||||
rsUpper + '?' + rsLowerMisc + '+',
|
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
|
||||||
rsUpper + '+',
|
rsUpper + '+' + rsOptUpperContr,
|
||||||
rsDigits,
|
rsDigits,
|
||||||
rsEmoji
|
rsEmoji
|
||||||
].join('|'), 'g');
|
].join('|'), 'g');
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ define(['./_LazyWrapper', './_LodashWrapper', './_baseLodash', './isArray', './i
|
|||||||
* `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,
|
* `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,
|
||||||
* `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,
|
* `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,
|
||||||
* `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`,
|
* `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`,
|
||||||
* `noConflict`, `noop`, `now`, `pad`, `padEnd`, `padStart`, `parseInt`,
|
* `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`,
|
||||||
* `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
|
* `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
|
||||||
* `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
* `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
||||||
* `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
|
* `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
|
||||||
|
|||||||
Reference in New Issue
Block a user