mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28663c1e27 | ||
|
|
cbf5cb1162 | ||
|
|
6d4f76888f |
@@ -1,4 +1,4 @@
|
|||||||
# lodash-es v4.14.0
|
# lodash-es v4.15.0
|
||||||
|
|
||||||
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.15.0-es) for more details.
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import root from './_root.js';
|
|
||||||
|
|
||||||
/** Built-in value references. */
|
|
||||||
var Reflect = root.Reflect;
|
|
||||||
|
|
||||||
export default Reflect;
|
|
||||||
@@ -5,7 +5,7 @@ import baseIndexOf from './_baseIndexOf.js';
|
|||||||
* specifying an index to search from.
|
* specifying an index to search from.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} [array] The array to search.
|
* @param {Array} [array] The array to inspect.
|
||||||
* @param {*} target The value to search for.
|
* @param {*} target The value to search for.
|
||||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* This function is like `arrayIncludes` except that it accepts a comparator.
|
* This function is like `arrayIncludes` except that it accepts a comparator.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} [array] The array to search.
|
* @param {Array} [array] The array to inspect.
|
||||||
* @param {*} target The value to search for.
|
* @param {*} target The value to search for.
|
||||||
* @param {Function} comparator The comparator invoked per element.
|
* @param {Function} comparator The comparator invoked per element.
|
||||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||||
|
|||||||
39
_arrayLikeKeys.js
Normal file
39
_arrayLikeKeys.js
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import baseTimes from './_baseTimes.js';
|
||||||
|
import isArguments from './isArguments.js';
|
||||||
|
import isArray from './isArray.js';
|
||||||
|
import isIndex from './_isIndex.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) {
|
||||||
|
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
||||||
|
// Safari 9 makes `arguments.length` enumerable in strict mode.
|
||||||
|
var result = (isArray(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;
|
||||||
12
_asciiSize.js
Normal file
12
_asciiSize.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import baseProperty from './_baseProperty.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the size of an ASCII `string`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} string The string inspect.
|
||||||
|
* @returns {number} Returns the string size.
|
||||||
|
*/
|
||||||
|
var asciiSize = baseProperty('length');
|
||||||
|
|
||||||
|
export default asciiSize;
|
||||||
12
_asciiToArray.js
Normal file
12
_asciiToArray.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Converts an ASCII `string` to an array.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} string The string to convert.
|
||||||
|
* @returns {Array} Returns the converted array.
|
||||||
|
*/
|
||||||
|
function asciiToArray(string) {
|
||||||
|
return string.split('');
|
||||||
|
}
|
||||||
|
|
||||||
|
export default asciiToArray;
|
||||||
15
_asciiWords.js
Normal file
15
_asciiWords.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/** Used to match words composed of alphanumeric characters. */
|
||||||
|
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Splits an ASCII `string` into an array of its words.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} The string to inspect.
|
||||||
|
* @returns {Array} Returns the words of `string`.
|
||||||
|
*/
|
||||||
|
function asciiWords(string) {
|
||||||
|
return string.match(reAsciiWord) || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
export default asciiWords;
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import eq from './eq.js';
|
|||||||
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to inspect.
|
||||||
* @param {*} key The key to search for.
|
* @param {*} key The key to search for.
|
||||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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 @@
|
|||||||
* support for iteratee shorthands.
|
* support for iteratee shorthands.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to inspect.
|
||||||
* @param {Function} predicate The function invoked per iteration.
|
* @param {Function} predicate The function invoked per iteration.
|
||||||
* @param {number} fromIndex The index to search from.
|
* @param {number} fromIndex The index to search from.
|
||||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* using `eachFunc`.
|
* using `eachFunc`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array|Object} collection The collection to search.
|
* @param {Array|Object} collection The collection to inspect.
|
||||||
* @param {Function} predicate The function invoked per iteration.
|
* @param {Function} predicate The function invoked per iteration.
|
||||||
* @param {Function} eachFunc The function to iterate over `collection`.
|
* @param {Function} eachFunc The function to iterate over `collection`.
|
||||||
* @returns {*} Returns the found element or its key, else `undefined`.
|
* @returns {*} Returns the found element or its key, else `undefined`.
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import baseIsNaN from './_baseIsNaN.js';
|
|||||||
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
|
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to inspect.
|
||||||
* @param {*} value The value to search for.
|
* @param {*} value The value to search for.
|
||||||
* @param {number} fromIndex The index to search from.
|
* @param {number} fromIndex The index to search from.
|
||||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* This function is like `baseIndexOf` except that it accepts a comparator.
|
* This function is like `baseIndexOf` except that it accepts a comparator.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to inspect.
|
||||||
* @param {*} value The value to search for.
|
* @param {*} value The value to search for.
|
||||||
* @param {number} fromIndex The index to search from.
|
* @param {number} fromIndex The index to search from.
|
||||||
* @param {Function} comparator The comparator invoked per element.
|
* @param {Function} comparator The comparator invoked per element.
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
@@ -14,10 +14,11 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|||||||
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
var funcProto = Function.prototype,
|
||||||
|
objectProto = Object.prototype;
|
||||||
|
|
||||||
/** Used to resolve the decompiled source of functions. */
|
/** Used to resolve the decompiled source of functions. */
|
||||||
var funcToString = Function.prototype.toString;
|
var funcToString = funcProto.toString;
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
28
_baseSet.js
28
_baseSet.js
@@ -9,13 +9,16 @@ import toKey from './_toKey.js';
|
|||||||
* The base implementation of `_.set`.
|
* The base implementation of `_.set`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to modify.
|
||||||
* @param {Array|string} path The path of the property to set.
|
* @param {Array|string} path The path of the property to set.
|
||||||
* @param {*} value The value to set.
|
* @param {*} value The value to set.
|
||||||
* @param {Function} [customizer] The function to customize path creation.
|
* @param {Function} [customizer] The function to customize path creation.
|
||||||
* @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;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import baseSet from './_baseSet.js';
|
|||||||
* The base implementation of `_.update`.
|
* The base implementation of `_.update`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to modify.
|
||||||
* @param {Array|string} path The path of the property to update.
|
* @param {Array|string} path The path of the property to update.
|
||||||
* @param {Function} updater The function to produce the updated value.
|
* @param {Function} updater The function to produce the updated value.
|
||||||
* @param {Function} [customizer] The function to customize path creation.
|
* @param {Function} [customizer] The function to customize path creation.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import castSlice from './_castSlice.js';
|
import castSlice from './_castSlice.js';
|
||||||
import reHasComplexSymbol from './_reHasComplexSymbol.js';
|
import hasUnicode from './_hasUnicode.js';
|
||||||
import stringToArray from './_stringToArray.js';
|
import stringToArray from './_stringToArray.js';
|
||||||
import toString from './toString.js';
|
import toString from './toString.js';
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ function createCaseFirst(methodName) {
|
|||||||
return function(string) {
|
return function(string) {
|
||||||
string = toString(string);
|
string = toString(string);
|
||||||
|
|
||||||
var strSymbols = reHasComplexSymbol.test(string)
|
var strSymbols = hasUnicode(string)
|
||||||
? stringToArray(string)
|
? stringToArray(string)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
|||||||
@@ -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,7 +1,7 @@
|
|||||||
import baseRepeat from './_baseRepeat.js';
|
import baseRepeat from './_baseRepeat.js';
|
||||||
import baseToString from './_baseToString.js';
|
import baseToString from './_baseToString.js';
|
||||||
import castSlice from './_castSlice.js';
|
import castSlice from './_castSlice.js';
|
||||||
import reHasComplexSymbol from './_reHasComplexSymbol.js';
|
import hasUnicode from './_hasUnicode.js';
|
||||||
import stringSize from './_stringSize.js';
|
import stringSize from './_stringSize.js';
|
||||||
import stringToArray from './_stringToArray.js';
|
import stringToArray from './_stringToArray.js';
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ function createPadding(length, chars) {
|
|||||||
return charsLength ? baseRepeat(chars, length) : chars;
|
return charsLength ? baseRepeat(chars, length) : chars;
|
||||||
}
|
}
|
||||||
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
|
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
|
||||||
return reHasComplexSymbol.test(chars)
|
return hasUnicode(chars)
|
||||||
? castSlice(stringToArray(result), 0, length).join('')
|
? castSlice(stringToArray(result), 0, length).join('')
|
||||||
: result.slice(0, length);
|
: result.slice(0, 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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
import basePropertyOf from './_basePropertyOf.js';
|
import basePropertyOf from './_basePropertyOf.js';
|
||||||
|
|
||||||
/** Used to map latin-1 supplementary letters to basic latin letters. */
|
/** Used to map Latin Unicode letters to basic Latin letters. */
|
||||||
var deburredLetters = {
|
var deburredLetters = {
|
||||||
|
// Latin-1 Supplement block.
|
||||||
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
|
||||||
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
|
||||||
'\xc7': 'C', '\xe7': 'c',
|
'\xc7': 'C', '\xe7': 'c',
|
||||||
'\xd0': 'D', '\xf0': 'd',
|
'\xd0': 'D', '\xf0': 'd',
|
||||||
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
|
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
|
||||||
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
|
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
|
||||||
'\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
|
'\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
|
||||||
'\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
|
'\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
|
||||||
'\xd1': 'N', '\xf1': 'n',
|
'\xd1': 'N', '\xf1': 'n',
|
||||||
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
|
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
|
||||||
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
|
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
|
||||||
@@ -18,11 +19,48 @@ var deburredLetters = {
|
|||||||
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
|
||||||
'\xc6': 'Ae', '\xe6': 'ae',
|
'\xc6': 'Ae', '\xe6': 'ae',
|
||||||
'\xde': 'Th', '\xfe': 'th',
|
'\xde': 'Th', '\xfe': 'th',
|
||||||
'\xdf': 'ss'
|
'\xdf': 'ss',
|
||||||
|
// Latin Extended-A block.
|
||||||
|
'\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
|
||||||
|
'\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
|
||||||
|
'\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
|
||||||
|
'\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
|
||||||
|
'\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
|
||||||
|
'\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
|
||||||
|
'\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
|
||||||
|
'\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
|
||||||
|
'\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
|
||||||
|
'\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
|
||||||
|
'\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
|
||||||
|
'\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
|
||||||
|
'\u0134': 'J', '\u0135': 'j',
|
||||||
|
'\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
|
||||||
|
'\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
|
||||||
|
'\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
|
||||||
|
'\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
|
||||||
|
'\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
|
||||||
|
'\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
|
||||||
|
'\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
|
||||||
|
'\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
|
||||||
|
'\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
|
||||||
|
'\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
|
||||||
|
'\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
|
||||||
|
'\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
|
||||||
|
'\u0163': 't', '\u0165': 't', '\u0167': 't',
|
||||||
|
'\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
|
||||||
|
'\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
|
||||||
|
'\u0174': 'W', '\u0175': 'w',
|
||||||
|
'\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
|
||||||
|
'\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
|
||||||
|
'\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
|
||||||
|
'\u0132': 'IJ', '\u0133': 'ij',
|
||||||
|
'\u0152': 'Oe', '\u0153': 'oe',
|
||||||
|
'\u0149': "'n", '\u017f': 'ss'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
|
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
|
||||||
|
* letters to basic Latin letters.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {string} letter The matched letter to deburr.
|
* @param {string} letter The matched letter to deburr.
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -42,7 +42,7 @@ var dataViewCtorString = toSource(DataView),
|
|||||||
var getTag = baseGetTag;
|
var getTag = baseGetTag;
|
||||||
|
|
||||||
// Fallback for data views, maps, sets, and weak maps in IE 11,
|
// Fallback for data views, maps, sets, and weak maps in IE 11,
|
||||||
// for data views in Edge, and promises in Node.js.
|
// for data views in Edge < 14, and promises in Node.js.
|
||||||
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
||||||
(Map && getTag(new Map) != mapTag) ||
|
(Map && getTag(new Map) != mapTag) ||
|
||||||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import isArray from './isArray.js';
|
|||||||
import isIndex from './_isIndex.js';
|
import isIndex from './_isIndex.js';
|
||||||
import isKey from './_isKey.js';
|
import isKey from './_isKey.js';
|
||||||
import isLength from './isLength.js';
|
import isLength from './isLength.js';
|
||||||
import isString from './isString.js';
|
|
||||||
import toKey from './_toKey.js';
|
import toKey from './_toKey.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +34,7 @@ function hasPath(object, path, hasFunc) {
|
|||||||
}
|
}
|
||||||
var length = object ? object.length : 0;
|
var length = object ? object.length : 0;
|
||||||
return !!length && isLength(length) && isIndex(key, length) &&
|
return !!length && isLength(length) && isIndex(key, length) &&
|
||||||
(isArray(object) || isString(object) || isArguments(object));
|
(isArray(object) || isArguments(object));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default hasPath;
|
export default hasPath;
|
||||||
|
|||||||
@@ -8,6 +8,17 @@ var rsAstralRange = '\\ud800-\\udfff',
|
|||||||
var rsZWJ = '\\u200d';
|
var rsZWJ = '\\u200d';
|
||||||
|
|
||||||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
||||||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
||||||
|
|
||||||
export default reHasComplexSymbol;
|
/**
|
||||||
|
* Checks if `string` contains Unicode symbols.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} string The string to inspect.
|
||||||
|
* @returns {boolean} Returns `true` if a symbol is found, else `false`.
|
||||||
|
*/
|
||||||
|
function hasUnicode(string) {
|
||||||
|
return reHasUnicode.test(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default hasUnicode;
|
||||||
15
_hasUnicodeWord.js
Normal file
15
_hasUnicodeWord.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/** Used to detect strings that need a more robust regexp to match words. */
|
||||||
|
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if `string` contains a word composed of Unicode symbols.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} string The string to inspect.
|
||||||
|
* @returns {boolean} Returns `true` if a word is found, else `false`.
|
||||||
|
*/
|
||||||
|
function hasUnicodeWord(string) {
|
||||||
|
return reHasUnicodeWord.test(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default hasUnicodeWord;
|
||||||
@@ -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.
|
||||||
|
|||||||
@@ -1,30 +1,6 @@
|
|||||||
import reHasComplexSymbol from './_reHasComplexSymbol.js';
|
import asciiSize from './_asciiSize.js';
|
||||||
|
import hasUnicode from './_hasUnicode.js';
|
||||||
/** Used to compose unicode character classes. */
|
import unicodeSize from './_unicodeSize.js';
|
||||||
var rsAstralRange = '\\ud800-\\udfff',
|
|
||||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
|
||||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
|
||||||
rsVarRange = '\\ufe0e\\ufe0f';
|
|
||||||
|
|
||||||
/** Used to compose unicode capture groups. */
|
|
||||||
var rsAstral = '[' + rsAstralRange + ']',
|
|
||||||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
|
||||||
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
|
||||||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
|
||||||
rsNonAstral = '[^' + rsAstralRange + ']',
|
|
||||||
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
||||||
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
||||||
rsZWJ = '\\u200d';
|
|
||||||
|
|
||||||
/** Used to compose unicode regexes. */
|
|
||||||
var reOptMod = rsModifier + '?',
|
|
||||||
rsOptVar = '[' + rsVarRange + ']?',
|
|
||||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
|
||||||
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
|
||||||
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
|
||||||
|
|
||||||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
||||||
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the number of symbols in `string`.
|
* Gets the number of symbols in `string`.
|
||||||
@@ -34,14 +10,9 @@ var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq,
|
|||||||
* @returns {number} Returns the string size.
|
* @returns {number} Returns the string size.
|
||||||
*/
|
*/
|
||||||
function stringSize(string) {
|
function stringSize(string) {
|
||||||
if (!(string && reHasComplexSymbol.test(string))) {
|
return hasUnicode(string)
|
||||||
return string.length;
|
? unicodeSize(string)
|
||||||
}
|
: asciiSize(string);
|
||||||
var result = reComplexSymbol.lastIndex = 0;
|
|
||||||
while (reComplexSymbol.test(string)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default stringSize;
|
export default stringSize;
|
||||||
|
|||||||
@@ -1,28 +1,6 @@
|
|||||||
/** Used to compose unicode character classes. */
|
import asciiToArray from './_asciiToArray.js';
|
||||||
var rsAstralRange = '\\ud800-\\udfff',
|
import hasUnicode from './_hasUnicode.js';
|
||||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
import unicodeToArray from './_unicodeToArray.js';
|
||||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
|
||||||
rsVarRange = '\\ufe0e\\ufe0f';
|
|
||||||
|
|
||||||
/** Used to compose unicode capture groups. */
|
|
||||||
var rsAstral = '[' + rsAstralRange + ']',
|
|
||||||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
|
||||||
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
|
||||||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
|
||||||
rsNonAstral = '[^' + rsAstralRange + ']',
|
|
||||||
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
|
||||||
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
|
||||||
rsZWJ = '\\u200d';
|
|
||||||
|
|
||||||
/** Used to compose unicode regexes. */
|
|
||||||
var reOptMod = rsModifier + '?',
|
|
||||||
rsOptVar = '[' + rsVarRange + ']?',
|
|
||||||
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
|
||||||
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
|
||||||
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
|
||||||
|
|
||||||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
|
||||||
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts `string` to an array.
|
* Converts `string` to an array.
|
||||||
@@ -32,7 +10,9 @@ var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq,
|
|||||||
* @returns {Array} Returns the converted array.
|
* @returns {Array} Returns the converted array.
|
||||||
*/
|
*/
|
||||||
function stringToArray(string) {
|
function stringToArray(string) {
|
||||||
return string.match(reComplexSymbol);
|
return hasUnicode(string)
|
||||||
|
? unicodeToArray(string)
|
||||||
|
: asciiToArray(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default stringToArray;
|
export default stringToArray;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
|
/** Used for built-in method references. */
|
||||||
|
var funcProto = Function.prototype;
|
||||||
|
|
||||||
/** Used to resolve the decompiled source of functions. */
|
/** Used to resolve the decompiled source of functions. */
|
||||||
var funcToString = Function.prototype.toString;
|
var funcToString = funcProto.toString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts `func` to its source code.
|
* Converts `func` to its source code.
|
||||||
|
|||||||
42
_unicodeSize.js
Normal file
42
_unicodeSize.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/** Used to compose unicode character classes. */
|
||||||
|
var rsAstralRange = '\\ud800-\\udfff',
|
||||||
|
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||||
|
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||||
|
rsVarRange = '\\ufe0e\\ufe0f';
|
||||||
|
|
||||||
|
/** Used to compose unicode capture groups. */
|
||||||
|
var rsAstral = '[' + rsAstralRange + ']',
|
||||||
|
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||||
|
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
||||||
|
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
||||||
|
rsNonAstral = '[^' + rsAstralRange + ']',
|
||||||
|
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
||||||
|
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
||||||
|
rsZWJ = '\\u200d';
|
||||||
|
|
||||||
|
/** Used to compose unicode regexes. */
|
||||||
|
var reOptMod = rsModifier + '?',
|
||||||
|
rsOptVar = '[' + rsVarRange + ']?',
|
||||||
|
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||||
|
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||||||
|
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
||||||
|
|
||||||
|
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
||||||
|
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the size of a Unicode `string`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} string The string inspect.
|
||||||
|
* @returns {number} Returns the string size.
|
||||||
|
*/
|
||||||
|
function unicodeSize(string) {
|
||||||
|
var result = reUnicode.lastIndex = 0;
|
||||||
|
while (reUnicode.test(string)) {
|
||||||
|
result++;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default unicodeSize;
|
||||||
38
_unicodeToArray.js
Normal file
38
_unicodeToArray.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/** Used to compose unicode character classes. */
|
||||||
|
var rsAstralRange = '\\ud800-\\udfff',
|
||||||
|
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||||
|
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||||
|
rsVarRange = '\\ufe0e\\ufe0f';
|
||||||
|
|
||||||
|
/** Used to compose unicode capture groups. */
|
||||||
|
var rsAstral = '[' + rsAstralRange + ']',
|
||||||
|
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||||
|
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
||||||
|
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
||||||
|
rsNonAstral = '[^' + rsAstralRange + ']',
|
||||||
|
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
||||||
|
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
||||||
|
rsZWJ = '\\u200d';
|
||||||
|
|
||||||
|
/** Used to compose unicode regexes. */
|
||||||
|
var reOptMod = rsModifier + '?',
|
||||||
|
rsOptVar = '[' + rsVarRange + ']?',
|
||||||
|
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||||
|
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||||||
|
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
||||||
|
|
||||||
|
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
||||||
|
var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a Unicode `string` to an array.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} string The string to convert.
|
||||||
|
* @returns {Array} Returns the converted array.
|
||||||
|
*/
|
||||||
|
function unicodeToArray(string) {
|
||||||
|
return string.match(reUnicode) || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
export default unicodeToArray;
|
||||||
63
_unicodeWords.js
Normal file
63
_unicodeWords.js
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/** Used to compose unicode character classes. */
|
||||||
|
var rsAstralRange = '\\ud800-\\udfff',
|
||||||
|
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||||
|
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
||||||
|
rsDingbatRange = '\\u2700-\\u27bf',
|
||||||
|
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
||||||
|
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
||||||
|
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
||||||
|
rsPunctuationRange = '\\u2000-\\u206f',
|
||||||
|
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
|
||||||
|
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
||||||
|
rsVarRange = '\\ufe0e\\ufe0f',
|
||||||
|
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
||||||
|
|
||||||
|
/** Used to compose unicode capture groups. */
|
||||||
|
var rsApos = "['\u2019]",
|
||||||
|
rsBreak = '[' + rsBreakRange + ']',
|
||||||
|
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
||||||
|
rsDigits = '\\d+',
|
||||||
|
rsDingbat = '[' + rsDingbatRange + ']',
|
||||||
|
rsLower = '[' + rsLowerRange + ']',
|
||||||
|
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
||||||
|
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
||||||
|
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
||||||
|
rsNonAstral = '[^' + rsAstralRange + ']',
|
||||||
|
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
||||||
|
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
||||||
|
rsUpper = '[' + rsUpperRange + ']',
|
||||||
|
rsZWJ = '\\u200d';
|
||||||
|
|
||||||
|
/** Used to compose unicode regexes. */
|
||||||
|
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
|
||||||
|
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
|
||||||
|
rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
|
||||||
|
rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
|
||||||
|
reOptMod = rsModifier + '?',
|
||||||
|
rsOptVar = '[' + rsVarRange + ']?',
|
||||||
|
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
|
||||||
|
rsSeq = rsOptVar + reOptMod + rsOptJoin,
|
||||||
|
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
|
||||||
|
|
||||||
|
/** Used to match complex or compound words. */
|
||||||
|
var reUnicodeWord = RegExp([
|
||||||
|
rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
||||||
|
rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
||||||
|
rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr,
|
||||||
|
rsUpper + '+' + rsOptUpperContr,
|
||||||
|
rsDigits,
|
||||||
|
rsEmoji
|
||||||
|
].join('|'), 'g');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Splits a Unicode `string` into an array of its words.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} The string to inspect.
|
||||||
|
* @returns {Array} Returns the words of `string`.
|
||||||
|
*/
|
||||||
|
function unicodeWords(string) {
|
||||||
|
return string.match(reUnicodeWord) || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
export default unicodeWords;
|
||||||
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`.
|
||||||
|
|||||||
11
deburr.js
11
deburr.js
@@ -1,8 +1,8 @@
|
|||||||
import deburrLetter from './_deburrLetter.js';
|
import deburrLetter from './_deburrLetter.js';
|
||||||
import toString from './toString.js';
|
import toString from './toString.js';
|
||||||
|
|
||||||
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */
|
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
||||||
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
||||||
|
|
||||||
/** Used to compose unicode character classes. */
|
/** Used to compose unicode character classes. */
|
||||||
var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
||||||
@@ -19,8 +19,9 @@ var reComboMark = RegExp(rsCombo, 'g');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Deburrs `string` by converting
|
* Deburrs `string` by converting
|
||||||
* [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
||||||
* to basic latin letters and removing
|
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
||||||
|
* letters to basic Latin letters and removing
|
||||||
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
@@ -36,7 +37,7 @@ var reComboMark = RegExp(rsCombo, 'g');
|
|||||||
*/
|
*/
|
||||||
function deburr(string) {
|
function deburr(string) {
|
||||||
string = toString(string);
|
string = toString(string);
|
||||||
return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
|
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
export default deburr;
|
export default deburr;
|
||||||
|
|||||||
@@ -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.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import toString from './toString.js';
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @category String
|
* @category String
|
||||||
* @param {string} [string=''] The string to search.
|
* @param {string} [string=''] The string to inspect.
|
||||||
* @param {string} [target] The string to search for.
|
* @param {string} [target] The string to search for.
|
||||||
* @param {number} [position=string.length] The position to search up to.
|
* @param {number} [position=string.length] The position to search up to.
|
||||||
* @returns {boolean} Returns `true` if `string` ends with `target`,
|
* @returns {boolean} Returns `true` if `string` ends with `target`,
|
||||||
|
|||||||
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
|
||||||
|
|||||||
2
find.js
2
find.js
@@ -10,7 +10,7 @@ import findIndex from './findIndex.js';
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to search.
|
* @param {Array|Object} collection The collection to inspect.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity]
|
||||||
* The function invoked per iteration.
|
* The function invoked per iteration.
|
||||||
* @param {number} [fromIndex=0] The index to search from.
|
* @param {number} [fromIndex=0] The index to search from.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ var nativeMax = Math.max;
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to inspect.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity]
|
||||||
* The function invoked per iteration.
|
* The function invoked per iteration.
|
||||||
* @param {number} [fromIndex=0] The index to search from.
|
* @param {number} [fromIndex=0] The index to search from.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import baseIteratee from './_baseIteratee.js';
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
* @category Object
|
* @category Object
|
||||||
* @param {Object} object The object to search.
|
* @param {Object} object The object to inspect.
|
||||||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* @returns {string|undefined} Returns the key of the matched element,
|
* @returns {string|undefined} Returns the key of the matched element,
|
||||||
* else `undefined`.
|
* else `undefined`.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import findLastIndex from './findLastIndex.js';
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object} collection The collection to search.
|
* @param {Array|Object} collection The collection to inspect.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity]
|
||||||
* The function invoked per iteration.
|
* The function invoked per iteration.
|
||||||
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var nativeMax = Math.max,
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to inspect.
|
||||||
* @param {Function} [predicate=_.identity]
|
* @param {Function} [predicate=_.identity]
|
||||||
* The function invoked per iteration.
|
* The function invoked per iteration.
|
||||||
* @param {number} [fromIndex=array.length-1] The index to search from.
|
* @param {number} [fromIndex=array.length-1] The index to search from.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import baseIteratee from './_baseIteratee.js';
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
* @category Object
|
* @category Object
|
||||||
* @param {Object} object The object to search.
|
* @param {Object} object The object to inspect.
|
||||||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||||
* @returns {string|undefined} Returns the key of the matched element,
|
* @returns {string|undefined} Returns the key of the matched element,
|
||||||
* else `undefined`.
|
* else `undefined`.
|
||||||
|
|||||||
@@ -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`.
|
||||||
*
|
*
|
||||||
@@ -18,7 +18,7 @@ var nativeMax = Math.max;
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @category Collection
|
* @category Collection
|
||||||
* @param {Array|Object|string} collection The collection to search.
|
* @param {Array|Object|string} collection The collection to inspect.
|
||||||
* @param {*} value The value to search for.
|
* @param {*} value The value to search for.
|
||||||
* @param {number} [fromIndex=0] The index to search from.
|
* @param {number} [fromIndex=0] The index to search from.
|
||||||
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
|
||||||
|
|||||||
@@ -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`.
|
||||||
*
|
*
|
||||||
@@ -14,7 +14,7 @@ var nativeMax = Math.max;
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @since 0.1.0
|
* @since 0.1.0
|
||||||
* @category Array
|
* @category Array
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to inspect.
|
||||||
* @param {*} value The value to search for.
|
* @param {*} value The value to search for.
|
||||||
* @param {number} [fromIndex=0] The index to search from.
|
* @param {number} [fromIndex=0] The index to search from.
|
||||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -38,7 +38,7 @@ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
function isArguments(value) {
|
function isArguments(value) {
|
||||||
// Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
|
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
||||||
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
||||||
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
23
isEmpty.js
23
isEmpty.js
@@ -3,10 +3,8 @@ import isArguments from './isArguments.js';
|
|||||||
import isArray from './isArray.js';
|
import isArray from './isArray.js';
|
||||||
import isArrayLike from './isArrayLike.js';
|
import isArrayLike from './isArrayLike.js';
|
||||||
import isBuffer from './isBuffer.js';
|
import isBuffer from './isBuffer.js';
|
||||||
import isFunction from './isFunction.js';
|
import isPrototype from './_isPrototype.js';
|
||||||
import isObjectLike from './isObjectLike.js';
|
import nativeKeys from './_nativeKeys.js';
|
||||||
import isString from './isString.js';
|
|
||||||
import keys from './keys.js';
|
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var mapTag = '[object Map]',
|
var mapTag = '[object Map]',
|
||||||
@@ -59,22 +57,23 @@ var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
|
|||||||
*/
|
*/
|
||||||
function isEmpty(value) {
|
function isEmpty(value) {
|
||||||
if (isArrayLike(value) &&
|
if (isArrayLike(value) &&
|
||||||
(isArray(value) || isString(value) || isFunction(value.splice) ||
|
(isArray(value) || typeof value == 'string' ||
|
||||||
isArguments(value) || isBuffer(value))) {
|
typeof value.splice == 'function' || isBuffer(value) || isArguments(value))) {
|
||||||
return !value.length;
|
return !value.length;
|
||||||
}
|
}
|
||||||
if (isObjectLike(value)) {
|
var tag = getTag(value);
|
||||||
var tag = getTag(value);
|
if (tag == mapTag || tag == setTag) {
|
||||||
if (tag == mapTag || tag == setTag) {
|
return !value.size;
|
||||||
return !value.size;
|
}
|
||||||
}
|
if (nonEnumShadows || isPrototype(value)) {
|
||||||
|
return !nativeKeys(value).length;
|
||||||
}
|
}
|
||||||
for (var key in value) {
|
for (var key in value) {
|
||||||
if (hasOwnProperty.call(value, key)) {
|
if (hasOwnProperty.call(value, key)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !(nonEnumShadows && keys(value).length);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
@@ -33,8 +33,7 @@ var objectToString = objectProto.toString;
|
|||||||
*/
|
*/
|
||||||
function isFunction(value) {
|
function isFunction(value) {
|
||||||
// The use of `Object#toString` avoids issues with the `typeof` operator
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||||
// in Safari 8 which returns 'object' for typed array and weak map constructors,
|
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
||||||
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
|
|
||||||
var tag = isObject(value) ? objectToString.call(value) : '';
|
var tag = isObject(value) ? objectToString.call(value) : '';
|
||||||
return tag == funcTag || tag == genTag;
|
return tag == funcTag || tag == genTag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -6,10 +6,11 @@ import isObjectLike from './isObjectLike.js';
|
|||||||
var objectTag = '[object Object]';
|
var objectTag = '[object Object]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
var funcProto = Function.prototype,
|
||||||
|
objectProto = Object.prototype;
|
||||||
|
|
||||||
/** Used to resolve the decompiled source of functions. */
|
/** Used to resolve the decompiled source of functions. */
|
||||||
var funcToString = Function.prototype.toString;
|
var funcToString = funcProto.toString;
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
@@ -19,7 +20,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 +34,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;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user