mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbf5cb1162 | ||
|
|
6d4f76888f |
@@ -1,4 +1,4 @@
|
|||||||
# lodash-es v4.14.0
|
# 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.0-es) for more details.
|
See the [package source](https://github.com/lodash/lodash/tree/4.14.2-es) for more details.
|
||||||
|
|||||||
@@ -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
38
_arrayLikeKeys.js
Normal 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;
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -133,9 +133,6 @@ function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
|
|||||||
// Recursively populate clone (susceptible to call stack limits).
|
// Recursively populate clone (susceptible to call stack limits).
|
||||||
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
||||||
});
|
});
|
||||||
if (!isFull) {
|
|
||||||
stack['delete'](value);
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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') {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
26
_baseKeys.js
26
_baseKeys.js
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
26
_baseSet.js
26
_baseSet.js
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import baseRange from './_baseRange.js';
|
import baseRange from './_baseRange.js';
|
||||||
import isIterateeCall from './_isIterateeCall.js';
|
import isIterateeCall from './_isIterateeCall.js';
|
||||||
import toNumber from './toNumber.js';
|
import toFinite from './toFinite.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a `_.range` or `_.rangeRight` function.
|
* Creates a `_.range` or `_.rangeRight` function.
|
||||||
@@ -15,15 +15,14 @@ function createRange(fromRight) {
|
|||||||
end = step = undefined;
|
end = step = undefined;
|
||||||
}
|
}
|
||||||
// Ensure the sign of `-0` is preserved.
|
// Ensure the sign of `-0` is preserved.
|
||||||
start = toNumber(start);
|
start = toFinite(start);
|
||||||
start = start === start ? start : 0;
|
|
||||||
if (end === undefined) {
|
if (end === undefined) {
|
||||||
end = start;
|
end = start;
|
||||||
start = 0;
|
start = 0;
|
||||||
} else {
|
} else {
|
||||||
end = toNumber(end) || 0;
|
end = toFinite(end);
|
||||||
}
|
}
|
||||||
step = step === undefined ? (start < end ? 1 : -1) : (toNumber(step) || 0);
|
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
|
||||||
return baseRange(start, end, step, fromRight);
|
return baseRange(start, end, step, fromRight);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stack['delete'](array);
|
stack['delete'](array);
|
||||||
|
stack['delete'](other);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 + '');
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,6 +83,7 @@ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stack['delete'](object);
|
stack['delete'](object);
|
||||||
|
stack['delete'](other);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import arrayPush from './_arrayPush.js';
|
import arrayPush from './_arrayPush.js';
|
||||||
import getPrototype from './_getPrototype.js';
|
import getPrototype from './_getPrototype.js';
|
||||||
import getSymbols from './_getSymbols.js';
|
import getSymbols from './_getSymbols.js';
|
||||||
|
import stubArray from './stubArray.js';
|
||||||
|
|
||||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
||||||
@@ -13,7 +14,7 @@ var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to query.
|
||||||
* @returns {Array} Returns the array of symbols.
|
* @returns {Array} Returns the array of symbols.
|
||||||
*/
|
*/
|
||||||
var getSymbolsIn = !nativeGetSymbols ? getSymbols : function(object) {
|
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
||||||
var result = [];
|
var result = [];
|
||||||
while (object) {
|
while (object) {
|
||||||
arrayPush(result, getSymbols(object));
|
arrayPush(result, getSymbols(object));
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
|
||||||
@@ -14,7 +14,7 @@ var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
|
|||||||
*/
|
*/
|
||||||
function isFlattenable(value) {
|
function isFlattenable(value) {
|
||||||
return isArray(value) || isArguments(value) ||
|
return isArray(value) || isArguments(value) ||
|
||||||
!!(spreadableSymbol && value && value[spreadableSymbol])
|
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default isFlattenable;
|
export default isFlattenable;
|
||||||
|
|||||||
6
_nativeKeys.js
Normal file
6
_nativeKeys.js
Normal 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
20
_nativeKeysIn.js
Normal 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;
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import freeGlobal from './_freeGlobal.js';
|
import freeGlobal from './_freeGlobal.js';
|
||||||
|
|
||||||
/** Detect free variable `exports`. */
|
/** Detect free variable `exports`. */
|
||||||
var freeExports = freeGlobal && typeof exports == 'object' && exports;
|
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
||||||
|
|
||||||
/** Detect free variable `module`. */
|
/** Detect free variable `module`. */
|
||||||
var freeModule = freeExports && typeof module == 'object' && module;
|
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
||||||
|
|
||||||
/** Detect the popular CommonJS extension `module.exports`. */
|
/** Detect the popular CommonJS extension `module.exports`. */
|
||||||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import memoize from './memoize.js';
|
|||||||
import toString from './toString.js';
|
import toString from './toString.js';
|
||||||
|
|
||||||
/** Used to match property names within property paths. */
|
/** Used to match property names within property paths. */
|
||||||
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g;
|
var reLeadingDot = /^\./,
|
||||||
|
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
||||||
|
|
||||||
/** Used to match backslashes in property paths. */
|
/** Used to match backslashes in property paths. */
|
||||||
var reEscapeChar = /\\(\\)?/g;
|
var reEscapeChar = /\\(\\)?/g;
|
||||||
@@ -15,8 +16,13 @@ var reEscapeChar = /\\(\\)?/g;
|
|||||||
* @returns {Array} Returns the property path array.
|
* @returns {Array} Returns the property path array.
|
||||||
*/
|
*/
|
||||||
var stringToPath = memoize(function(string) {
|
var stringToPath = memoize(function(string) {
|
||||||
|
string = toString(string);
|
||||||
|
|
||||||
var result = [];
|
var result = [];
|
||||||
toString(string).replace(rePropName, function(match, number, quote, string) {
|
if (reLeadingDot.test(string)) {
|
||||||
|
result.push('');
|
||||||
|
}
|
||||||
|
string.replace(rePropName, function(match, number, quote, string) {
|
||||||
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
20
assignIn.js
20
assignIn.js
@@ -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;
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import baseConforms from './_baseConforms.js';
|
|||||||
* the corresponding property values of a given object, returning `true` if
|
* the corresponding property values of a given object, returning `true` if
|
||||||
* all predicates return truthy, else `false`.
|
* all predicates return truthy, else `false`.
|
||||||
*
|
*
|
||||||
|
* **Note:** The created function is equivalent to `_.conformsTo` with
|
||||||
|
* `source` partially applied.
|
||||||
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import baseConformsTo from './_baseConformsTo.js';
|
|||||||
import keys from './keys.js';
|
import keys from './keys.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `object` conforms to `source` by invoking the predicate properties
|
* Checks if `object` conforms to `source` by invoking the predicate
|
||||||
* of `source` with the corresponding property values of `object`. This method
|
* properties of `source` with the corresponding property values of `object`.
|
||||||
* is equivalent to a `_.conforms` function when `source` is partially applied.
|
*
|
||||||
|
* **Note:** This method is equivalent to `_.conforms` when `source` is
|
||||||
|
* partially applied.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
|
|||||||
18
debounce.js
18
debounce.js
@@ -14,14 +14,18 @@ var nativeMax = Math.max,
|
|||||||
* milliseconds have elapsed since the last time the debounced function was
|
* milliseconds have elapsed since the last time the debounced function was
|
||||||
* invoked. The debounced function comes with a `cancel` method to cancel
|
* invoked. The debounced function comes with a `cancel` method to cancel
|
||||||
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
||||||
* Provide an options object to indicate whether `func` should be invoked on
|
* Provide `options` to indicate whether `func` should be invoked on the
|
||||||
* the leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
||||||
* with the last arguments provided to the debounced function. Subsequent calls
|
* with the last arguments provided to the debounced function. Subsequent
|
||||||
* to the debounced function return the result of the last `func` invocation.
|
* calls to the debounced function return the result of the last `func`
|
||||||
|
* invocation.
|
||||||
*
|
*
|
||||||
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
|
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
||||||
* on the trailing edge of the timeout only if the debounced function is
|
* invoked on the trailing edge of the timeout only if the debounced function
|
||||||
* invoked more than once during the `wait` timeout.
|
* is invoked more than once during the `wait` timeout.
|
||||||
|
*
|
||||||
|
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
||||||
|
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
||||||
*
|
*
|
||||||
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
||||||
* for details over the differences between `_.debounce` and `_.throttle`.
|
* for details over the differences between `_.debounce` and `_.throttle`.
|
||||||
|
|||||||
@@ -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
2
eq.js
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
5
every.js
5
every.js
@@ -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
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import baseInRange from './_baseInRange.js';
|
import baseInRange from './_baseInRange.js';
|
||||||
|
import toFinite from './toFinite.js';
|
||||||
import toNumber from './toNumber.js';
|
import toNumber from './toNumber.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,12 +41,12 @@ import toNumber from './toNumber.js';
|
|||||||
* // => true
|
* // => true
|
||||||
*/
|
*/
|
||||||
function inRange(number, start, end) {
|
function inRange(number, start, end) {
|
||||||
start = toNumber(start) || 0;
|
start = toFinite(start);
|
||||||
if (end === undefined) {
|
if (end === undefined) {
|
||||||
end = start;
|
end = start;
|
||||||
start = 0;
|
start = 0;
|
||||||
} else {
|
} else {
|
||||||
end = toNumber(end) || 0;
|
end = toFinite(end);
|
||||||
}
|
}
|
||||||
number = toNumber(number);
|
number = toNumber(number);
|
||||||
return baseInRange(number, start, end);
|
return baseInRange(number, start, end);
|
||||||
|
|||||||
@@ -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`.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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`.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import freeGlobal from './_freeGlobal.js';
|
|
||||||
import root from './_root.js';
|
import root from './_root.js';
|
||||||
import stubFalse from './stubFalse.js';
|
import stubFalse from './stubFalse.js';
|
||||||
|
|
||||||
/** Detect free variable `exports`. */
|
/** Detect free variable `exports`. */
|
||||||
var freeExports = freeGlobal && typeof exports == 'object' && exports;
|
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
||||||
|
|
||||||
/** Detect free variable `module`. */
|
/** Detect free variable `module`. */
|
||||||
var freeModule = freeExports && typeof module == 'object' && module;
|
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
||||||
|
|
||||||
/** Detect the popular CommonJS extension `module.exports`. */
|
/** Detect the popular CommonJS extension `module.exports`. */
|
||||||
var moduleExports = freeModule && freeModule.exports === freeExports;
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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 };
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
10
isMatch.js
10
isMatch.js
@@ -3,10 +3,14 @@ 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. This method is
|
* determine if `object` contains equivalent property values.
|
||||||
* equivalent to a `_.matches` function when `source` is partially applied.
|
|
||||||
*
|
*
|
||||||
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
* **Note:** This method is equivalent to `_.matches` when `source` is
|
||||||
|
* 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 _
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
25
keys.js
@@ -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;
|
||||||
|
|||||||
29
keysIn.js
29
keysIn.js
@@ -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;
|
||||||
|
|||||||
@@ -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.0';
|
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;
|
||||||
|
|||||||
10
matches.js
10
matches.js
@@ -4,10 +4,14 @@ import baseMatches from './_baseMatches.js';
|
|||||||
/**
|
/**
|
||||||
* Creates a function that performs a partial deep comparison between a given
|
* Creates a function that performs a partial deep comparison between a given
|
||||||
* 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`. The created function is equivalent to
|
* property values, else `false`.
|
||||||
* `_.isMatch` with a `source` partially applied.
|
|
||||||
*
|
*
|
||||||
* **Note:** This method supports comparing the same values as `_.isEqual`.
|
* **Note:** The created function is equivalent to `_.isMatch` with `source`
|
||||||
|
* 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 _
|
||||||
|
|||||||
@@ -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 _
|
||||||
|
|||||||
@@ -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
8
now.js
@@ -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;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lodash-es",
|
"name": "lodash-es",
|
||||||
"version": "4.14.0",
|
"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",
|
||||||
|
|||||||
2
pull.js
2
pull.js
@@ -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`
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import baseRandom from './_baseRandom.js';
|
import baseRandom from './_baseRandom.js';
|
||||||
import isIterateeCall from './_isIterateeCall.js';
|
import isIterateeCall from './_isIterateeCall.js';
|
||||||
import toNumber from './toNumber.js';
|
import toFinite from './toFinite.js';
|
||||||
|
|
||||||
/** Built-in method references without a dependency on `root`. */
|
/** Built-in method references without a dependency on `root`. */
|
||||||
var freeParseFloat = parseFloat;
|
var freeParseFloat = parseFloat;
|
||||||
@@ -59,12 +59,12 @@ function random(lower, upper, floating) {
|
|||||||
upper = 1;
|
upper = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lower = toNumber(lower) || 0;
|
lower = toFinite(lower);
|
||||||
if (upper === undefined) {
|
if (upper === undefined) {
|
||||||
upper = lower;
|
upper = lower;
|
||||||
lower = 0;
|
lower = 0;
|
||||||
} else {
|
} else {
|
||||||
upper = toNumber(upper) || 0;
|
upper = toFinite(upper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lower > upper) {
|
if (lower > upper) {
|
||||||
|
|||||||
4
size.js
4
size.js
@@ -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;
|
||||||
|
|||||||
@@ -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).
|
||||||
|
|||||||
5
tail.js
5
tail.js
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
|||||||
* Creates a throttled function that only invokes `func` at most once per
|
* Creates a throttled function that only invokes `func` at most once per
|
||||||
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
||||||
* method to cancel delayed `func` invocations and a `flush` method to
|
* method to cancel delayed `func` invocations and a `flush` method to
|
||||||
* immediately invoke them. Provide an options object to indicate whether
|
* immediately invoke them. Provide `options` to indicate whether `func`
|
||||||
* `func` should be invoked on the leading and/or trailing edge of the `wait`
|
* should be invoked on the leading and/or trailing edge of the `wait`
|
||||||
* timeout. The `func` is invoked with the last arguments provided to the
|
* timeout. The `func` is invoked with the last arguments provided to the
|
||||||
* throttled function. Subsequent calls to the throttled function return the
|
* throttled function. Subsequent calls to the throttled function return the
|
||||||
* result of the last `func` invocation.
|
* result of the last `func` invocation.
|
||||||
@@ -18,6 +18,9 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
|||||||
* invoked on the trailing edge of the timeout only if the throttled function
|
* invoked on the trailing edge of the timeout only if the throttled function
|
||||||
* is invoked more than once during the `wait` timeout.
|
* is invoked more than once during the `wait` timeout.
|
||||||
*
|
*
|
||||||
|
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
||||||
|
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
||||||
|
*
|
||||||
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
||||||
* for details over the differences between `_.throttle` and `_.debounce`.
|
* for details over the differences between `_.throttle` and `_.debounce`.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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 _
|
||||||
|
|||||||
@@ -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 _
|
||||||
|
|||||||
2
union.js
2
union.js
@@ -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
|
||||||
|
|||||||
2
uniq.js
2
uniq.js
@@ -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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user