mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ee2b9a7b8 | ||
|
|
3d3907ff27 |
@@ -1,4 +1,4 @@
|
||||
# lodash-es v3.9.0
|
||||
# lodash-es v3.9.3
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [ES](https://people.mozilla.org/~jorendorff/es6-draft.html) modules.
|
||||
|
||||
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
||||
$ lodash modularize modern exports=es -o ./
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/3.9.0-es) for more details.
|
||||
See the [package source](https://github.com/lodash/lodash/tree/3.9.3-es) for more details.
|
||||
|
||||
@@ -4,8 +4,8 @@ import isArrayLike from '../internal/isArrayLike';
|
||||
import restParam from '../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 @@ import isArrayLike from '../internal/isArrayLike';
|
||||
import restParam from '../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 @@ import baseUniq from '../internal/baseUniq';
|
||||
import restParam from '../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 @@ import baseUniq from '../internal/baseUniq';
|
||||
import isArrayLike from '../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 @@
|
||||
import baseRandom from '../internal/baseRandom';
|
||||
import isIterateeCall from '../internal/isIterateeCall';
|
||||
import shuffle from './shuffle';
|
||||
import toArray from '../lang/toArray';
|
||||
import toIterable from '../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 @@
|
||||
import baseRandom from '../internal/baseRandom';
|
||||
import toIterable from '../internal/toIterable';
|
||||
import sample from './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 @@ import toIterable from '../internal/toIterable';
|
||||
* // => [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);
|
||||
}
|
||||
|
||||
export default shuffle;
|
||||
|
||||
@@ -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 @@
|
||||
import baseIsEqualDeep from './baseIsEqualDeep';
|
||||
import isObject from '../lang/isObject';
|
||||
import isObjectLike from './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 @@ import toObject from './toObject';
|
||||
import toPath from './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 @@
|
||||
import LazyWrapper from './LazyWrapper';
|
||||
import getData from './getData';
|
||||
import getFuncName from './getFuncName';
|
||||
import lodash from '../chain/lodash';
|
||||
|
||||
@@ -11,7 +12,15 @@ import lodash from '../chain/lodash';
|
||||
*/
|
||||
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];
|
||||
}
|
||||
|
||||
export default isLaziable;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license
|
||||
* lodash 3.9.0 (Custom Build) <https://lodash.com/>
|
||||
* lodash 3.9.3 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize modern exports="es" -o ./`
|
||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
@@ -42,7 +42,7 @@ import support from './support';
|
||||
import thru from './chain/thru';
|
||||
|
||||
/** Used as the semantic version number. */
|
||||
var VERSION = '3.9.0';
|
||||
var VERSION = '3.9.3';
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var BIND_KEY_FLAG = 2;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import createExtremum from '../internal/createExtremum';
|
||||
import gt from '../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 @@ import gt from '../lang/gt';
|
||||
* _.max(users, 'age');
|
||||
* // => { 'user': 'fred', 'age': 40 }
|
||||
*/
|
||||
var max = createExtremum(gt, -Infinity);
|
||||
var max = createExtremum(gt, NEGATIVE_INFINITY);
|
||||
|
||||
export default max;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import createExtremum from '../internal/createExtremum';
|
||||
import lt from '../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 @@ import lt from '../lang/lt';
|
||||
* _.min(users, 'age');
|
||||
* // => { 'user': 'barney', 'age': 36 }
|
||||
*/
|
||||
var min = createExtremum(lt, Infinity);
|
||||
var min = createExtremum(lt, POSITIVE_INFINITY);
|
||||
|
||||
export default 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-es",
|
||||
"version": "3.9.0",
|
||||
"version": "3.9.3",
|
||||
"description": "The modern build of lodash exported as ES modules.",
|
||||
"homepage": "https://lodash.com/custom-builds",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -2,7 +2,7 @@ import baseClone from '../internal/baseClone';
|
||||
import baseMatches from '../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 @@ import baseClone from '../internal/baseClone';
|
||||
import baseMatchesProperty from '../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 @@ import invokePath from '../internal/invokePath';
|
||||
import restParam from '../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 @@ import invokePath from '../internal/invokePath';
|
||||
import restParam from '../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 @@ import basePropertyDeep from '../internal/basePropertyDeep';
|
||||
import isKey from '../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 @@ import baseGet from '../internal/baseGet';
|
||||
import toPath from '../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