mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Bump to v3.4.0.
This commit is contained in:
@@ -24,16 +24,17 @@ import isArray from '../lang/isArray';
|
||||
* // => [1, 3]
|
||||
*/
|
||||
function difference() {
|
||||
var index = -1,
|
||||
length = arguments.length;
|
||||
var args = arguments,
|
||||
index = -1,
|
||||
length = args.length;
|
||||
|
||||
while (++index < length) {
|
||||
var value = arguments[index];
|
||||
var value = args[index];
|
||||
if (isArray(value) || isArguments(value)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return baseDifference(value, baseFlatten(arguments, false, true, ++index));
|
||||
return baseDifference(value, baseFlatten(args, false, true, ++index));
|
||||
}
|
||||
|
||||
export default difference;
|
||||
|
||||
@@ -39,7 +39,7 @@ import baseSlice from '../internal/baseSlice';
|
||||
* ];
|
||||
*
|
||||
* // using the `_.matches` callback shorthand
|
||||
* _.pluck(_.dropRightWhile(users, { 'user': pebbles, 'active': false }), 'user');
|
||||
* _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
|
||||
* // => ['barney', 'fred']
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
|
||||
@@ -42,7 +42,7 @@ import baseCallback from '../internal/baseCallback';
|
||||
*
|
||||
* // using the `_.matchesProperty` callback shorthand
|
||||
* _.findLastIndex(users, 'active', false);
|
||||
* // => 1
|
||||
* // => 2
|
||||
*
|
||||
* // using the `_.property` callback shorthand
|
||||
* _.findLastIndex(users, 'active');
|
||||
|
||||
@@ -26,7 +26,7 @@ function flatten(array, isDeep, guard) {
|
||||
if (guard && isIterateeCall(array, isDeep, guard)) {
|
||||
isDeep = false;
|
||||
}
|
||||
return length ? baseFlatten(array, isDeep) : [];
|
||||
return length ? baseFlatten(array, isDeep, false, 0) : [];
|
||||
}
|
||||
|
||||
export default flatten;
|
||||
|
||||
@@ -15,7 +15,7 @@ import baseFlatten from '../internal/baseFlatten';
|
||||
*/
|
||||
function flattenDeep(array) {
|
||||
var length = array ? array.length : 0;
|
||||
return length ? baseFlatten(array, true) : [];
|
||||
return length ? baseFlatten(array, true, false, 0) : [];
|
||||
}
|
||||
|
||||
export default flattenDeep;
|
||||
|
||||
@@ -42,14 +42,14 @@ function indexOf(array, value, fromIndex) {
|
||||
return -1;
|
||||
}
|
||||
if (typeof fromIndex == 'number') {
|
||||
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
|
||||
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
|
||||
} else if (fromIndex) {
|
||||
var index = binaryIndex(array, value),
|
||||
other = array[index];
|
||||
|
||||
return (value === value ? value === other : other !== other) ? index : -1;
|
||||
}
|
||||
return baseIndexOf(array, value, fromIndex);
|
||||
return baseIndexOf(array, value, fromIndex || 0);
|
||||
}
|
||||
|
||||
export default indexOf;
|
||||
|
||||
@@ -47,11 +47,11 @@ function intersection() {
|
||||
outer:
|
||||
while (++index < length) {
|
||||
value = array[index];
|
||||
if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value)) < 0) {
|
||||
if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {
|
||||
argsIndex = argsLength;
|
||||
while (--argsIndex) {
|
||||
var cache = caches[argsIndex];
|
||||
if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) {
|
||||
if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value, 0)) < 0) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,17 +31,19 @@ var splice = arrayProto.splice;
|
||||
* // => [1, 1]
|
||||
*/
|
||||
function pull() {
|
||||
var array = arguments[0];
|
||||
var args = arguments,
|
||||
array = args[0];
|
||||
|
||||
if (!(array && array.length)) {
|
||||
return array;
|
||||
}
|
||||
var index = 0,
|
||||
indexOf = baseIndexOf,
|
||||
length = arguments.length;
|
||||
length = args.length;
|
||||
|
||||
while (++index < length) {
|
||||
var fromIndex = 0,
|
||||
value = arguments[index];
|
||||
value = args[index];
|
||||
|
||||
while ((fromIndex = indexOf(array, value, fromIndex)) > -1) {
|
||||
splice.call(array, fromIndex, 1);
|
||||
|
||||
@@ -21,7 +21,7 @@ import baseUniq from '../internal/baseUniq';
|
||||
* // => [1, 2, 4]
|
||||
*/
|
||||
function union() {
|
||||
return baseUniq(baseFlatten(arguments, false, true));
|
||||
return baseUniq(baseFlatten(arguments, false, true, 0));
|
||||
}
|
||||
|
||||
export default union;
|
||||
|
||||
Reference in New Issue
Block a user