Compare commits

..

1 Commits

Author SHA1 Message Date
John-David Dalton
cbf5cb1162 Bump to v4.14.2. 2016-08-07 21:23:34 -07:00
74 changed files with 233 additions and 256 deletions

View File

@@ -1,4 +1,4 @@
# lodash-es v4.14.1 # lodash-es v4.14.2
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules. The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
$ lodash modularize exports=es -o ./ $ lodash modularize exports=es -o ./
``` ```
See the [package source](https://github.com/lodash/lodash/tree/4.14.1-es) for more details. See the [package source](https://github.com/lodash/lodash/tree/4.14.2-es) for more details.

View File

@@ -1,6 +0,0 @@
import root from './_root.js';
/** Built-in value references. */
var Reflect = root.Reflect;
export default Reflect;

38
_arrayLikeKeys.js Normal file
View File

@@ -0,0 +1,38 @@
import baseTimes from './_baseTimes.js';
import isArguments from './isArguments.js';
import isArray from './isArray.js';
import isIndex from './_isIndex.js';
import isString from './isString.js';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var result = (isArray(value) || isString(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
var length = result.length,
skipIndexes = !!length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
export default arrayLikeKeys;

View File

@@ -8,7 +8,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
/** /**
* Assigns `value` to `key` of `object` if the existing value is not equivalent * Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
* @private * @private

View File

@@ -11,14 +11,13 @@ function baseConformsTo(object, source, props) {
if (object == null) { if (object == null) {
return !length; return !length;
} }
var index = length; object = Object(object);
while (index--) { while (length--) {
var key = props[index], var key = props[length],
predicate = source[key], predicate = source[key],
value = object[key]; value = object[key];
if ((value === undefined && if ((value === undefined && !(key in object)) || !predicate(value)) {
!(key in Object(object))) || !predicate(value)) {
return false; return false;
} }
} }

View File

@@ -9,7 +9,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* @param {Function} func The function to delay. * @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation. * @param {number} wait The number of milliseconds to delay invocation.
* @param {Array} args The arguments to provide to `func`. * @param {Array} args The arguments to provide to `func`.
* @returns {number} Returns the timer id. * @returns {number|Object} Returns the timer id or timeout object.
*/ */
function baseDelay(func, wait, args) { function baseDelay(func, wait, args) {
if (typeof func != 'function') { if (typeof func != 'function') {

View File

@@ -3,7 +3,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -1,5 +1,3 @@
import getPrototype from './_getPrototype.js';
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = Object.prototype; var objectProto = Object.prototype;
@@ -15,12 +13,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @returns {boolean} Returns `true` if `key` exists, else `false`. * @returns {boolean} Returns `true` if `key` exists, else `false`.
*/ */
function baseHas(object, key) { function baseHas(object, key) {
// Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`, return object != null && hasOwnProperty.call(object, key);
// that are composed entirely of index properties, return `false` for
// `hasOwnProperty` checks of them.
return object != null &&
(hasOwnProperty.call(object, key) ||
(typeof object == 'object' && key in object && getPrototype(object) === null));
} }
export default baseHas; export default baseHas;

View File

@@ -7,7 +7,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -8,7 +8,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -6,7 +6,7 @@ import toSource from './_toSource.js';
/** /**
* Used to match `RegExp` * Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/ */
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;

View File

@@ -8,7 +8,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -49,7 +49,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -1,16 +1,30 @@
import overArg from './_overArg.js'; import isPrototype from './_isPrototype.js';
import nativeKeys from './_nativeKeys.js';
/* Built-in method references for those with the same name as other `lodash` methods. */ /** Used for built-in method references. */
var nativeKeys = Object.keys; var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** /**
* The base implementation of `_.keys` which doesn't skip the constructor * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
* property of prototypes or treat sparse arrays as dense.
* *
* @private * @private
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @returns {Array} Returns the array of property names. * @returns {Array} Returns the array of property names.
*/ */
var baseKeys = overArg(nativeKeys, Object); function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
export default baseKeys; export default baseKeys;

View File

@@ -1,36 +1,33 @@
import Reflect from './_Reflect.js'; import isObject from './isObject.js';
import iteratorToArray from './_iteratorToArray.js'; import isPrototype from './_isPrototype.js';
import nativeKeysIn from './_nativeKeysIn.js';
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = Object.prototype; var objectProto = Object.prototype;
/** Built-in value references. */ /** Used to check objects for own properties. */
var enumerate = Reflect ? Reflect.enumerate : undefined, var hasOwnProperty = objectProto.hasOwnProperty;
propertyIsEnumerable = objectProto.propertyIsEnumerable;
/** /**
* The base implementation of `_.keysIn` which doesn't skip the constructor * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
* property of prototypes or treat sparse arrays as dense.
* *
* @private * @private
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @returns {Array} Returns the array of property names. * @returns {Array} Returns the array of property names.
*/ */
function baseKeysIn(object) { function baseKeysIn(object) {
object = object == null ? object : Object(object); if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object),
result = [];
var result = [];
for (var key in object) { for (var key in object) {
result.push(key); if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
} }
return result; return result;
} }
// Fallback for IE < 9 with es6-shim.
if (enumerate && !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf')) {
baseKeysIn = function(object) {
return iteratorToArray(enumerate(object));
};
}
export default baseKeysIn; export default baseKeysIn;

View File

@@ -1,11 +1,11 @@
import Stack from './_Stack.js'; import Stack from './_Stack.js';
import arrayEach from './_arrayEach.js'; import arrayEach from './_arrayEach.js';
import assignMergeValue from './_assignMergeValue.js'; import assignMergeValue from './_assignMergeValue.js';
import baseKeysIn from './_baseKeysIn.js';
import baseMergeDeep from './_baseMergeDeep.js'; import baseMergeDeep from './_baseMergeDeep.js';
import isArray from './isArray.js'; import isArray from './isArray.js';
import isObject from './isObject.js'; import isObject from './isObject.js';
import isTypedArray from './isTypedArray.js'; import isTypedArray from './isTypedArray.js';
import keysIn from './keysIn.js';
/** /**
* The base implementation of `_.merge` without support for multiple sources. * The base implementation of `_.merge` without support for multiple sources.
@@ -23,7 +23,7 @@ function baseMerge(object, source, srcIndex, customizer, stack) {
return; return;
} }
if (!(isArray(source) || isTypedArray(source))) { if (!(isArray(source) || isTypedArray(source))) {
var props = keysIn(source); var props = baseKeysIn(source);
} }
arrayEach(props || source, function(srcValue, key) { arrayEach(props || source, function(srcValue, key) {
if (props) { if (props) {

View File

@@ -16,6 +16,9 @@ import toKey from './_toKey.js';
* @returns {Object} Returns `object`. * @returns {Object} Returns `object`.
*/ */
function baseSet(object, path, value, customizer) { function baseSet(object, path, value, customizer) {
if (!isObject(object)) {
return object;
}
path = isKey(path, object) ? [path] : castPath(path); path = isKey(path, object) ? [path] : castPath(path);
var index = -1, var index = -1,
@@ -24,20 +27,19 @@ function baseSet(object, path, value, customizer) {
nested = object; nested = object;
while (nested != null && ++index < length) { while (nested != null && ++index < length) {
var key = toKey(path[index]); var key = toKey(path[index]),
if (isObject(nested)) { newValue = value;
var newValue = value;
if (index != lastIndex) { if (index != lastIndex) {
var objValue = nested[key]; var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined; newValue = customizer ? customizer(objValue, key, nested) : undefined;
if (newValue === undefined) { if (newValue === undefined) {
newValue = objValue == null newValue = isObject(objValue)
? (isIndex(path[index + 1]) ? [] : {}) ? objValue
: objValue; : (isIndex(path[index + 1]) ? [] : {});
}
} }
assignValue(nested, key, newValue);
} }
assignValue(nested, key, newValue);
nested = nested[key]; nested = nested[key];
} }
return object; return object;

View File

@@ -1,10 +1,15 @@
import baseHas from './_baseHas.js';
import castPath from './_castPath.js'; import castPath from './_castPath.js';
import isKey from './_isKey.js'; import isKey from './_isKey.js';
import last from './last.js'; import last from './last.js';
import parent from './_parent.js'; import parent from './_parent.js';
import toKey from './_toKey.js'; import toKey from './_toKey.js';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** /**
* The base implementation of `_.unset`. * The base implementation of `_.unset`.
* *
@@ -18,7 +23,7 @@ function baseUnset(object, path) {
object = parent(object, path); object = parent(object, path);
var key = toKey(last(path)); var key = toKey(last(path));
return !(object != null && baseHas(object, key)) || delete object[key]; return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
} }
export default baseUnset; export default baseUnset;

View File

@@ -12,7 +12,7 @@ import isObject from './isObject.js';
function createCtor(Ctor) { function createCtor(Ctor) {
return function() { return function() {
// Use a `switch` statement to work with class constructors. See // Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
// for more details. // for more details.
var args = arguments; var args = arguments;
switch (args.length) { switch (args.length) {

View File

@@ -75,7 +75,7 @@ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
case regexpTag: case regexpTag:
case stringTag: case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects, // Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details. // for more details.
return object == (other + ''); return object == (other + '');

View File

@@ -1,9 +1,14 @@
import baseHas from './_baseHas.js';
import keys from './keys.js'; import keys from './keys.js';
/** Used to compose bitmasks for comparison styles. */ /** Used to compose bitmasks for comparison styles. */
var PARTIAL_COMPARE_FLAG = 2; var PARTIAL_COMPARE_FLAG = 2;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** /**
* A specialized version of `baseIsEqualDeep` for objects with support for * A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons. * partial deep comparisons.
@@ -31,7 +36,7 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
var index = objLength; var index = objLength;
while (index--) { while (index--) {
var key = objProps[index]; var key = objProps[index];
if (!(isPartial ? key in other : baseHas(other, key))) { if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false; return false;
} }
} }

View File

@@ -1,16 +0,0 @@
import baseProperty from './_baseProperty.js';
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a
* [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
* Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
export default getLength;

View File

@@ -1,15 +1,6 @@
import overArg from './_overArg.js'; import overArg from './_overArg.js';
/* Built-in method references for those with the same name as other `lodash` methods. */ /** Built-in value references. */
var nativeGetPrototype = Object.getPrototypeOf; var getPrototype = overArg(Object.getPrototypeOf, Object);
/**
* Gets the `[[Prototype]]` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {null|Object} Returns the `[[Prototype]]`.
*/
var getPrototype = overArg(nativeGetPrototype, Object);
export default getPrototype; export default getPrototype;

View File

@@ -20,7 +20,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -1,24 +0,0 @@
import baseTimes from './_baseTimes.js';
import isArguments from './isArguments.js';
import isArray from './isArray.js';
import isLength from './isLength.js';
import isString from './isString.js';
/**
* Creates an array of index keys for `object` values of arrays,
* `arguments` objects, and strings, otherwise `null` is returned.
*
* @private
* @param {Object} object The object to query.
* @returns {Array|null} Returns index keys, else `null`.
*/
function indexKeys(object) {
var length = object ? object.length : undefined;
if (isLength(length) &&
(isArray(object) || isString(object) || isArguments(object))) {
return baseTimes(length, String);
}
return null;
}
export default indexKeys;

6
_nativeKeys.js Normal file
View File

@@ -0,0 +1,6 @@
import overArg from './_overArg.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
export default nativeKeys;

20
_nativeKeysIn.js Normal file
View File

@@ -0,0 +1,20 @@
/**
* This function is like
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* except that it includes inherited enumerable properties.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
export default nativeKeysIn;

View File

@@ -1,5 +1,5 @@
/** /**
* Creates a function that invokes `func` with its first argument transformed. * Creates a unary function that invokes `func` with its argument transformed.
* *
* @private * @private
* @param {Function} func The function to wrap. * @param {Function} func The function to wrap.

View File

@@ -1,19 +1,7 @@
import assignValue from './_assignValue.js';
import copyObject from './_copyObject.js'; import copyObject from './_copyObject.js';
import createAssigner from './_createAssigner.js'; import createAssigner from './_createAssigner.js';
import isArrayLike from './isArrayLike.js';
import isPrototype from './_isPrototype.js';
import keysIn from './keysIn.js'; import keysIn from './keysIn.js';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */
var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
/** /**
* This method is like `_.assign` except that it iterates over own and * This method is like `_.assign` except that it iterates over own and
* inherited source properties. * inherited source properties.
@@ -46,13 +34,7 @@ var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/ */
var assignIn = createAssigner(function(object, source) { var assignIn = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { copyObject(source, keysIn(source), object);
copyObject(source, keysIn(source), object);
return;
}
for (var key in source) {
assignValue(object, key, source[key]);
}
}); });
export default assignIn; export default assignIn;

View File

@@ -5,7 +5,7 @@ import isArrayLikeObject from './isArrayLikeObject.js';
/** /**
* Creates an array of `array` values not included in the other given arrays * Creates an array of `array` values not included in the other given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. The order of result values is determined by the * for equality comparisons. The order of result values is determined by the
* order they occur in the first array. * order they occur in the first array.
* *

2
eq.js
View File

@@ -1,6 +1,6 @@
/** /**
* Performs a * Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent. * comparison between two values to determine if they are equivalent.
* *
* @static * @static

View File

@@ -2,7 +2,7 @@ import toString from './toString.js';
/** /**
* Used to match `RegExp` * Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns). * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/ */
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source); reHasRegExpChar = RegExp(reRegExpChar.source);

View File

@@ -9,6 +9,11 @@ import isIterateeCall from './_isIterateeCall.js';
* Iteration is stopped once `predicate` returns falsey. The predicate is * Iteration is stopped once `predicate` returns falsey. The predicate is
* invoked with three arguments: (value, index|key, collection). * invoked with three arguments: (value, index|key, collection).
* *
* **Note:** This method returns `true` for
* [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
* [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
* elements of empty collections.
*
* @static * @static
* @memberOf _ * @memberOf _
* @since 0.1.0 * @since 0.1.0

View File

@@ -10,7 +10,7 @@ var nativeMax = Math.max;
/** /**
* Checks if `value` is in `collection`. If `collection` is a string, it's * Checks if `value` is in `collection`. If `collection` is a string, it's
* checked for a substring of `value`, otherwise * checked for a substring of `value`, otherwise
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* is used for equality comparisons. If `fromIndex` is negative, it's used as * is used for equality comparisons. If `fromIndex` is negative, it's used as
* the offset from the end of `collection`. * the offset from the end of `collection`.
* *

View File

@@ -6,7 +6,7 @@ var nativeMax = Math.max;
/** /**
* Gets the index at which the first occurrence of `value` is found in `array` * Gets the index at which the first occurrence of `value` is found in `array`
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. If `fromIndex` is negative, it's used as the * for equality comparisons. If `fromIndex` is negative, it's used as the
* offset from the end of `array`. * offset from the end of `array`.
* *

View File

@@ -1,4 +1,4 @@
import dropRight from './dropRight.js'; import baseSlice from './_baseSlice.js';
/** /**
* Gets all but the last element of `array`. * Gets all but the last element of `array`.
@@ -15,7 +15,8 @@ import dropRight from './dropRight.js';
* // => [1, 2] * // => [1, 2]
*/ */
function initial(array) { function initial(array) {
return dropRight(array, 1); var length = array ? array.length : 0;
return length ? baseSlice(array, 0, -1) : [];
} }
export default initial; export default initial;

View File

@@ -5,7 +5,7 @@ import castArrayLikeObject from './_castArrayLikeObject.js';
/** /**
* Creates an array of unique values that are included in all given arrays * Creates an array of unique values that are included in all given arrays
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. The order of result values is determined by the * for equality comparisons. The order of result values is determined by the
* order they occur in the first array. * order they occur in the first array.
* *

View File

@@ -11,7 +11,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -1,4 +1,3 @@
import getLength from './_getLength.js';
import isFunction from './isFunction.js'; import isFunction from './isFunction.js';
import isLength from './isLength.js'; import isLength from './isLength.js';
@@ -28,7 +27,7 @@ import isLength from './isLength.js';
* // => false * // => false
*/ */
function isArrayLike(value) { function isArrayLike(value) {
return value != null && isLength(getLength(value)) && !isFunction(value); return value != null && isLength(value.length) && !isFunction(value);
} }
export default isArrayLike; export default isArrayLike;

View File

@@ -8,7 +8,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -9,8 +9,7 @@ import isPlainObject from './isPlainObject.js';
* @since 0.1.0 * @since 0.1.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a DOM element, * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
* else `false`.
* @example * @example
* *
* _.isElement(document.body); * _.isElement(document.body);

View File

@@ -5,8 +5,9 @@ import isArrayLike from './isArrayLike.js';
import isBuffer from './isBuffer.js'; import isBuffer from './isBuffer.js';
import isFunction from './isFunction.js'; import isFunction from './isFunction.js';
import isObjectLike from './isObjectLike.js'; import isObjectLike from './isObjectLike.js';
import isPrototype from './_isPrototype.js';
import isString from './isString.js'; import isString from './isString.js';
import keys from './keys.js'; import nativeKeys from './_nativeKeys.js';
/** `Object#toString` result references. */ /** `Object#toString` result references. */
var mapTag = '[object Map]', var mapTag = '[object Map]',
@@ -69,12 +70,14 @@ function isEmpty(value) {
return !value.size; return !value.size;
} }
} }
var isProto = isPrototype(value);
for (var key in value) { for (var key in value) {
if (hasOwnProperty.call(value, key)) { if (hasOwnProperty.call(value, key) &&
!(isProto && key == 'constructor')) {
return false; return false;
} }
} }
return !(nonEnumShadows && keys(value).length); return !(nonEnumShadows && nativeKeys(value).length);
} }
export default isEmpty; export default isEmpty;

View File

@@ -16,8 +16,7 @@ import baseIsEqual from './_baseIsEqual.js';
* @category Lang * @category Lang
* @param {*} value The value to compare. * @param {*} value The value to compare.
* @param {*} other The other value to compare. * @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* else `false`.
* @example * @example
* *
* var object = { 'a': 1 }; * var object = { 'a': 1 };

View File

@@ -13,8 +13,7 @@ import baseIsEqual from './_baseIsEqual.js';
* @param {*} value The value to compare. * @param {*} value The value to compare.
* @param {*} other The other value to compare. * @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparisons. * @param {Function} [customizer] The function to customize comparisons.
* @returns {boolean} Returns `true` if the values are equivalent, * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* else `false`.
* @example * @example
* *
* function isGreeting(value) { * function isGreeting(value) {

View File

@@ -8,7 +8,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;
@@ -22,8 +22,7 @@ var objectToString = objectProto.toString;
* @since 3.0.0 * @since 3.0.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an error object, * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
* else `false`.
* @example * @example
* *
* _.isError(new Error); * _.isError(new Error);

View File

@@ -14,8 +14,7 @@ var nativeIsFinite = root.isFinite;
* @since 0.1.0 * @since 0.1.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a finite number, * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
* else `false`.
* @example * @example
* *
* _.isFinite(3); * _.isFinite(3);

View File

@@ -9,7 +9,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -4,16 +4,15 @@ var MAX_SAFE_INTEGER = 9007199254740991;
/** /**
* Checks if `value` is a valid array-like length. * Checks if `value` is a valid array-like length.
* *
* **Note:** This function is loosely based on * **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
* *
* @static * @static
* @memberOf _ * @memberOf _
* @since 4.0.0 * @since 4.0.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* else `false`.
* @example * @example
* *
* _.isLength(3); * _.isLength(3);

View File

@@ -5,8 +5,12 @@ import getMatchData from './_getMatchData.js';
* Performs a partial deep comparison between `object` and `source` to * Performs a partial deep comparison between `object` and `source` to
* determine if `object` contains equivalent property values. * determine if `object` contains equivalent property values.
* *
* **Note:** This method supports comparing the same values as `_.isEqual` * **Note:** This method is equivalent to `_.matches` when `source` is
* and is equivalent to `_.matches` when `source` is partially applied. * partially applied.
*
* Partial comparisons will match empty array and empty object `source`
* values against any array or object value, respectively. See `_.isEqual`
* for a list of supported value comparisons.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -8,7 +8,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -1,6 +1,6 @@
/** /**
* Checks if `value` is the * Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
* *
* @static * @static

View File

@@ -19,7 +19,7 @@ var objectCtorString = funcToString.call(Object);
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;
@@ -33,8 +33,7 @@ var objectToString = objectProto.toString;
* @since 0.8.0 * @since 0.8.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* else `false`.
* @example * @example
* *
* function Foo() { * function Foo() {

View File

@@ -15,8 +15,7 @@ var MAX_SAFE_INTEGER = 9007199254740991;
* @since 4.0.0 * @since 4.0.0
* @category Lang * @category Lang
* @param {*} value The value to check. * @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a safe integer, * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
* else `false`.
* @example * @example
* *
* _.isSafeInteger(3); * _.isSafeInteger(3);

View File

@@ -9,7 +9,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -8,7 +8,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

View File

@@ -8,7 +8,7 @@ var objectProto = Object.prototype;
/** /**
* Used to resolve the * Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values. * of values.
*/ */
var objectToString = objectProto.toString; var objectToString = objectProto.toString;

25
keys.js
View File

@@ -1,15 +1,12 @@
import baseHas from './_baseHas.js'; import arrayLikeKeys from './_arrayLikeKeys.js';
import baseKeys from './_baseKeys.js'; import baseKeys from './_baseKeys.js';
import indexKeys from './_indexKeys.js';
import isArrayLike from './isArrayLike.js'; import isArrayLike from './isArrayLike.js';
import isIndex from './_isIndex.js';
import isPrototype from './_isPrototype.js';
/** /**
* Creates an array of the own enumerable property names of `object`. * Creates an array of the own enumerable property names of `object`.
* *
* **Note:** Non-object values are coerced to objects. See the * **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details. * for more details.
* *
* @static * @static
@@ -34,23 +31,7 @@ import isPrototype from './_isPrototype.js';
* // => ['0', '1'] * // => ['0', '1']
*/ */
function keys(object) { function keys(object) {
var isProto = isPrototype(object); return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
if (!(isProto || isArrayLike(object))) {
return baseKeys(object);
}
var indexes = indexKeys(object),
skipIndexes = !!indexes,
result = indexes || [],
length = result.length;
for (var key in object) {
if (baseHas(object, key) &&
!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
!(isProto && key == 'constructor')) {
result.push(key);
}
}
return result;
} }
export default keys; export default keys;

View File

@@ -1,13 +1,6 @@
import arrayLikeKeys from './_arrayLikeKeys.js';
import baseKeysIn from './_baseKeysIn.js'; import baseKeysIn from './_baseKeysIn.js';
import indexKeys from './_indexKeys.js'; import isArrayLike from './isArrayLike.js';
import isIndex from './_isIndex.js';
import isPrototype from './_isPrototype.js';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** /**
* Creates an array of the own and inherited enumerable property names of `object`. * Creates an array of the own and inherited enumerable property names of `object`.
@@ -33,23 +26,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* // => ['a', 'b', 'c'] (iteration order is not guaranteed) * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/ */
function keysIn(object) { function keysIn(object) {
var index = -1, return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
isProto = isPrototype(object),
props = baseKeysIn(object),
propsLength = props.length,
indexes = indexKeys(object),
skipIndexes = !!indexes,
result = indexes || [],
length = result.length;
while (++index < propsLength) {
var key = props[index];
if (!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
return result;
} }
export default keysIn; export default keysIn;

View File

@@ -45,7 +45,7 @@ import toInteger from './toInteger.js';
import lodash from './wrapperLodash.js'; import lodash from './wrapperLodash.js';
/** Used as the semantic version number. */ /** Used as the semantic version number. */
var VERSION = '4.14.1'; var VERSION = '4.14.2';
/** Used to compose bitmasks for function metadata. */ /** Used to compose bitmasks for function metadata. */
var BIND_KEY_FLAG = 2; var BIND_KEY_FLAG = 2;

View File

@@ -6,8 +6,12 @@ import baseMatches from './_baseMatches.js';
* object and `source`, returning `true` if the given object has equivalent * object and `source`, returning `true` if the given object has equivalent
* property values, else `false`. * property values, else `false`.
* *
* **Note:** The created function supports comparing the same values as * **Note:** The created function is equivalent to `_.isMatch` with `source`
* `_.isEqual` is equivalent to `_.isMatch` with `source` partially applied. * partially applied.
*
* Partial comparisons will match empty array and empty object `source`
* values against any array or object value, respectively. See `_.isEqual`
* for a list of supported value comparisons.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -6,7 +6,9 @@ import baseMatchesProperty from './_baseMatchesProperty.js';
* value at `path` of a given object to `srcValue`, returning `true` if the * value at `path` of a given object to `srcValue`, returning `true` if the
* object value is equivalent, else `false`. * object value is equivalent, else `false`.
* *
* **Note:** This method supports comparing the same values as `_.isEqual`. * **Note:** Partial comparisons will match empty array and empty object
* `srcValue` values against any array or object value, respectively. See
* `_.isEqual` for a list of supported value comparisons.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -13,7 +13,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* **Note:** The cache is exposed as the `cache` property on the memoized * **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache` * function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the * constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `delete`, `get`, `has`, and `set`. * method interface of `delete`, `get`, `has`, and `set`.
* *
* @static * @static

8
now.js
View File

@@ -1,3 +1,5 @@
import root from './_root.js';
/** /**
* Gets the timestamp of the number of milliseconds that have elapsed since * Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC). * the Unix epoch (1 January 1970 00:00:00 UTC).
@@ -14,8 +16,8 @@
* }, _.now()); * }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation. * // => Logs the number of milliseconds it took for the deferred invocation.
*/ */
function now() { var now = function() {
return Date.now(); return root.Date.now();
} };
export default now; export default now;

View File

@@ -1,6 +1,6 @@
{ {
"name": "lodash-es", "name": "lodash-es",
"version": "4.14.1", "version": "4.14.2",
"description": "Lodash exported as ES modules.", "description": "Lodash exported as ES modules.",
"keywords": "es6, modules, stdlib, util", "keywords": "es6, modules, stdlib, util",
"homepage": "https://lodash.com/custom-builds", "homepage": "https://lodash.com/custom-builds",

View File

@@ -3,7 +3,7 @@ import pullAll from './pullAll.js';
/** /**
* Removes all given values from `array` using * Removes all given values from `array` using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove` * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`

View File

@@ -1,8 +1,8 @@
import baseKeys from './_baseKeys.js';
import getTag from './_getTag.js'; import getTag from './_getTag.js';
import isArrayLike from './isArrayLike.js'; import isArrayLike from './isArrayLike.js';
import isObjectLike from './isObjectLike.js'; import isObjectLike from './isObjectLike.js';
import isString from './isString.js'; import isString from './isString.js';
import keys from './keys.js';
import stringSize from './_stringSize.js'; import stringSize from './_stringSize.js';
/** `Object#toString` result references. */ /** `Object#toString` result references. */
@@ -44,7 +44,7 @@ function size(collection) {
return collection.size; return collection.size;
} }
} }
return keys(collection).length; return baseKeys(collection).length;
} }
export default size; export default size;

View File

@@ -13,7 +13,7 @@ var nativeMax = Math.max;
/** /**
* Creates a function that invokes `func` with the `this` binding of the * Creates a function that invokes `func` with the `this` binding of the
* create function and an array of arguments much like * create function and an array of arguments much like
* [`Function#apply`](http://www.ecma-international.org/ecma-262/6.0/#sec-function.prototype.apply). * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
* *
* **Note:** This method is based on the * **Note:** This method is based on the
* [spread operator](https://mdn.io/spread_operator). * [spread operator](https://mdn.io/spread_operator).

View File

@@ -1,4 +1,4 @@
import drop from './drop.js'; import baseSlice from './_baseSlice.js';
/** /**
* Gets all but the first element of `array`. * Gets all but the first element of `array`.
@@ -15,7 +15,8 @@ import drop from './drop.js';
* // => [2, 3] * // => [2, 3]
*/ */
function tail(array) { function tail(array) {
return drop(array, 1); var length = array ? array.length : 0;
return length ? baseSlice(array, 1, length) : [];
} }
export default tail; export default tail;

View File

@@ -17,7 +17,7 @@ var reEmptyStringLeading = /\b__p \+= '';/g,
/** /**
* Used to match * Used to match
* [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
*/ */
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;

View File

@@ -4,7 +4,7 @@ import toFinite from './toFinite.js';
* Converts `value` to an integer. * Converts `value` to an integer.
* *
* **Note:** This method is loosely based on * **Note:** This method is loosely based on
* [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -9,7 +9,7 @@ var MAX_ARRAY_LENGTH = 4294967295;
* array-like object. * array-like object.
* *
* **Note:** This method is based on * **Note:** This method is based on
* [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -5,7 +5,7 @@ import isArrayLikeObject from './isArrayLikeObject.js';
/** /**
* Creates an array of unique values, in order, from all given arrays using * Creates an array of unique values, in order, from all given arrays using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
* @static * @static

View File

@@ -2,7 +2,7 @@ import baseUniq from './_baseUniq.js';
/** /**
* Creates a duplicate-free version of an array, using * Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons, in which only the first occurrence of each * for equality comparisons, in which only the first occurrence of each
* element is kept. * element is kept.
* *

View File

@@ -4,7 +4,7 @@ import isArrayLikeObject from './isArrayLikeObject.js';
/** /**
* Creates an array excluding all given values using * Creates an array excluding all given values using
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons. * for equality comparisons.
* *
* **Note:** Unlike `_.pull`, this method returns a new array. * **Note:** Unlike `_.pull`, this method returns a new array.