mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Bump to v3.7.0.
This commit is contained in:
@@ -27,7 +27,8 @@ function intersection() {
|
||||
argsLength = arguments.length,
|
||||
caches = [],
|
||||
indexOf = baseIndexOf,
|
||||
isCommon = true;
|
||||
isCommon = true,
|
||||
result = [];
|
||||
|
||||
while (++argsIndex < argsLength) {
|
||||
var value = arguments[argsIndex];
|
||||
@@ -37,10 +38,12 @@ function intersection() {
|
||||
}
|
||||
}
|
||||
argsLength = args.length;
|
||||
if (argsLength < 2) {
|
||||
return result;
|
||||
}
|
||||
var array = args[0],
|
||||
index = -1,
|
||||
length = array ? array.length : 0,
|
||||
result = [],
|
||||
seen = caches[0];
|
||||
|
||||
outer:
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
import baseAt from '../internal/baseAt';
|
||||
import baseCompareAscending from '../internal/baseCompareAscending';
|
||||
import baseFlatten from '../internal/baseFlatten';
|
||||
import isIndex from '../internal/isIndex';
|
||||
import basePullAt from '../internal/basePullAt';
|
||||
import restParam from '../function/restParam';
|
||||
|
||||
/** Used for native method references. */
|
||||
var arrayProto = Array.prototype;
|
||||
|
||||
/** Native method references. */
|
||||
var splice = arrayProto.splice;
|
||||
|
||||
/**
|
||||
* Removes elements from `array` corresponding to the given indexes and returns
|
||||
* an array of the removed elements. Indexes may be specified as an array of
|
||||
@@ -39,17 +33,8 @@ var pullAt = restParam(function(array, indexes) {
|
||||
array || (array = []);
|
||||
indexes = baseFlatten(indexes);
|
||||
|
||||
var length = indexes.length,
|
||||
result = baseAt(array, indexes);
|
||||
|
||||
indexes.sort(baseCompareAscending);
|
||||
while (length--) {
|
||||
var index = parseFloat(indexes[length]);
|
||||
if (index != previous && isIndex(index)) {
|
||||
var previous = index;
|
||||
splice.call(array, index, 1);
|
||||
}
|
||||
}
|
||||
var result = baseAt(array, indexes);
|
||||
basePullAt(array, indexes.sort(baseCompareAscending));
|
||||
return result;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import baseCallback from '../internal/baseCallback';
|
||||
|
||||
/** Used for native method references. */
|
||||
var arrayProto = Array.prototype;
|
||||
|
||||
/** Native method references. */
|
||||
var splice = arrayProto.splice;
|
||||
import basePullAt from '../internal/basePullAt';
|
||||
|
||||
/**
|
||||
* Removes all elements from `array` that `predicate` returns truthy for
|
||||
@@ -46,19 +41,23 @@ var splice = arrayProto.splice;
|
||||
* // => [2, 4]
|
||||
*/
|
||||
function remove(array, predicate, thisArg) {
|
||||
var result = [];
|
||||
if (!(array && array.length)) {
|
||||
return result;
|
||||
}
|
||||
var index = -1,
|
||||
length = array ? array.length : 0,
|
||||
result = [];
|
||||
indexes = [],
|
||||
length = array.length;
|
||||
|
||||
predicate = baseCallback(predicate, thisArg, 3);
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
if (predicate(value, index, array)) {
|
||||
result.push(value);
|
||||
splice.call(array, index--, 1);
|
||||
length--;
|
||||
indexes.push(index);
|
||||
}
|
||||
}
|
||||
basePullAt(array, indexes);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import isIterateeCall from '../internal/isIterateeCall';
|
||||
/**
|
||||
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
||||
*
|
||||
* **Note:** This function is used instead of `Array#slice` to support node
|
||||
* **Note:** This method is used instead of `Array#slice` to support node
|
||||
* lists in IE < 9 and to ensure dense arrays are returned.
|
||||
*
|
||||
* @static
|
||||
|
||||
@@ -4,12 +4,13 @@ import isIterateeCall from '../internal/isIterateeCall';
|
||||
import sortedUniq from '../internal/sortedUniq';
|
||||
|
||||
/**
|
||||
* Creates a duplicate-value-free version of an array using `SameValueZero`
|
||||
* for equality comparisons. Providing `true` for `isSorted` performs a faster
|
||||
* search algorithm for sorted arrays. If an iteratee function is provided it
|
||||
* is invoked for each value in the array to generate the criterion by which
|
||||
* uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked
|
||||
* with three arguments: (value, index, array).
|
||||
* Creates a duplicate-free version of an array, using `SameValueZero` for
|
||||
* equality comparisons, in which only the first occurence of each element
|
||||
* is kept. Providing `true` for `isSorted` performs a faster search algorithm
|
||||
* for sorted arrays. If an iteratee function is provided it is invoked for
|
||||
* each element in the array to generate the criterion by which uniqueness
|
||||
* is computed. The `iteratee` is bound to `thisArg` and invoked with three
|
||||
* arguments: (value, index, array).
|
||||
*
|
||||
* If a property name is provided for `iteratee` the created `_.property`
|
||||
* style callback returns the property value of the given element.
|
||||
@@ -37,8 +38,8 @@ import sortedUniq from '../internal/sortedUniq';
|
||||
* @returns {Array} Returns the new duplicate-value-free array.
|
||||
* @example
|
||||
*
|
||||
* _.uniq([1, 2, 1]);
|
||||
* // => [1, 2]
|
||||
* _.uniq([2, 1, 2]);
|
||||
* // => [2, 1]
|
||||
*
|
||||
* // using `isSorted`
|
||||
* _.uniq([1, 1, 2], true);
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import arrayMap from '../internal/arrayMap';
|
||||
import arrayMax from '../internal/arrayMax';
|
||||
import baseProperty from '../internal/baseProperty';
|
||||
|
||||
/** Used to the length of n-tuples for `_.unzip`. */
|
||||
var getLength = baseProperty('length');
|
||||
import getLength from '../internal/getLength';
|
||||
|
||||
/**
|
||||
* This method is like `_.zip` except that it accepts an array of grouped
|
||||
|
||||
Reference in New Issue
Block a user