mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
Compare commits
1 Commits
4.12.0-amd
...
4.13.0-amd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c731ef8e1e |
@@ -1,4 +1,4 @@
|
||||
# lodash-amd v4.12.0
|
||||
# lodash-amd v4.13.0
|
||||
|
||||
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.12.0-amd) for more details.
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.13.0-amd) for more details.
|
||||
|
||||
@@ -4,7 +4,7 @@ define([], function() {
|
||||
* A specialized version of `baseAggregator` for arrays.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} setter The function to set `accumulator` values.
|
||||
* @param {Function} iteratee The iteratee to transform keys.
|
||||
* @param {Object} accumulator The initial aggregated object.
|
||||
@@ -12,7 +12,7 @@ define([], function() {
|
||||
*/
|
||||
function arrayAggregator(array, setter, iteratee, accumulator) {
|
||||
var index = -1,
|
||||
length = array.length;
|
||||
length = array ? array.length : 0;
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
|
||||
@@ -5,13 +5,13 @@ define([], function() {
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array} Returns `array`.
|
||||
*/
|
||||
function arrayEach(array, iteratee) {
|
||||
var index = -1,
|
||||
length = array.length;
|
||||
length = array ? array.length : 0;
|
||||
|
||||
while (++index < length) {
|
||||
if (iteratee(array[index], index, array) === false) {
|
||||
|
||||
@@ -5,12 +5,12 @@ define([], function() {
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array} Returns `array`.
|
||||
*/
|
||||
function arrayEachRight(array, iteratee) {
|
||||
var length = array.length;
|
||||
var length = array ? array.length : 0;
|
||||
|
||||
while (length--) {
|
||||
if (iteratee(array[length], length, array) === false) {
|
||||
|
||||
@@ -5,14 +5,14 @@ define([], function() {
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
||||
* else `false`.
|
||||
*/
|
||||
function arrayEvery(array, predicate) {
|
||||
var index = -1,
|
||||
length = array.length;
|
||||
length = array ? array.length : 0;
|
||||
|
||||
while (++index < length) {
|
||||
if (!predicate(array[index], index, array)) {
|
||||
|
||||
@@ -5,13 +5,13 @@ define([], function() {
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {Array} Returns the new filtered array.
|
||||
*/
|
||||
function arrayFilter(array, predicate) {
|
||||
var index = -1,
|
||||
length = array.length,
|
||||
length = array ? array.length : 0,
|
||||
resIndex = 0,
|
||||
result = [];
|
||||
|
||||
|
||||
@@ -5,12 +5,13 @@ define(['./_baseIndexOf'], function(baseIndexOf) {
|
||||
* specifying an index to search from.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} [array] The array to search.
|
||||
* @param {*} target The value to search for.
|
||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||
*/
|
||||
function arrayIncludes(array, value) {
|
||||
return !!array.length && baseIndexOf(array, value, 0) > -1;
|
||||
var length = array ? array.length : 0;
|
||||
return !!length && baseIndexOf(array, value, 0) > -1;
|
||||
}
|
||||
|
||||
return arrayIncludes;
|
||||
|
||||
@@ -4,14 +4,14 @@ define([], function() {
|
||||
* This function is like `arrayIncludes` except that it accepts a comparator.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array} [array] The array to search.
|
||||
* @param {*} target The value to search for.
|
||||
* @param {Function} comparator The comparator invoked per element.
|
||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||
*/
|
||||
function arrayIncludesWith(array, value, comparator) {
|
||||
var index = -1,
|
||||
length = array.length;
|
||||
length = array ? array.length : 0;
|
||||
|
||||
while (++index < length) {
|
||||
if (comparator(value, array[index])) {
|
||||
|
||||
@@ -5,13 +5,13 @@ define([], function() {
|
||||
* shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array} Returns the new mapped array.
|
||||
*/
|
||||
function arrayMap(array, iteratee) {
|
||||
var index = -1,
|
||||
length = array.length,
|
||||
length = array ? array.length : 0,
|
||||
result = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
|
||||
@@ -5,7 +5,7 @@ define([], function() {
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @param {*} [accumulator] The initial value.
|
||||
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
||||
@@ -14,7 +14,7 @@ define([], function() {
|
||||
*/
|
||||
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
||||
var index = -1,
|
||||
length = array.length;
|
||||
length = array ? array.length : 0;
|
||||
|
||||
if (initAccum && length) {
|
||||
accumulator = array[++index];
|
||||
|
||||
@@ -5,7 +5,7 @@ define([], function() {
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @param {*} [accumulator] The initial value.
|
||||
* @param {boolean} [initAccum] Specify using the last element of `array` as
|
||||
@@ -13,7 +13,7 @@ define([], function() {
|
||||
* @returns {*} Returns the accumulated value.
|
||||
*/
|
||||
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
||||
var length = array.length;
|
||||
var length = array ? array.length : 0;
|
||||
if (initAccum && length) {
|
||||
accumulator = array[--length];
|
||||
}
|
||||
|
||||
@@ -5,14 +5,14 @@ define([], function() {
|
||||
* shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
||||
* else `false`.
|
||||
*/
|
||||
function arraySome(array, predicate) {
|
||||
var index = -1,
|
||||
length = array.length;
|
||||
length = array ? array.length : 0;
|
||||
|
||||
while (++index < length) {
|
||||
if (predicate(array[index], index, array)) {
|
||||
|
||||
@@ -7,12 +7,13 @@ define([], function() {
|
||||
* @private
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @param {number} fromIndex The index to search from.
|
||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
*/
|
||||
function baseFindIndex(array, predicate, fromRight) {
|
||||
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
||||
var length = array.length,
|
||||
index = fromRight ? length : -1;
|
||||
index = fromIndex + (fromRight ? 1 : -1);
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
if (predicate(array[index], index, array)) {
|
||||
|
||||
@@ -1,28 +1,26 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* The base implementation of methods like `_.find` and `_.findKey`, without
|
||||
* support for iteratee shorthands, which iterates over `collection` using
|
||||
* `eachFunc`.
|
||||
* The base implementation of methods like `_.findKey` and `_.findLastKey`,
|
||||
* without support for iteratee shorthands, which iterates over `collection`
|
||||
* using `eachFunc`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object} collection The collection to search.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @param {Function} eachFunc The function to iterate over `collection`.
|
||||
* @param {boolean} [retKey] Specify returning the key of the found element
|
||||
* instead of the element itself.
|
||||
* @returns {*} Returns the found element or its key, else `undefined`.
|
||||
*/
|
||||
function baseFind(collection, predicate, eachFunc, retKey) {
|
||||
function baseFindKey(collection, predicate, eachFunc) {
|
||||
var result;
|
||||
eachFunc(collection, function(value, key, collection) {
|
||||
if (predicate(value, key, collection)) {
|
||||
result = retKey ? key : value;
|
||||
result = key;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
return baseFind;
|
||||
return baseFindKey;
|
||||
});
|
||||
@@ -10,7 +10,7 @@ define(['./_getPrototype'], function(getPrototype) {
|
||||
* The base implementation of `_.has` without support for deep paths.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Object} [object] The object to query.
|
||||
* @param {Array|string} key The key to check.
|
||||
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
||||
*/
|
||||
@@ -18,8 +18,9 @@ define(['./_getPrototype'], function(getPrototype) {
|
||||
// Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
|
||||
// that are composed entirely of index properties, return `false` for
|
||||
// `hasOwnProperty` checks of them.
|
||||
return hasOwnProperty.call(object, key) ||
|
||||
(typeof object == 'object' && key in object && getPrototype(object) === null);
|
||||
return object != null &&
|
||||
(hasOwnProperty.call(object, key) ||
|
||||
(typeof object == 'object' && key in object && getPrototype(object) === null));
|
||||
}
|
||||
|
||||
return baseHas;
|
||||
|
||||
@@ -4,12 +4,12 @@ define([], function() {
|
||||
* The base implementation of `_.hasIn` without support for deep paths.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Object} [object] The object to query.
|
||||
* @param {Array|string} key The key to check.
|
||||
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
||||
*/
|
||||
function baseHasIn(object, key) {
|
||||
return key in Object(object);
|
||||
return object != null && key in Object(object);
|
||||
}
|
||||
|
||||
return baseHasIn;
|
||||
|
||||
44
_baseIsNative.js
Normal file
44
_baseIsNative.js
Normal file
@@ -0,0 +1,44 @@
|
||||
define(['./isFunction', './_isHostObject', './_isMasked', './isObject', './_toSource'], function(isFunction, isHostObject, isMasked, isObject, toSource) {
|
||||
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
|
||||
*/
|
||||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||||
|
||||
/** Used to detect host constructors (Safari). */
|
||||
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var funcToString = Function.prototype.toString;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/** Used to detect if a method is native. */
|
||||
var reIsNative = RegExp('^' +
|
||||
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
||||
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||||
);
|
||||
|
||||
/**
|
||||
* The base implementation of `_.isNative` without bad shim checks.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a native function,
|
||||
* else `false`.
|
||||
*/
|
||||
function baseIsNative(value) {
|
||||
if (!isObject(value) || isMasked(value)) {
|
||||
return false;
|
||||
}
|
||||
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
||||
return pattern.test(toSource(value));
|
||||
}
|
||||
|
||||
return baseIsNative;
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_arrayMap', './_baseIndexOf', './_baseIndexOfWith', './_baseUnary'], function(arrayMap, baseIndexOf, baseIndexOfWith, baseUnary) {
|
||||
define(['./_arrayMap', './_baseIndexOf', './_baseIndexOfWith', './_baseUnary', './_copyArray'], function(arrayMap, baseIndexOf, baseIndexOfWith, baseUnary, copyArray) {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var arrayProto = Array.prototype;
|
||||
@@ -23,6 +23,9 @@ define(['./_arrayMap', './_baseIndexOf', './_baseIndexOfWith', './_baseUnary'],
|
||||
length = values.length,
|
||||
seen = array;
|
||||
|
||||
if (array === values) {
|
||||
values = copyArray(values);
|
||||
}
|
||||
if (iteratee) {
|
||||
seen = arrayMap(array, baseUnary(iteratee));
|
||||
}
|
||||
|
||||
7
_coreJsData.js
Normal file
7
_coreJsData.js
Normal file
@@ -0,0 +1,7 @@
|
||||
define(['./_root'], function(root) {
|
||||
|
||||
/** Used to detect overreaching core-js shims. */
|
||||
var coreJsData = root['__core-js_shared__'];
|
||||
|
||||
return coreJsData;
|
||||
});
|
||||
@@ -1,5 +1,8 @@
|
||||
define(['./toInteger', './toNumber', './toString'], function(toInteger, toNumber, toString) {
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMin = Math.min;
|
||||
|
||||
/**
|
||||
* Creates a function like `_.round`.
|
||||
*
|
||||
@@ -11,7 +14,7 @@ define(['./toInteger', './toNumber', './toString'], function(toInteger, toNumber
|
||||
var func = Math[methodName];
|
||||
return function(number, precision) {
|
||||
number = toNumber(number);
|
||||
precision = toInteger(precision);
|
||||
precision = nativeMin(toInteger(precision), 292);
|
||||
if (precision) {
|
||||
// Shift with exponential notation to avoid floating-point issues.
|
||||
// See [MDN](https://mdn.io/round#Examples) for more details.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_isStrictComparable', './toPairs'], function(isStrictComparable, toPairs) {
|
||||
define(['./_isStrictComparable', './keys'], function(isStrictComparable, keys) {
|
||||
|
||||
/**
|
||||
* Gets the property names, values, and compare flags of `object`.
|
||||
@@ -8,11 +8,14 @@ define(['./_isStrictComparable', './toPairs'], function(isStrictComparable, toPa
|
||||
* @returns {Array} Returns the match data of `object`.
|
||||
*/
|
||||
function getMatchData(object) {
|
||||
var result = toPairs(object),
|
||||
var result = keys(object),
|
||||
length = result.length;
|
||||
|
||||
while (length--) {
|
||||
result[length][2] = isStrictComparable(result[length][1]);
|
||||
var key = result[length],
|
||||
value = object[key];
|
||||
|
||||
result[length] = [key, value, isStrictComparable(value)];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./isNative'], function(isNative) {
|
||||
define(['./_baseIsNative', './_getValue'], function(baseIsNative, getValue) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -12,8 +12,8 @@ define(['./isNative'], function(isNative) {
|
||||
* @returns {*} Returns the function if it's native, else `undefined`.
|
||||
*/
|
||||
function getNative(object, key) {
|
||||
var value = object[key];
|
||||
return isNative(value) ? value : undefined;
|
||||
var value = getValue(object, key);
|
||||
return baseIsNative(value) ? value : undefined;
|
||||
}
|
||||
|
||||
return getNative;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define([], function() {
|
||||
define(['./stubArray'], function(stubArray) {
|
||||
|
||||
/** Built-in value references. */
|
||||
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||
@@ -18,9 +18,7 @@ define([], function() {
|
||||
|
||||
// Fallback for IE < 11.
|
||||
if (!getOwnPropertySymbols) {
|
||||
getSymbols = function() {
|
||||
return [];
|
||||
};
|
||||
getSymbols = stubArray;
|
||||
}
|
||||
|
||||
return getSymbols;
|
||||
|
||||
19
_getValue.js
Normal file
19
_getValue.js
Normal file
@@ -0,0 +1,19 @@
|
||||
define([], function() {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Gets the value at `key` of `object`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} [object] The object to query.
|
||||
* @param {string} key The key of the property to get.
|
||||
* @returns {*} Returns the property value.
|
||||
*/
|
||||
function getValue(object, key) {
|
||||
return object == null ? undefined : object[key];
|
||||
}
|
||||
|
||||
return getValue;
|
||||
});
|
||||
@@ -11,7 +11,7 @@ define([], function() {
|
||||
*/
|
||||
function indexOfNaN(array, fromIndex, fromRight) {
|
||||
var length = array.length,
|
||||
index = fromIndex + (fromRight ? 0 : -1);
|
||||
index = fromIndex + (fromRight ? 1 : -1);
|
||||
|
||||
while ((fromRight ? index-- : ++index < length)) {
|
||||
var other = array[index];
|
||||
|
||||
13
_isMaskable.js
Normal file
13
_isMaskable.js
Normal file
@@ -0,0 +1,13 @@
|
||||
define(['./_coreJsData', './isFunction', './stubFalse'], function(coreJsData, isFunction, stubFalse) {
|
||||
|
||||
/**
|
||||
* Checks if `func` is capable of being masked.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
|
||||
*/
|
||||
var isMaskable = !coreJsData ? stubFalse : isFunction;
|
||||
|
||||
return isMaskable;
|
||||
});
|
||||
21
_isMasked.js
Normal file
21
_isMasked.js
Normal file
@@ -0,0 +1,21 @@
|
||||
define(['./_coreJsData'], function(coreJsData) {
|
||||
|
||||
/** Used to detect methods masquerading as native. */
|
||||
var maskSrcKey = (function() {
|
||||
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
||||
return uid ? ('Symbol(src)_1.' + uid) : '';
|
||||
}());
|
||||
|
||||
/**
|
||||
* Checks if `func` has its source masked.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to check.
|
||||
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
||||
*/
|
||||
function isMasked(func) {
|
||||
return !!maskSrcKey && (maskSrcKey in func);
|
||||
}
|
||||
|
||||
return isMasked;
|
||||
});
|
||||
39
_root.js
39
_root.js
@@ -1,45 +1,16 @@
|
||||
define(['./_checkGlobal'], function(checkGlobal) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** Used to determine if values are of the language type `Object`. */
|
||||
var objectTypes = {
|
||||
'function': true,
|
||||
'object': true
|
||||
};
|
||||
|
||||
/** Detect free variable `exports`. */
|
||||
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
|
||||
? exports
|
||||
: undefined;
|
||||
|
||||
/** Detect free variable `module`. */
|
||||
var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
|
||||
? module
|
||||
: undefined;
|
||||
|
||||
/** Detect free variable `global` from Node.js. */
|
||||
var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
|
||||
var freeGlobal = checkGlobal(typeof global == 'object' && global);
|
||||
|
||||
/** Detect free variable `self`. */
|
||||
var freeSelf = checkGlobal(objectTypes[typeof self] && self);
|
||||
|
||||
/** Detect free variable `window`. */
|
||||
var freeWindow = checkGlobal(objectTypes[typeof window] && window);
|
||||
var freeSelf = checkGlobal(typeof self == 'object' && self);
|
||||
|
||||
/** Detect `this` as the global object. */
|
||||
var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
|
||||
var thisGlobal = checkGlobal(typeof this == 'object' && this);
|
||||
|
||||
/**
|
||||
* Used as a reference to the global object.
|
||||
*
|
||||
* The `this` value is used if it's the global object to avoid Greasemonkey's
|
||||
* restricted `window` object, otherwise the `window` object is used.
|
||||
*/
|
||||
var root = freeGlobal ||
|
||||
((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
|
||||
freeSelf || thisGlobal || Function('return this')();
|
||||
/** Used as a reference to the global object. */
|
||||
var root = freeGlobal || freeSelf || thisGlobal || Function('return this')();
|
||||
|
||||
return root;
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
define(['./memoize', './toString'], function(memoize, toString) {
|
||||
|
||||
/** Used to match property names within property paths. */
|
||||
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g;
|
||||
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g;
|
||||
|
||||
/** Used to match backslashes in property paths. */
|
||||
var reEscapeChar = /\\(\\)?/g;
|
||||
|
||||
3
at.js
3
at.js
@@ -16,9 +16,6 @@ define(['./_baseAt', './_baseFlatten', './rest'], function(baseAt, baseFlatten,
|
||||
*
|
||||
* _.at(object, ['a[0].b.c', 'a[1]']);
|
||||
* // => [3, 4]
|
||||
*
|
||||
* _.at(['a', 'b', 'c'], 0, 2);
|
||||
* // => ['a', 'c']
|
||||
*/
|
||||
var at = rest(function(object, paths) {
|
||||
return baseAt(object, baseFlatten(paths, 1));
|
||||
|
||||
2
bind.js
2
bind.js
@@ -11,7 +11,7 @@ define(['./_createWrapper', './_getHolder', './_replaceHolders', './rest'], func
|
||||
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
|
||||
* may be used as a placeholder for partially applied arguments.
|
||||
*
|
||||
* **Note:** Unlike native `Function#bind` this method doesn't set the "length"
|
||||
* **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
|
||||
* property of bound functions.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -22,7 +22,7 @@ define(['./_arrayEach', './_baseFlatten', './bind', './rest', './_toKey'], funct
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* _.bindAll(view, 'onClick');
|
||||
* _.bindAll(view, ['onClick']);
|
||||
* jQuery(element).on('click', view.onClick);
|
||||
* // => Logs 'clicked docs' when clicked.
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@ define(['./_baseClone', './_baseConforms'], function(baseClone, baseConforms) {
|
||||
* { 'user': 'fred', 'age': 40 }
|
||||
* ];
|
||||
*
|
||||
* _.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) }));
|
||||
* _.filter(users, _.conforms({ 'age': function(n) { return n > 38; } }));
|
||||
* // => [{ 'user': 'fred', 'age': 40 }]
|
||||
*/
|
||||
function conforms(source) {
|
||||
|
||||
@@ -11,10 +11,12 @@ define([], function() {
|
||||
* @returns {Function} Returns the new constant function.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'user': 'fred' };
|
||||
* var getter = _.constant(object);
|
||||
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
||||
*
|
||||
* getter() === object;
|
||||
* console.log(objects);
|
||||
* // => [{ 'a': 1 }, { 'a': 1 }]
|
||||
*
|
||||
* console.log(objects[0] === objects[1]);
|
||||
* // => true
|
||||
*/
|
||||
function constant(value) {
|
||||
|
||||
@@ -25,6 +25,7 @@ define(['./_createAggregator'], function(createAggregator) {
|
||||
* _.countBy([6.1, 4.2, 6.3], Math.floor);
|
||||
* // => { '4': 1, '6': 2 }
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.countBy(['one', 'two', 'three'], 'length');
|
||||
* // => { '3': 2, '5': 1 }
|
||||
*/
|
||||
|
||||
13
debounce.js
13
debounce.js
@@ -66,7 +66,7 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
||||
maxWait,
|
||||
result,
|
||||
timerId,
|
||||
lastCallTime = 0,
|
||||
lastCallTime,
|
||||
lastInvokeTime = 0,
|
||||
leading = false,
|
||||
maxing = false,
|
||||
@@ -117,7 +117,7 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
||||
// Either this is the first call, activity has stopped and we're at the
|
||||
// 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) ||
|
||||
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
||||
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
||||
}
|
||||
|
||||
@@ -131,7 +131,6 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
||||
}
|
||||
|
||||
function trailingEdge(time) {
|
||||
clearTimeout(timerId);
|
||||
timerId = undefined;
|
||||
|
||||
// Only invoke if we have `lastArgs` which means `func` has been
|
||||
@@ -144,11 +143,8 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
if (timerId !== undefined) {
|
||||
clearTimeout(timerId);
|
||||
}
|
||||
lastCallTime = lastInvokeTime = 0;
|
||||
lastArgs = lastThis = timerId = undefined;
|
||||
lastInvokeTime = 0;
|
||||
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
||||
}
|
||||
|
||||
function flush() {
|
||||
@@ -169,7 +165,6 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber)
|
||||
}
|
||||
if (maxing) {
|
||||
// Handle invocations in a tight loop.
|
||||
clearTimeout(timerId);
|
||||
timerId = setTimeout(timerExpired, wait);
|
||||
return invokeFunc(lastCallTime);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ define(['./_baseDifference', './_baseFlatten', './isArrayLikeObject', './rest'],
|
||||
* @see _.without, _.xor
|
||||
* @example
|
||||
*
|
||||
* _.difference([3, 2, 1], [4, 2]);
|
||||
* // => [3, 1]
|
||||
* _.difference([2, 1], [2, 3]);
|
||||
* // => [1]
|
||||
*/
|
||||
var difference = rest(function(array, values) {
|
||||
return isArrayLikeObject(array)
|
||||
|
||||
@@ -20,8 +20,8 @@ define(['./_baseDifference', './_baseFlatten', './_baseIteratee', './isArrayLike
|
||||
* @returns {Array} Returns the new array of filtered values.
|
||||
* @example
|
||||
*
|
||||
* _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor);
|
||||
* // => [3.1, 1.3]
|
||||
* _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
||||
* // => [1.2]
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
|
||||
|
||||
@@ -12,7 +12,7 @@ define(['./_baseClamp', './_baseToString', './toInteger', './toString'], functio
|
||||
* @category String
|
||||
* @param {string} [string=''] The string to search.
|
||||
* @param {string} [target] The string to search for.
|
||||
* @param {number} [position=string.length] The position to search from.
|
||||
* @param {number} [position=string.length] The position to search up to.
|
||||
* @returns {boolean} Returns `true` if `string` ends with `target`,
|
||||
* else `false`.
|
||||
* @example
|
||||
|
||||
14
find.js
14
find.js
@@ -1,4 +1,4 @@
|
||||
define(['./_baseEach', './_baseFind', './_baseFindIndex', './_baseIteratee', './isArray'], function(baseEach, baseFind, baseFindIndex, baseIteratee, isArray) {
|
||||
define(['./findIndex', './isArrayLike', './values'], function(findIndex, isArrayLike, values) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -15,6 +15,7 @@ define(['./_baseEach', './_baseFind', './_baseFindIndex', './_baseIteratee', './
|
||||
* @param {Array|Object} collection The collection to search.
|
||||
* @param {Array|Function|Object|string} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
* @returns {*} Returns the matched element, else `undefined`.
|
||||
* @example
|
||||
*
|
||||
@@ -39,13 +40,10 @@ define(['./_baseEach', './_baseFind', './_baseFindIndex', './_baseIteratee', './
|
||||
* _.find(users, 'active');
|
||||
* // => object for 'barney'
|
||||
*/
|
||||
function find(collection, predicate) {
|
||||
predicate = baseIteratee(predicate, 3);
|
||||
if (isArray(collection)) {
|
||||
var index = baseFindIndex(collection, predicate);
|
||||
return index > -1 ? collection[index] : undefined;
|
||||
}
|
||||
return baseFind(collection, predicate, baseEach);
|
||||
function find(collection, predicate, fromIndex) {
|
||||
collection = isArrayLike(collection) ? collection : values(collection);
|
||||
var index = findIndex(collection, predicate, fromIndex);
|
||||
return index > -1 ? collection[index] : undefined;
|
||||
}
|
||||
|
||||
return find;
|
||||
|
||||
20
findIndex.js
20
findIndex.js
@@ -1,4 +1,7 @@
|
||||
define(['./_baseFindIndex', './_baseIteratee'], function(baseFindIndex, baseIteratee) {
|
||||
define(['./_baseFindIndex', './_baseIteratee', './toInteger'], function(baseFindIndex, baseIteratee, toInteger) {
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMax = Math.max;
|
||||
|
||||
/**
|
||||
* This method is like `_.find` except that it returns the index of the first
|
||||
@@ -11,6 +14,7 @@ define(['./_baseFindIndex', './_baseIteratee'], function(baseFindIndex, baseIter
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array|Function|Object|string} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=0] The index to search from.
|
||||
* @returns {number} Returns the index of the found element, else `-1`.
|
||||
* @example
|
||||
*
|
||||
@@ -35,10 +39,16 @@ define(['./_baseFindIndex', './_baseIteratee'], function(baseFindIndex, baseIter
|
||||
* _.findIndex(users, 'active');
|
||||
* // => 2
|
||||
*/
|
||||
function findIndex(array, predicate) {
|
||||
return (array && array.length)
|
||||
? baseFindIndex(array, baseIteratee(predicate, 3))
|
||||
: -1;
|
||||
function findIndex(array, predicate, fromIndex) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return -1;
|
||||
}
|
||||
var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
||||
if (index < 0) {
|
||||
index = nativeMax(length + index, 0);
|
||||
}
|
||||
return baseFindIndex(array, baseIteratee(predicate, 3), index);
|
||||
}
|
||||
|
||||
return findIndex;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseFind', './_baseForOwn', './_baseIteratee'], function(baseFind, baseForOwn, baseIteratee) {
|
||||
define(['./_baseFindKey', './_baseForOwn', './_baseIteratee'], function(baseFindKey, baseForOwn, baseIteratee) {
|
||||
|
||||
/**
|
||||
* This method is like `_.find` except that it returns the key of the first
|
||||
@@ -37,7 +37,7 @@ define(['./_baseFind', './_baseForOwn', './_baseIteratee'], function(baseFind, b
|
||||
* // => 'barney'
|
||||
*/
|
||||
function findKey(object, predicate) {
|
||||
return baseFind(object, baseIteratee(predicate, 3), baseForOwn, true);
|
||||
return baseFindKey(object, baseIteratee(predicate, 3), baseForOwn);
|
||||
}
|
||||
|
||||
return findKey;
|
||||
|
||||
14
findLast.js
14
findLast.js
@@ -1,4 +1,4 @@
|
||||
define(['./_baseEachRight', './_baseFind', './_baseFindIndex', './_baseIteratee', './isArray'], function(baseEachRight, baseFind, baseFindIndex, baseIteratee, isArray) {
|
||||
define(['./findLastIndex', './isArrayLike', './values'], function(findLastIndex, isArrayLike, values) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
@@ -14,6 +14,7 @@ define(['./_baseEachRight', './_baseFind', './_baseFindIndex', './_baseIteratee'
|
||||
* @param {Array|Object} collection The collection to search.
|
||||
* @param {Array|Function|Object|string} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
||||
* @returns {*} Returns the matched element, else `undefined`.
|
||||
* @example
|
||||
*
|
||||
@@ -22,13 +23,10 @@ define(['./_baseEachRight', './_baseFind', './_baseFindIndex', './_baseIteratee'
|
||||
* });
|
||||
* // => 3
|
||||
*/
|
||||
function findLast(collection, predicate) {
|
||||
predicate = baseIteratee(predicate, 3);
|
||||
if (isArray(collection)) {
|
||||
var index = baseFindIndex(collection, predicate, true);
|
||||
return index > -1 ? collection[index] : undefined;
|
||||
}
|
||||
return baseFind(collection, predicate, baseEachRight);
|
||||
function findLast(collection, predicate, fromIndex) {
|
||||
collection = isArrayLike(collection) ? collection : values(collection);
|
||||
var index = findLastIndex(collection, predicate, fromIndex);
|
||||
return index > -1 ? collection[index] : undefined;
|
||||
}
|
||||
|
||||
return findLast;
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
define(['./_baseFindIndex', './_baseIteratee'], function(baseFindIndex, baseIteratee) {
|
||||
define(['./_baseFindIndex', './_baseIteratee', './toInteger'], function(baseFindIndex, baseIteratee, toInteger) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||
var nativeMax = Math.max,
|
||||
nativeMin = Math.min;
|
||||
|
||||
/**
|
||||
* This method is like `_.findIndex` except that it iterates over elements
|
||||
@@ -11,6 +18,7 @@ define(['./_baseFindIndex', './_baseIteratee'], function(baseFindIndex, baseIter
|
||||
* @param {Array} array The array to search.
|
||||
* @param {Array|Function|Object|string} [predicate=_.identity]
|
||||
* The function invoked per iteration.
|
||||
* @param {number} [fromIndex=array.length-1] The index to search from.
|
||||
* @returns {number} Returns the index of the found element, else `-1`.
|
||||
* @example
|
||||
*
|
||||
@@ -35,10 +43,19 @@ define(['./_baseFindIndex', './_baseIteratee'], function(baseFindIndex, baseIter
|
||||
* _.findLastIndex(users, 'active');
|
||||
* // => 0
|
||||
*/
|
||||
function findLastIndex(array, predicate) {
|
||||
return (array && array.length)
|
||||
? baseFindIndex(array, baseIteratee(predicate, 3), true)
|
||||
: -1;
|
||||
function findLastIndex(array, predicate, fromIndex) {
|
||||
var length = array ? array.length : 0;
|
||||
if (!length) {
|
||||
return -1;
|
||||
}
|
||||
var index = length - 1;
|
||||
if (fromIndex !== undefined) {
|
||||
index = toInteger(fromIndex);
|
||||
index = fromIndex < 0
|
||||
? nativeMax(length + index, 0)
|
||||
: nativeMin(index, length - 1);
|
||||
}
|
||||
return baseFindIndex(array, baseIteratee(predicate, 3), index, true);
|
||||
}
|
||||
|
||||
return findLastIndex;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['./_baseFind', './_baseForOwnRight', './_baseIteratee'], function(baseFind, baseForOwnRight, baseIteratee) {
|
||||
define(['./_baseFindKey', './_baseForOwnRight', './_baseIteratee'], function(baseFindKey, baseForOwnRight, baseIteratee) {
|
||||
|
||||
/**
|
||||
* This method is like `_.findKey` except that it iterates over elements of
|
||||
@@ -37,7 +37,7 @@ define(['./_baseFind', './_baseForOwnRight', './_baseIteratee'], function(baseFi
|
||||
* // => 'pebbles'
|
||||
*/
|
||||
function findLastKey(object, predicate) {
|
||||
return baseFind(object, baseIteratee(predicate, 3), baseForOwnRight, true);
|
||||
return baseFindKey(object, baseIteratee(predicate, 3), baseForOwnRight);
|
||||
}
|
||||
|
||||
return findLastKey;
|
||||
|
||||
2
flow.js
2
flow.js
@@ -18,7 +18,7 @@ define(['./_createFlow'], function(createFlow) {
|
||||
* return n * n;
|
||||
* }
|
||||
*
|
||||
* var addSquare = _.flow(_.add, square);
|
||||
* var addSquare = _.flow([_.add, square]);
|
||||
* addSquare(1, 2);
|
||||
* // => 9
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,7 @@ define(['./_createFlow'], function(createFlow) {
|
||||
* return n * n;
|
||||
* }
|
||||
*
|
||||
* var addSquare = _.flowRight(square, _.add);
|
||||
* var addSquare = _.flowRight([square, _.add]);
|
||||
* addSquare(1, 2);
|
||||
* // => 9
|
||||
*/
|
||||
|
||||
@@ -13,7 +13,7 @@ define([], function() {
|
||||
*
|
||||
* var object = { 'user': 'fred' };
|
||||
*
|
||||
* _.identity(object) === object;
|
||||
* console.log(_.identity(object) === object);
|
||||
* // => true
|
||||
*/
|
||||
function identity(value) {
|
||||
|
||||
@@ -31,11 +31,11 @@ define(['./_baseIndexOf', './toInteger'], function(baseIndexOf, toInteger) {
|
||||
if (!length) {
|
||||
return -1;
|
||||
}
|
||||
fromIndex = toInteger(fromIndex);
|
||||
if (fromIndex < 0) {
|
||||
fromIndex = nativeMax(length + fromIndex, 0);
|
||||
var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
||||
if (index < 0) {
|
||||
index = nativeMax(length + index, 0);
|
||||
}
|
||||
return baseIndexOf(array, value, fromIndex);
|
||||
return baseIndexOf(array, value, index);
|
||||
}
|
||||
|
||||
return indexOf;
|
||||
|
||||
@@ -14,7 +14,7 @@ define(['./_arrayMap', './_baseIntersection', './_castArrayLikeObject', './rest'
|
||||
* @returns {Array} Returns the new array of intersecting values.
|
||||
* @example
|
||||
*
|
||||
* _.intersection([2, 1], [4, 2], [1, 2]);
|
||||
* _.intersection([2, 1], [2, 3]);
|
||||
* // => [2]
|
||||
*/
|
||||
var intersection = rest(function(arrays) {
|
||||
|
||||
@@ -19,7 +19,7 @@ define(['./_arrayMap', './_baseIntersection', './_baseIteratee', './_castArrayLi
|
||||
* @returns {Array} Returns the new array of intersecting values.
|
||||
* @example
|
||||
*
|
||||
* _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
||||
* _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
||||
* // => [2.1]
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
|
||||
22
isBuffer.js
22
isBuffer.js
@@ -1,28 +1,16 @@
|
||||
define(['./constant', './_root'], function(constant, root) {
|
||||
define(['./_root', './stubFalse'], function(root, stubFalse) {
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
||||
/** Used to determine if values are of the language type `Object`. */
|
||||
var objectTypes = {
|
||||
'function': true,
|
||||
'object': true
|
||||
};
|
||||
|
||||
/** Detect free variable `exports`. */
|
||||
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
|
||||
? exports
|
||||
: undefined;
|
||||
var freeExports = typeof exports == 'object' && exports;
|
||||
|
||||
/** Detect free variable `module`. */
|
||||
var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
|
||||
? module
|
||||
: undefined;
|
||||
var freeModule = freeExports && typeof module == 'object' && module;
|
||||
|
||||
/** Detect the popular CommonJS extension `module.exports`. */
|
||||
var moduleExports = (freeModule && freeModule.exports === freeExports)
|
||||
? freeExports
|
||||
: undefined;
|
||||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||||
|
||||
/** Built-in value references. */
|
||||
var Buffer = moduleExports ? root.Buffer : undefined;
|
||||
@@ -44,7 +32,7 @@ define(['./constant', './_root'], function(constant, root) {
|
||||
* _.isBuffer(new Uint8Array(2));
|
||||
* // => false
|
||||
*/
|
||||
var isBuffer = !Buffer ? constant(false) : function(value) {
|
||||
var isBuffer = !Buffer ? stubFalse : function(value) {
|
||||
return value instanceof Buffer;
|
||||
};
|
||||
|
||||
|
||||
43
isNative.js
43
isNative.js
@@ -1,31 +1,15 @@
|
||||
define(['./isFunction', './_isHostObject', './isObject', './_toSource'], function(isFunction, isHostObject, isObject, toSource) {
|
||||
define(['./_baseIsNative', './_isMaskable'], function(baseIsNative, isMaskable) {
|
||||
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
|
||||
*/
|
||||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||||
|
||||
/** Used to detect host constructors (Safari). */
|
||||
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var funcToString = Function.prototype.toString;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/** Used to detect if a method is native. */
|
||||
var reIsNative = RegExp('^' +
|
||||
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
||||
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||||
);
|
||||
|
||||
/**
|
||||
* Checks if `value` is a native function.
|
||||
* Checks if `value` is a pristine native function.
|
||||
*
|
||||
* **Note:** This method can't reliably detect native functions in the
|
||||
* presence of the `core-js` package because `core-js` circumvents this kind
|
||||
* of detection. Despite multiple requests, the `core-js` maintainer has made
|
||||
* it clear: any attempt to fix the detection will be obstructed. As a result,
|
||||
* we're left with little choice but to throw an error. Unfortunately, this
|
||||
* also affects packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
|
||||
* which rely on `core-js`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -43,11 +27,10 @@ define(['./isFunction', './_isHostObject', './isObject', './_toSource'], functio
|
||||
* // => false
|
||||
*/
|
||||
function isNative(value) {
|
||||
if (!isObject(value)) {
|
||||
return false;
|
||||
if (isMaskable(value)) {
|
||||
throw new Error('This method is not supported with `core-js`. Try https://github.com/es-shims.');
|
||||
}
|
||||
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
||||
return pattern.test(toSource(value));
|
||||
return baseIsNative(value);
|
||||
}
|
||||
|
||||
return isNative;
|
||||
|
||||
@@ -43,7 +43,7 @@ define(['./_indexOfNaN', './toInteger'], function(indexOfNaN, toInteger) {
|
||||
) + 1;
|
||||
}
|
||||
if (value !== value) {
|
||||
return indexOfNaN(array, index, true);
|
||||
return indexOfNaN(array, index - 1, true);
|
||||
}
|
||||
while (index--) {
|
||||
if (array[index] === value) {
|
||||
|
||||
9
noop.js
9
noop.js
@@ -1,8 +1,7 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* A no-operation function that returns `undefined` regardless of the
|
||||
* arguments it receives.
|
||||
* A method that returns `undefined`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -10,10 +9,8 @@ define([], function() {
|
||||
* @category Util
|
||||
* @example
|
||||
*
|
||||
* var object = { 'user': 'fred' };
|
||||
*
|
||||
* _.noop(object) === undefined;
|
||||
* // => true
|
||||
* _.times(2, _.noop);
|
||||
* // => [undefined, undefined]
|
||||
*/
|
||||
function noop() {
|
||||
// No operation performed.
|
||||
|
||||
7
now.js
7
now.js
@@ -7,7 +7,6 @@ define([], function() {
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 2.4.0
|
||||
* @type {Function}
|
||||
* @category Date
|
||||
* @returns {number} Returns the timestamp.
|
||||
* @example
|
||||
@@ -15,9 +14,11 @@ define([], function() {
|
||||
* _.defer(function(stamp) {
|
||||
* console.log(_.now() - stamp);
|
||||
* }, _.now());
|
||||
* // => Logs the number of milliseconds it took for the deferred function to be invoked.
|
||||
* // => Logs the number of milliseconds it took for the deferred invocation.
|
||||
*/
|
||||
var now = Date.now;
|
||||
function now() {
|
||||
return Date.now();
|
||||
}
|
||||
|
||||
return now;
|
||||
});
|
||||
|
||||
2
nth.js
2
nth.js
@@ -4,7 +4,7 @@ define(['./_baseNth', './toInteger'], function(baseNth, toInteger) {
|
||||
var undefined;
|
||||
|
||||
/**
|
||||
* Gets the element at `n` index of `array`. If `n` is negative, the nth
|
||||
* Gets the element at index `n` of `array`. If `n` is negative, the nth
|
||||
* element from the end is returned.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
define(['./_baseNth', './rest', './toInteger'], function(baseNth, rest, toInteger) {
|
||||
|
||||
/**
|
||||
* Creates a function that gets the argument at `n` index. If `n` is negative,
|
||||
* Creates a function that gets the argument at index `n`. If `n` is negative,
|
||||
* the nth argument from the end is returned.
|
||||
*
|
||||
* @static
|
||||
|
||||
2
over.js
2
over.js
@@ -13,7 +13,7 @@ define(['./_arrayMap', './_createOver'], function(arrayMap, createOver) {
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
* var func = _.over(Math.max, Math.min);
|
||||
* var func = _.over([Math.max, Math.min]);
|
||||
*
|
||||
* func(1, 2, 3, 4);
|
||||
* // => [4, 1]
|
||||
|
||||
@@ -27,7 +27,7 @@ define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './_base
|
||||
*
|
||||
* var func = _.overArgs(function(x, y) {
|
||||
* return [x, y];
|
||||
* }, square, doubled);
|
||||
* }, [square, doubled]);
|
||||
*
|
||||
* func(9, 3);
|
||||
* // => [81, 6]
|
||||
|
||||
@@ -13,7 +13,7 @@ define(['./_arrayEvery', './_createOver'], function(arrayEvery, createOver) {
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
* var func = _.overEvery(Boolean, isFinite);
|
||||
* var func = _.overEvery([Boolean, isFinite]);
|
||||
*
|
||||
* func('1');
|
||||
* // => true
|
||||
|
||||
@@ -13,7 +13,7 @@ define(['./_arraySome', './_createOver'], function(arraySome, createOver) {
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
* var func = _.overSome(Boolean, isFinite);
|
||||
* var func = _.overSome([Boolean, isFinite]);
|
||||
*
|
||||
* func('1');
|
||||
* // => true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash-amd",
|
||||
"version": "4.12.0",
|
||||
"version": "4.13.0",
|
||||
"description": "Lodash exported as AMD modules.",
|
||||
"keywords": "amd, modules, stdlib, util",
|
||||
"homepage": "https://lodash.com/custom-builds",
|
||||
|
||||
6
pull.js
6
pull.js
@@ -17,11 +17,11 @@ define(['./pullAll', './rest'], function(pullAll, rest) {
|
||||
* @returns {Array} Returns `array`.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2, 3, 1, 2, 3];
|
||||
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
||||
*
|
||||
* _.pull(array, 2, 3);
|
||||
* _.pull(array, 'a', 'c');
|
||||
* console.log(array);
|
||||
* // => [1, 1]
|
||||
* // => ['b', 'b']
|
||||
*/
|
||||
var pull = rest(pullAll);
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ define(['./_basePullAll'], function(basePullAll) {
|
||||
* @returns {Array} Returns `array`.
|
||||
* @example
|
||||
*
|
||||
* var array = [1, 2, 3, 1, 2, 3];
|
||||
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
||||
*
|
||||
* _.pullAll(array, [2, 3]);
|
||||
* _.pullAll(array, ['a', 'c']);
|
||||
* console.log(array);
|
||||
* // => [1, 1]
|
||||
* // => ['b', 'b']
|
||||
*/
|
||||
function pullAll(array, values) {
|
||||
return (array && array.length && values && values.length)
|
||||
|
||||
10
pullAt.js
10
pullAt.js
@@ -15,14 +15,14 @@ define(['./_arrayMap', './_baseAt', './_baseFlatten', './_basePullAt', './_compa
|
||||
* @returns {Array} Returns the new array of removed elements.
|
||||
* @example
|
||||
*
|
||||
* var array = [5, 10, 15, 20];
|
||||
* var evens = _.pullAt(array, 1, 3);
|
||||
* var array = ['a', 'b', 'c', 'd'];
|
||||
* var pulled = _.pullAt(array, [1, 3]);
|
||||
*
|
||||
* console.log(array);
|
||||
* // => [5, 15]
|
||||
* // => ['a', 'c']
|
||||
*
|
||||
* console.log(evens);
|
||||
* // => [10, 20]
|
||||
* console.log(pulled);
|
||||
* // => ['b', 'd']
|
||||
*/
|
||||
var pullAt = rest(function(array, indexes) {
|
||||
indexes = baseFlatten(indexes, 1);
|
||||
|
||||
2
rearg.js
2
rearg.js
@@ -23,7 +23,7 @@ define(['./_baseFlatten', './_createWrapper', './rest'], function(baseFlatten, c
|
||||
*
|
||||
* var rearged = _.rearg(function(a, b, c) {
|
||||
* return [a, b, c];
|
||||
* }, 2, 0, 1);
|
||||
* }, [2, 0, 1]);
|
||||
*
|
||||
* rearged('b', 'c', 'a')
|
||||
* // => ['a', 'b', 'c']
|
||||
|
||||
@@ -16,9 +16,6 @@ define(['./_baseSortedIndex'], function(baseSortedIndex) {
|
||||
*
|
||||
* _.sortedIndex([30, 50], 40);
|
||||
* // => 1
|
||||
*
|
||||
* _.sortedIndex([4, 5], 4);
|
||||
* // => 0
|
||||
*/
|
||||
function sortedIndex(array, value) {
|
||||
return baseSortedIndex(array, value);
|
||||
|
||||
@@ -17,13 +17,13 @@ define(['./_baseIteratee', './_baseSortedIndexBy'], function(baseIteratee, baseS
|
||||
* into `array`.
|
||||
* @example
|
||||
*
|
||||
* var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };
|
||||
* var objects = [{ 'x': 4 }, { 'x': 5 }];
|
||||
*
|
||||
* _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));
|
||||
* // => 1
|
||||
* _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
||||
* // => 0
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
|
||||
* _.sortedIndexBy(objects, { 'x': 4 }, 'x');
|
||||
* // => 0
|
||||
*/
|
||||
function sortedIndexBy(array, value, iteratee) {
|
||||
|
||||
@@ -13,8 +13,8 @@ define(['./_baseSortedIndex', './eq'], function(baseSortedIndex, eq) {
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
* @example
|
||||
*
|
||||
* _.sortedIndexOf([1, 1, 2, 2], 2);
|
||||
* // => 2
|
||||
* _.sortedIndexOf([4, 5, 5, 5, 6], 5);
|
||||
* // => 1
|
||||
*/
|
||||
function sortedIndexOf(array, value) {
|
||||
var length = array ? array.length : 0;
|
||||
|
||||
@@ -15,8 +15,8 @@ define(['./_baseSortedIndex'], function(baseSortedIndex) {
|
||||
* into `array`.
|
||||
* @example
|
||||
*
|
||||
* _.sortedLastIndex([4, 5], 4);
|
||||
* // => 1
|
||||
* _.sortedLastIndex([4, 5, 5, 5, 6], 5);
|
||||
* // => 4
|
||||
*/
|
||||
function sortedLastIndex(array, value) {
|
||||
return baseSortedIndex(array, value, true);
|
||||
|
||||
@@ -17,8 +17,13 @@ define(['./_baseIteratee', './_baseSortedIndexBy'], function(baseIteratee, baseS
|
||||
* into `array`.
|
||||
* @example
|
||||
*
|
||||
* var objects = [{ 'x': 4 }, { 'x': 5 }];
|
||||
*
|
||||
* _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
||||
* // => 1
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
|
||||
* _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
|
||||
* // => 1
|
||||
*/
|
||||
function sortedLastIndexBy(array, value, iteratee) {
|
||||
|
||||
@@ -13,7 +13,7 @@ define(['./_baseSortedIndex', './eq'], function(baseSortedIndex, eq) {
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
* @example
|
||||
*
|
||||
* _.sortedLastIndexOf([1, 1, 2, 2], 2);
|
||||
* _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
|
||||
* // => 3
|
||||
*/
|
||||
function sortedLastIndexOf(array, value) {
|
||||
|
||||
26
stubArray.js
Normal file
26
stubArray.js
Normal file
@@ -0,0 +1,26 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* A method that returns a new empty array.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {Array} Returns the new empty array.
|
||||
* @example
|
||||
*
|
||||
* var arrays = _.times(2, _.stubArray);
|
||||
*
|
||||
* console.log(arrays);
|
||||
* // => [[], []]
|
||||
*
|
||||
* console.log(arrays[0] === arrays[1]);
|
||||
* // => false
|
||||
*/
|
||||
function stubArray() {
|
||||
return [];
|
||||
}
|
||||
|
||||
return stubArray;
|
||||
});
|
||||
21
stubFalse.js
Normal file
21
stubFalse.js
Normal file
@@ -0,0 +1,21 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* A method that returns `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {boolean} Returns `false`.
|
||||
* @example
|
||||
*
|
||||
* _.times(2, _.stubFalse);
|
||||
* // => [false, false]
|
||||
*/
|
||||
function stubFalse() {
|
||||
return false;
|
||||
}
|
||||
|
||||
return stubFalse;
|
||||
});
|
||||
26
stubObject.js
Normal file
26
stubObject.js
Normal file
@@ -0,0 +1,26 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* A method that returns a new empty object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {Object} Returns the new empty object.
|
||||
* @example
|
||||
*
|
||||
* var objects = _.times(2, _.stubObject);
|
||||
*
|
||||
* console.log(objects);
|
||||
* // => [{}, {}]
|
||||
*
|
||||
* console.log(objects[0] === objects[1]);
|
||||
* // => false
|
||||
*/
|
||||
function stubObject() {
|
||||
return {};
|
||||
}
|
||||
|
||||
return stubObject;
|
||||
});
|
||||
21
stubString.js
Normal file
21
stubString.js
Normal file
@@ -0,0 +1,21 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* A method that returns an empty string.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {string} Returns the empty string.
|
||||
* @example
|
||||
*
|
||||
* _.times(2, _.stubString);
|
||||
* // => ['', '']
|
||||
*/
|
||||
function stubString() {
|
||||
return '';
|
||||
}
|
||||
|
||||
return stubString;
|
||||
});
|
||||
21
stubTrue.js
Normal file
21
stubTrue.js
Normal file
@@ -0,0 +1,21 @@
|
||||
define([], function() {
|
||||
|
||||
/**
|
||||
* A method that returns `true`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.13.0
|
||||
* @category Util
|
||||
* @returns {boolean} Returns `true`.
|
||||
* @example
|
||||
*
|
||||
* _.times(2, _.stubTrue);
|
||||
* // => [true, true]
|
||||
*/
|
||||
function stubTrue() {
|
||||
return true;
|
||||
}
|
||||
|
||||
return stubTrue;
|
||||
});
|
||||
4
times.js
4
times.js
@@ -25,8 +25,8 @@ define(['./_baseIteratee', './_baseTimes', './toInteger'], function(baseIteratee
|
||||
* _.times(3, String);
|
||||
* // => ['0', '1', '2']
|
||||
*
|
||||
* _.times(4, _.constant(true));
|
||||
* // => [true, true, true, true]
|
||||
* _.times(4, _.constant(0));
|
||||
* // => [0, 0, 0, 0]
|
||||
*/
|
||||
function times(n, iteratee) {
|
||||
n = toInteger(n);
|
||||
|
||||
@@ -3,7 +3,7 @@ define(['./toFinite'], function(toFinite) {
|
||||
/**
|
||||
* Converts `value` to an integer.
|
||||
*
|
||||
* **Note:** This function is loosely based on
|
||||
* **Note:** This method is loosely based on
|
||||
* [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -16,15 +16,6 @@ define(['./_arrayMap', './_copyArray', './isArray', './isSymbol', './_stringToPa
|
||||
*
|
||||
* _.toPath('a[0].b.c');
|
||||
* // => ['a', '0', 'b', 'c']
|
||||
*
|
||||
* var path = ['a', 'b', 'c'],
|
||||
* newPath = _.toPath(path);
|
||||
*
|
||||
* console.log(newPath);
|
||||
* // => ['a', 'b', 'c']
|
||||
*
|
||||
* console.log(path === newPath);
|
||||
* // => false
|
||||
*/
|
||||
function toPath(value) {
|
||||
if (isArray(value)) {
|
||||
|
||||
@@ -4,15 +4,16 @@ define(['./_arrayEach', './_baseCreate', './_baseForOwn', './_baseIteratee', './
|
||||
* An alternative to `_.reduce`; this method transforms `object` to a new
|
||||
* `accumulator` object which is the result of running each of its own
|
||||
* enumerable string keyed properties thru `iteratee`, with each invocation
|
||||
* potentially mutating the `accumulator` object. The iteratee is invoked
|
||||
* with four arguments: (accumulator, value, key, object). Iteratee functions
|
||||
* may exit iteration early by explicitly returning `false`.
|
||||
* potentially mutating the `accumulator` object. If `accumulator` is not
|
||||
* provided, a new object with the same `[[Prototype]]` will be used. The
|
||||
* iteratee is invoked with four arguments: (accumulator, value, key, object).
|
||||
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 1.3.0
|
||||
* @category Object
|
||||
* @param {Array|Object} object The object to iterate over.
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
||||
* @param {*} [accumulator] The custom accumulator value.
|
||||
* @returns {*} Returns the accumulated value.
|
||||
|
||||
4
union.js
4
union.js
@@ -13,8 +13,8 @@ define(['./_baseFlatten', './_baseUniq', './isArrayLikeObject', './rest'], funct
|
||||
* @returns {Array} Returns the new array of combined values.
|
||||
* @example
|
||||
*
|
||||
* _.union([2, 1], [4, 2], [1, 2]);
|
||||
* // => [2, 1, 4]
|
||||
* _.union([2], [1, 2]);
|
||||
* // => [2, 1]
|
||||
*/
|
||||
var union = rest(function(arrays) {
|
||||
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
|
||||
|
||||
@@ -19,8 +19,8 @@ define(['./_baseFlatten', './_baseIteratee', './_baseUniq', './isArrayLikeObject
|
||||
* @returns {Array} Returns the new array of combined values.
|
||||
* @example
|
||||
*
|
||||
* _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
||||
* // => [2.1, 1.2, 4.3]
|
||||
* _.unionBy([2.1], [1.2, 2.3], Math.floor);
|
||||
* // => [2.1, 1.2]
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
||||
|
||||
@@ -17,7 +17,7 @@ define(['./_baseUniq'], function(baseUniq) {
|
||||
* @returns {Array} Returns the new duplicate free array.
|
||||
* @example
|
||||
*
|
||||
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
||||
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
||||
*
|
||||
* _.uniqWith(objects, _.isEqual);
|
||||
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
|
||||
|
||||
7
util.js
7
util.js
@@ -1,4 +1,4 @@
|
||||
define(['./attempt', './bindAll', './cond', './conforms', './constant', './flow', './flowRight', './identity', './iteratee', './matches', './matchesProperty', './method', './methodOf', './mixin', './noop', './nthArg', './over', './overEvery', './overSome', './property', './propertyOf', './range', './rangeRight', './times', './toPath', './uniqueId'], function(attempt, bindAll, cond, conforms, constant, flow, flowRight, identity, iteratee, matches, matchesProperty, method, methodOf, mixin, noop, nthArg, over, overEvery, overSome, property, propertyOf, range, rangeRight, times, toPath, uniqueId) {
|
||||
define(['./attempt', './bindAll', './cond', './conforms', './constant', './flow', './flowRight', './identity', './iteratee', './matches', './matchesProperty', './method', './methodOf', './mixin', './noop', './nthArg', './over', './overEvery', './overSome', './property', './propertyOf', './range', './rangeRight', './stubArray', './stubFalse', './stubObject', './stubString', './stubTrue', './times', './toPath', './uniqueId'], function(attempt, bindAll, cond, conforms, constant, flow, flowRight, identity, iteratee, matches, matchesProperty, method, methodOf, mixin, noop, nthArg, over, overEvery, overSome, property, propertyOf, range, rangeRight, stubArray, stubFalse, stubObject, stubString, stubTrue, times, toPath, uniqueId) {
|
||||
return {
|
||||
'attempt': attempt,
|
||||
'bindAll': bindAll,
|
||||
@@ -23,6 +23,11 @@ define(['./attempt', './bindAll', './cond', './conforms', './constant', './flow'
|
||||
'propertyOf': propertyOf,
|
||||
'range': range,
|
||||
'rangeRight': rangeRight,
|
||||
'stubArray': stubArray,
|
||||
'stubFalse': stubFalse,
|
||||
'stubObject': stubObject,
|
||||
'stubString': stubString,
|
||||
'stubTrue': stubTrue,
|
||||
'times': times,
|
||||
'toPath': toPath,
|
||||
'uniqueId': uniqueId
|
||||
|
||||
@@ -15,7 +15,7 @@ define(['./_baseDifference', './isArrayLikeObject', './rest'], function(baseDiff
|
||||
* @see _.difference, _.xor
|
||||
* @example
|
||||
*
|
||||
* _.without([1, 2, 1, 3], 1, 2);
|
||||
* _.without([2, 1, 2, 3], 1, 2);
|
||||
* // => [3]
|
||||
*/
|
||||
var without = rest(function(array, values) {
|
||||
|
||||
@@ -18,9 +18,6 @@ define(['./_LazyWrapper', './_LodashWrapper', './_baseAt', './_baseFlatten', './
|
||||
*
|
||||
* _(object).at(['a[0].b.c', 'a[1]']).value();
|
||||
* // => [3, 4]
|
||||
*
|
||||
* _(['a', 'b', 'c']).at(0, 2).value();
|
||||
* // => ['a', 'c']
|
||||
*/
|
||||
var wrapperAt = rest(function(paths) {
|
||||
paths = baseFlatten(paths, 1);
|
||||
|
||||
@@ -81,19 +81,21 @@ define(['./_LazyWrapper', './_LodashWrapper', './_baseLodash', './isArray', './i
|
||||
* `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`,
|
||||
* `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`,
|
||||
* `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`,
|
||||
* `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,
|
||||
* `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`,
|
||||
* `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,
|
||||
* `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,
|
||||
* `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`,
|
||||
* `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`,
|
||||
* `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
|
||||
* `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
||||
* `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
|
||||
* `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toFinite`,
|
||||
* `toInteger`, `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`,
|
||||
* `toString`, `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`,
|
||||
* `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words`
|
||||
* `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
|
||||
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
|
||||
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
|
||||
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
|
||||
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
|
||||
* `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
|
||||
* `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
|
||||
* `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
|
||||
* `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
|
||||
* `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
|
||||
* `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
|
||||
* `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
|
||||
* `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
|
||||
* `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
|
||||
* `upperFirst`, `value`, and `words`
|
||||
*
|
||||
* @name _
|
||||
* @constructor
|
||||
|
||||
4
xor.js
4
xor.js
@@ -15,8 +15,8 @@ define(['./_arrayFilter', './_baseXor', './isArrayLikeObject', './rest'], functi
|
||||
* @see _.difference, _.without
|
||||
* @example
|
||||
*
|
||||
* _.xor([2, 1], [4, 2]);
|
||||
* // => [1, 4]
|
||||
* _.xor([2, 1], [2, 3]);
|
||||
* // => [1, 3]
|
||||
*/
|
||||
var xor = rest(function(arrays) {
|
||||
return baseXor(arrayFilter(arrays, isArrayLikeObject));
|
||||
|
||||
4
xorBy.js
4
xorBy.js
@@ -19,8 +19,8 @@ define(['./_arrayFilter', './_baseIteratee', './_baseXor', './isArrayLikeObject'
|
||||
* @returns {Array} Returns the new array of filtered values.
|
||||
* @example
|
||||
*
|
||||
* _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
||||
* // => [1.2, 4.3]
|
||||
* _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
||||
* // => [1.2, 3.4]
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
||||
|
||||
Reference in New Issue
Block a user