mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10d5566cf2 | ||
|
|
314048b069 |
11
README.md
11
README.md
@@ -1,4 +1,4 @@
|
||||
# lodash v3.9.1
|
||||
# lodash v3.9.3
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules.
|
||||
|
||||
@@ -28,7 +28,7 @@ var array = require('lodash/array');
|
||||
var chunk = require('lodash/array/chunk');
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/3.9.1-npm) for more details.
|
||||
See the [package source](https://github.com/lodash/lodash/tree/3.9.3-npm) for more details.
|
||||
|
||||
**Note:**<br>
|
||||
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br>
|
||||
@@ -39,15 +39,14 @@ Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash b
|
||||
lodash is also available in a variety of other builds & module formats.
|
||||
|
||||
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds
|
||||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.9.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.9.1-amd) builds
|
||||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.9.1-es) build
|
||||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.9.3-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.9.3-amd) builds
|
||||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.9.3-es) build
|
||||
|
||||
## Further Reading
|
||||
|
||||
* [API Documentation](https://lodash.com/docs)
|
||||
* [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences)
|
||||
* [Changelog](https://github.com/lodash/lodash/wiki/Changelog)
|
||||
* [Release Notes](https://github.com/lodash/lodash/releases)
|
||||
* [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap)
|
||||
* [More Resources](https://github.com/lodash/lodash/wiki/Resources)
|
||||
|
||||
@@ -116,5 +115,5 @@ lodash is also available in a variety of other builds & module formats.
|
||||
|
||||
## Support
|
||||
|
||||
Tested in Chrome 41-42, Firefox 37-38, IE 6-11, MS Edge, Opera 28-29, Safari 5-8, ChakraNode 0.12.2, io.js 2.0.2, Node.js 0.8.28, 0.10.38, & 0.12.3, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7.6
|
||||
Tested in Chrome 41-42, Firefox 37-38, IE 6-11, MS Edge, Opera 28-29, Safari 5-8, ChakraNode 0.12.2, io.js 2.1.0, Node.js 0.8.28, 0.10.38, & 0.12.4, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7.6.
|
||||
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.
|
||||
|
||||
@@ -4,8 +4,8 @@ var baseDifference = require('../internal/baseDifference'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* Creates an array excluding all values of the provided arrays using
|
||||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* Creates an array of unique `array` values not included in the other
|
||||
* provided arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -5,8 +5,8 @@ var baseIndexOf = require('../internal/baseIndexOf'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* Creates an array of unique values in all provided arrays using
|
||||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* Creates an array of unique values that are included in all of the provided
|
||||
* arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -3,8 +3,8 @@ var baseFlatten = require('../internal/baseFlatten'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* Creates an array of unique values, in order, of the provided arrays using
|
||||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* Creates an array of unique values, in order, from all of the provided arrays
|
||||
* using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -3,7 +3,7 @@ var baseDifference = require('../internal/baseDifference'),
|
||||
isArrayLike = require('../internal/isArrayLike');
|
||||
|
||||
/**
|
||||
* Creates an array that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
||||
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
||||
* of the provided arrays.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var baseRandom = require('../internal/baseRandom'),
|
||||
isIterateeCall = require('../internal/isIterateeCall'),
|
||||
shuffle = require('./shuffle'),
|
||||
toArray = require('../lang/toArray'),
|
||||
toIterable = require('../internal/toIterable');
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
@@ -30,8 +30,20 @@ function sample(collection, n, guard) {
|
||||
var length = collection.length;
|
||||
return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
|
||||
}
|
||||
var result = shuffle(collection);
|
||||
result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length);
|
||||
var index = -1,
|
||||
result = toArray(collection),
|
||||
length = result.length,
|
||||
lastIndex = length - 1;
|
||||
|
||||
n = nativeMin(n < 0 ? 0 : (+n || 0), length);
|
||||
while (++index < n) {
|
||||
var rand = baseRandom(index, lastIndex),
|
||||
value = result[rand];
|
||||
|
||||
result[rand] = result[index];
|
||||
result[index] = value;
|
||||
}
|
||||
result.length = n;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
var baseRandom = require('../internal/baseRandom'),
|
||||
toIterable = require('../internal/toIterable');
|
||||
var sample = require('./sample');
|
||||
|
||||
/** Used as references for `-Infinity` and `Infinity`. */
|
||||
var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
||||
|
||||
/**
|
||||
* Creates an array of shuffled values, using a version of the
|
||||
@@ -16,20 +18,7 @@ var baseRandom = require('../internal/baseRandom'),
|
||||
* // => [4, 1, 3, 2]
|
||||
*/
|
||||
function shuffle(collection) {
|
||||
collection = toIterable(collection);
|
||||
|
||||
var index = -1,
|
||||
length = collection.length,
|
||||
result = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
var rand = baseRandom(0, index);
|
||||
if (index != rand) {
|
||||
result[index] = result[rand];
|
||||
}
|
||||
result[rand] = collection[index];
|
||||
}
|
||||
return result;
|
||||
return sample(collection, POSITIVE_INFINITY);
|
||||
}
|
||||
|
||||
module.exports = shuffle;
|
||||
|
||||
154
index.js
154
index.js
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license
|
||||
* lodash 3.9.1 (Custom Build) <https://lodash.com/>
|
||||
* lodash 3.9.3 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modern -d -o ./index.js`
|
||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
@@ -13,7 +13,7 @@
|
||||
var undefined;
|
||||
|
||||
/** Used as the semantic version number. */
|
||||
var VERSION = '3.9.1';
|
||||
var VERSION = '3.9.3';
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var BIND_FLAG = 1,
|
||||
@@ -118,6 +118,9 @@
|
||||
/** Used to detect host constructors (Safari > 5). */
|
||||
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||
|
||||
/** Used to detect unsigned integer values. */
|
||||
var reIsUint = /^\d+$/;
|
||||
|
||||
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */
|
||||
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
||||
|
||||
@@ -152,9 +155,8 @@
|
||||
'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
||||
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
|
||||
'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document',
|
||||
'isFinite', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
|
||||
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
|
||||
'window'
|
||||
'isFinite', 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
|
||||
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 'window'
|
||||
];
|
||||
|
||||
/** Used to make template sourceURLs easier to identify. */
|
||||
@@ -280,6 +282,8 @@
|
||||
*/
|
||||
var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The base implementation of `compareAscending` which compares values and
|
||||
* sorts them in ascending order without guaranteeing a stable sort.
|
||||
@@ -648,6 +652,8 @@
|
||||
return htmlUnescapes[chr];
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Create a new pristine `lodash` function using the given `context` object.
|
||||
*
|
||||
@@ -741,6 +747,7 @@
|
||||
clearTimeout = context.clearTimeout,
|
||||
floor = Math.floor,
|
||||
getPrototypeOf = getNative(Object, 'getPrototypeOf'),
|
||||
parseFloat = context.parseFloat,
|
||||
push = arrayProto.push,
|
||||
Set = getNative(context, 'Set'),
|
||||
setTimeout = context.setTimeout,
|
||||
@@ -773,7 +780,8 @@
|
||||
nativeRandom = Math.random;
|
||||
|
||||
/** Used as references for `-Infinity` and `Infinity`. */
|
||||
var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
||||
var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,
|
||||
POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
||||
|
||||
/** Used as references for the maximum length and index of an array. */
|
||||
var MAX_ARRAY_LENGTH = 4294967295,
|
||||
@@ -795,6 +803,8 @@
|
||||
/** Used to lookup unminified function names. */
|
||||
var realNames = {};
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a `lodash` object which wraps `value` to enable implicit chaining.
|
||||
* Methods that operate on and return arrays, collections, and functions can
|
||||
@@ -1015,6 +1025,8 @@
|
||||
}
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
|
||||
*
|
||||
@@ -1143,6 +1155,8 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a cache object to store key/value pairs.
|
||||
*
|
||||
@@ -1211,6 +1225,8 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Creates a cache object to store unique values.
|
||||
@@ -1260,6 +1276,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Copies the values of `source` to `array`.
|
||||
*
|
||||
@@ -1343,7 +1361,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* A specialized version of `baseExtremum` for arrays whichs invokes `iteratee`
|
||||
* A specialized version of `baseExtremum` for arrays which invokes `iteratee`
|
||||
* with one argument: (value).
|
||||
*
|
||||
* @private
|
||||
@@ -2115,7 +2133,7 @@
|
||||
if (value === other) {
|
||||
return true;
|
||||
}
|
||||
if (value == null || other == null || (!isObject(value) && !isObject(other))) {
|
||||
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
|
||||
return value !== value && other !== other;
|
||||
}
|
||||
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
|
||||
@@ -2292,8 +2310,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.matchesProperty` which does not which does
|
||||
* not clone `value`.
|
||||
* The base implementation of `_.matchesProperty` which does not clone `srcValue`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} path The path of the property to get.
|
||||
@@ -4058,7 +4075,7 @@
|
||||
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
||||
*/
|
||||
function isIndex(value, length) {
|
||||
value = typeof value == 'number' ? value : parseFloat(value);
|
||||
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
|
||||
length = length == null ? MAX_SAFE_INTEGER : length;
|
||||
return value > -1 && value % 1 == 0 && value < length;
|
||||
}
|
||||
@@ -4115,7 +4132,15 @@
|
||||
*/
|
||||
function isLaziable(func) {
|
||||
var funcName = getFuncName(func);
|
||||
return !!funcName && func === lodash[funcName] && funcName in LazyWrapper.prototype;
|
||||
if (!(funcName in LazyWrapper.prototype)) {
|
||||
return false;
|
||||
}
|
||||
var other = lodash[funcName];
|
||||
if (func === other) {
|
||||
return true;
|
||||
}
|
||||
var data = getData(other);
|
||||
return !!data && func === data[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4431,6 +4456,8 @@
|
||||
: new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates an array of elements split into groups the length of `size`.
|
||||
* If `collection` can't be split evenly, the final chunk will be the remaining
|
||||
@@ -4498,8 +4525,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array excluding all values of the provided arrays using
|
||||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* Creates an array of unique `array` values not included in the other
|
||||
* provided arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
@@ -4972,8 +4999,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array of unique values in all provided arrays using
|
||||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* Creates an array of unique values that are included in all of the provided
|
||||
* arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
@@ -5526,8 +5553,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array of unique values, in order, of the provided arrays using
|
||||
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* Creates an array of unique values, in order, from all of the provided arrays
|
||||
* using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @static
|
||||
@@ -5708,7 +5735,7 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates an array that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
||||
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
||||
* of the provided arrays.
|
||||
*
|
||||
* @static
|
||||
@@ -5825,6 +5852,8 @@
|
||||
return unzipWith(arrays, iteratee, thisArg);
|
||||
});
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a `lodash` object that wraps `value` with explicit method
|
||||
* chaining enabled.
|
||||
@@ -6075,6 +6104,8 @@
|
||||
return baseWrapperValue(this.__wrapped__, this.__actions__);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates an array of elements corresponding to the given keys, or indexes,
|
||||
* of `collection`. Keys may be specified as individual arguments or as arrays
|
||||
@@ -6882,8 +6913,20 @@
|
||||
var length = collection.length;
|
||||
return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
|
||||
}
|
||||
var result = shuffle(collection);
|
||||
result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length);
|
||||
var index = -1,
|
||||
result = toArray(collection),
|
||||
length = result.length,
|
||||
lastIndex = length - 1;
|
||||
|
||||
n = nativeMin(n < 0 ? 0 : (+n || 0), length);
|
||||
while (++index < n) {
|
||||
var rand = baseRandom(index, lastIndex),
|
||||
value = result[rand];
|
||||
|
||||
result[rand] = result[index];
|
||||
result[index] = value;
|
||||
}
|
||||
result.length = n;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -6902,20 +6945,7 @@
|
||||
* // => [4, 1, 3, 2]
|
||||
*/
|
||||
function shuffle(collection) {
|
||||
collection = toIterable(collection);
|
||||
|
||||
var index = -1,
|
||||
length = collection.length,
|
||||
result = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
var rand = baseRandom(0, index);
|
||||
if (index != rand) {
|
||||
result[index] = result[rand];
|
||||
}
|
||||
result[rand] = collection[index];
|
||||
}
|
||||
return result;
|
||||
return sample(collection, POSITIVE_INFINITY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7196,6 +7226,8 @@
|
||||
return filter(collection, baseMatches(source));
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Gets the number of milliseconds that have elapsed since the Unix epoch
|
||||
* (1 January 1970 00:00:00 UTC).
|
||||
@@ -7214,6 +7246,8 @@
|
||||
return new Date().getTime();
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The opposite of `_.before`; this method creates a function that invokes
|
||||
* `func` once it is called `n` or more times.
|
||||
@@ -8194,6 +8228,8 @@
|
||||
return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
|
||||
* otherwise they are assigned by reference. If `customizer` is provided it is
|
||||
@@ -9025,6 +9061,8 @@
|
||||
return baseCopy(value, keysIn(value));
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Assigns own enumerable properties of source object(s) to the destination
|
||||
* object. Subsequent sources overwrite property assignments of previous sources.
|
||||
@@ -9858,13 +9896,13 @@
|
||||
|
||||
var index = -1,
|
||||
length = path.length,
|
||||
endIndex = length - 1,
|
||||
lastIndex = length - 1,
|
||||
nested = object;
|
||||
|
||||
while (nested != null && ++index < length) {
|
||||
var key = path[index];
|
||||
if (isObject(nested)) {
|
||||
if (index == endIndex) {
|
||||
if (index == lastIndex) {
|
||||
nested[key] = value;
|
||||
} else if (nested[key] == null) {
|
||||
nested[key] = isIndex(path[index + 1]) ? [] : {};
|
||||
@@ -9982,6 +10020,8 @@
|
||||
return baseValues(object, keysIn(object));
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Checks if `n` is between `start` and up to but not including, `end`. If
|
||||
* `end` is not specified it is set to `start` with `start` then set to `0`.
|
||||
@@ -10086,6 +10126,8 @@
|
||||
return baseRandom(min, max);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
|
||||
*
|
||||
@@ -10951,6 +10993,8 @@
|
||||
return string.match(pattern || reWords) || [];
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Attempts to invoke `func`, returning either the result or the caught error
|
||||
* object. Any additional arguments are provided to `func` when it is invoked.
|
||||
@@ -11068,7 +11112,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a function which performs a deep comparison between a given object
|
||||
* Creates a function that performs a deep comparison between a given object
|
||||
* and `source`, returning `true` if the given object has equivalent property
|
||||
* values, else `false`.
|
||||
*
|
||||
@@ -11097,7 +11141,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a function which compares the property value of `path` on a given
|
||||
* Creates a function that compares the property value of `path` on a given
|
||||
* object to `value`.
|
||||
*
|
||||
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
|
||||
@@ -11125,12 +11169,14 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a function which invokes the method at `path` on a given object.
|
||||
* Creates a function that invokes the method at `path` on a given object.
|
||||
* Any additional arguments are provided to the invoked method.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Utility
|
||||
* @param {Array|string} path The path of the method to invoke.
|
||||
* @param {...*} [args] The arguments to invoke the method with.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
@@ -11152,13 +11198,15 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* The opposite of `_.method`; this method creates a function which invokes
|
||||
* the method at a given path on `object`.
|
||||
* The opposite of `_.method`; this method creates a function that invokes
|
||||
* the method at a given path on `object`. Any additional arguments are
|
||||
* provided to the invoked method.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Utility
|
||||
* @param {Object} object The object to query.
|
||||
* @param {...*} [args] The arguments to invoke the method with.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
@@ -11284,7 +11332,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* A no-operation function which returns `undefined` regardless of the
|
||||
* A no-operation function that returns `undefined` regardless of the
|
||||
* arguments it receives.
|
||||
*
|
||||
* @static
|
||||
@@ -11302,7 +11350,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a function which returns the property value at `path` on a
|
||||
* Creates a function that returns the property value at `path` on a
|
||||
* given object.
|
||||
*
|
||||
* @static
|
||||
@@ -11328,7 +11376,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* The opposite of `_.property`; this method creates a function which returns
|
||||
* The opposite of `_.property`; this method creates a function that returns
|
||||
* the property value at a given path on `object`.
|
||||
*
|
||||
* @static
|
||||
@@ -11482,6 +11530,8 @@
|
||||
return baseToString(prefix) + id;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Adds two numbers.
|
||||
*
|
||||
@@ -11547,7 +11597,7 @@
|
||||
* _.max(users, 'age');
|
||||
* // => { 'user': 'fred', 'age': 40 }
|
||||
*/
|
||||
var max = createExtremum(gt, -Infinity);
|
||||
var max = createExtremum(gt, NEGATIVE_INFINITY);
|
||||
|
||||
/**
|
||||
* Gets the minimum value of `collection`. If `collection` is empty or falsey
|
||||
@@ -11596,7 +11646,7 @@
|
||||
* _.min(users, 'age');
|
||||
* // => { 'user': 'barney', 'age': 36 }
|
||||
*/
|
||||
var min = createExtremum(lt, Infinity);
|
||||
var min = createExtremum(lt, POSITIVE_INFINITY);
|
||||
|
||||
/**
|
||||
* Gets the sum of the values in `collection`.
|
||||
@@ -11646,6 +11696,8 @@
|
||||
: baseSum(collection, iteratee);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
// Ensure wrappers are instances of `baseLodash`.
|
||||
lodash.prototype = baseLodash.prototype;
|
||||
|
||||
@@ -11793,6 +11845,8 @@
|
||||
// Add functions to `lodash.prototype`.
|
||||
mixin(lodash, lodash);
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
// Add functions that return unwrapped values when chaining.
|
||||
lodash.add = add;
|
||||
lodash.attempt = attempt;
|
||||
@@ -11901,6 +11955,8 @@
|
||||
return source;
|
||||
}()), false);
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
// Add functions capable of returning wrapped and unwrapped values when chaining.
|
||||
lodash.sample = sample;
|
||||
|
||||
@@ -11913,6 +11969,8 @@
|
||||
});
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The semantic version number.
|
||||
*
|
||||
@@ -12140,6 +12198,8 @@
|
||||
return lodash;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// Export lodash.
|
||||
var _ = runInContext();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* A specialized version of `baseExtremum` for arrays whichs invokes `iteratee`
|
||||
* A specialized version of `baseExtremum` for arrays which invokes `iteratee`
|
||||
* with one argument: (value).
|
||||
*
|
||||
* @private
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
var baseIsEqualDeep = require('./baseIsEqualDeep'),
|
||||
isObject = require('../lang/isObject');
|
||||
isObject = require('../lang/isObject'),
|
||||
isObjectLike = require('./isObjectLike');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.isEqual` without support for `this` binding
|
||||
@@ -18,7 +19,7 @@ function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
|
||||
if (value === other) {
|
||||
return true;
|
||||
}
|
||||
if (value == null || other == null || (!isObject(value) && !isObject(other))) {
|
||||
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
|
||||
return value !== value && other !== other;
|
||||
}
|
||||
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
|
||||
|
||||
@@ -9,8 +9,7 @@ var baseGet = require('./baseGet'),
|
||||
toPath = require('./toPath');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.matchesProperty` which does not which does
|
||||
* not clone `value`.
|
||||
* The base implementation of `_.matchesProperty` which does not clone `srcValue`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} path The path of the property to get.
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/** Used to detect unsigned integer values. */
|
||||
var reIsUint = /^\d+$/;
|
||||
|
||||
/**
|
||||
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
|
||||
* of an array-like value.
|
||||
@@ -13,7 +16,7 @@ var MAX_SAFE_INTEGER = 9007199254740991;
|
||||
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
||||
*/
|
||||
function isIndex(value, length) {
|
||||
value = typeof value == 'number' ? value : parseFloat(value);
|
||||
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
|
||||
length = length == null ? MAX_SAFE_INTEGER : length;
|
||||
return value > -1 && value % 1 == 0 && value < length;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
var LazyWrapper = require('./LazyWrapper'),
|
||||
getData = require('./getData'),
|
||||
getFuncName = require('./getFuncName'),
|
||||
lodash = require('../chain/lodash');
|
||||
|
||||
@@ -11,7 +12,15 @@ var LazyWrapper = require('./LazyWrapper'),
|
||||
*/
|
||||
function isLaziable(func) {
|
||||
var funcName = getFuncName(func);
|
||||
return !!funcName && func === lodash[funcName] && funcName in LazyWrapper.prototype;
|
||||
if (!(funcName in LazyWrapper.prototype)) {
|
||||
return false;
|
||||
}
|
||||
var other = lodash[funcName];
|
||||
if (func === other) {
|
||||
return true;
|
||||
}
|
||||
var data = getData(other);
|
||||
return !!data && func === data[0];
|
||||
}
|
||||
|
||||
module.exports = isLaziable;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
var createExtremum = require('../internal/createExtremum'),
|
||||
gt = require('../lang/gt');
|
||||
|
||||
/** Used as references for `-Infinity` and `Infinity`. */
|
||||
var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
|
||||
|
||||
/**
|
||||
* Gets the maximum value of `collection`. If `collection` is empty or falsey
|
||||
* `-Infinity` is returned. If an iteratee function is provided it is invoked
|
||||
@@ -48,6 +51,6 @@ var createExtremum = require('../internal/createExtremum'),
|
||||
* _.max(users, 'age');
|
||||
* // => { 'user': 'fred', 'age': 40 }
|
||||
*/
|
||||
var max = createExtremum(gt, -Infinity);
|
||||
var max = createExtremum(gt, NEGATIVE_INFINITY);
|
||||
|
||||
module.exports = max;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
var createExtremum = require('../internal/createExtremum'),
|
||||
lt = require('../lang/lt');
|
||||
|
||||
/** Used as references for `-Infinity` and `Infinity`. */
|
||||
var POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
||||
|
||||
/**
|
||||
* Gets the minimum value of `collection`. If `collection` is empty or falsey
|
||||
* `Infinity` is returned. If an iteratee function is provided it is invoked
|
||||
@@ -48,6 +51,6 @@ var createExtremum = require('../internal/createExtremum'),
|
||||
* _.min(users, 'age');
|
||||
* // => { 'user': 'barney', 'age': 36 }
|
||||
*/
|
||||
var min = createExtremum(lt, Infinity);
|
||||
var min = createExtremum(lt, POSITIVE_INFINITY);
|
||||
|
||||
module.exports = min;
|
||||
|
||||
@@ -35,13 +35,13 @@ function set(object, path, value) {
|
||||
|
||||
var index = -1,
|
||||
length = path.length,
|
||||
endIndex = length - 1,
|
||||
lastIndex = length - 1,
|
||||
nested = object;
|
||||
|
||||
while (nested != null && ++index < length) {
|
||||
var key = path[index];
|
||||
if (isObject(nested)) {
|
||||
if (index == endIndex) {
|
||||
if (index == lastIndex) {
|
||||
nested[key] = value;
|
||||
} else if (nested[key] == null) {
|
||||
nested[key] = isIndex(path[index + 1]) ? [] : {};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash",
|
||||
"version": "3.9.1",
|
||||
"version": "3.9.3",
|
||||
"description": "The modern build of lodash modular utilities.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
|
||||
@@ -2,7 +2,7 @@ var baseClone = require('../internal/baseClone'),
|
||||
baseMatches = require('../internal/baseMatches');
|
||||
|
||||
/**
|
||||
* Creates a function which performs a deep comparison between a given object
|
||||
* Creates a function that performs a deep comparison between a given object
|
||||
* and `source`, returning `true` if the given object has equivalent property
|
||||
* values, else `false`.
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@ var baseClone = require('../internal/baseClone'),
|
||||
baseMatchesProperty = require('../internal/baseMatchesProperty');
|
||||
|
||||
/**
|
||||
* Creates a function which compares the property value of `path` on a given
|
||||
* Creates a function that compares the property value of `path` on a given
|
||||
* object to `value`.
|
||||
*
|
||||
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
|
||||
|
||||
@@ -2,12 +2,14 @@ var invokePath = require('../internal/invokePath'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* Creates a function which invokes the method at `path` on a given object.
|
||||
* Creates a function that invokes the method at `path` on a given object.
|
||||
* Any additional arguments are provided to the invoked method.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Utility
|
||||
* @param {Array|string} path The path of the method to invoke.
|
||||
* @param {...*} [args] The arguments to invoke the method with.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -2,13 +2,15 @@ var invokePath = require('../internal/invokePath'),
|
||||
restParam = require('../function/restParam');
|
||||
|
||||
/**
|
||||
* The opposite of `_.method`; this method creates a function which invokes
|
||||
* the method at a given path on `object`.
|
||||
* The opposite of `_.method`; this method creates a function that invokes
|
||||
* the method at a given path on `object`. Any additional arguments are
|
||||
* provided to the invoked method.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Utility
|
||||
* @param {Object} object The object to query.
|
||||
* @param {...*} [args] The arguments to invoke the method with.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* A no-operation function which returns `undefined` regardless of the
|
||||
* A no-operation function that returns `undefined` regardless of the
|
||||
* arguments it receives.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -3,7 +3,7 @@ var baseProperty = require('../internal/baseProperty'),
|
||||
isKey = require('../internal/isKey');
|
||||
|
||||
/**
|
||||
* Creates a function which returns the property value at `path` on a
|
||||
* Creates a function that returns the property value at `path` on a
|
||||
* given object.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -2,7 +2,7 @@ var baseGet = require('../internal/baseGet'),
|
||||
toPath = require('../internal/toPath');
|
||||
|
||||
/**
|
||||
* The opposite of `_.property`; this method creates a function which returns
|
||||
* The opposite of `_.property`; this method creates a function that returns
|
||||
* the property value at a given path on `object`.
|
||||
*
|
||||
* @static
|
||||
|
||||
Reference in New Issue
Block a user