mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Apply more let/const transforms.
This commit is contained in:
@@ -12,12 +12,12 @@ import listCacheSet from './_listCacheSet.js';
|
|||||||
* @param {Array} [entries] The key-value pairs to cache.
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
*/
|
*/
|
||||||
function ListCache(entries) {
|
function ListCache(entries) {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
length = entries == null ? 0 : entries.length;
|
const length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var entry = entries[index];
|
const entry = entries[index];
|
||||||
this.set(entry[0], entry[1]);
|
this.set(entry[0], entry[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
_Map.js
2
_Map.js
@@ -2,6 +2,6 @@ import getNative from './_getNative.js';
|
|||||||
import root from './_root.js';
|
import root from './_root.js';
|
||||||
|
|
||||||
/* Built-in method references that are verified to be native. */
|
/* Built-in method references that are verified to be native. */
|
||||||
var Map = getNative(root, 'Map');
|
const Map = getNative(root, 'Map');
|
||||||
|
|
||||||
export default Map;
|
export default Map;
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ import mapCacheSet from './_mapCacheSet.js';
|
|||||||
* @param {Array} [entries] The key-value pairs to cache.
|
* @param {Array} [entries] The key-value pairs to cache.
|
||||||
*/
|
*/
|
||||||
function MapCache(entries) {
|
function MapCache(entries) {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
length = entries == null ? 0 : entries.length;
|
const length = entries == null ? 0 : entries.length;
|
||||||
|
|
||||||
this.clear();
|
this.clear();
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var entry = entries[index];
|
const entry = entries[index];
|
||||||
this.set(entry[0], entry[1]);
|
this.set(entry[0], entry[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ import getNative from './_getNative.js';
|
|||||||
import root from './_root.js';
|
import root from './_root.js';
|
||||||
|
|
||||||
/* Built-in method references that are verified to be native. */
|
/* Built-in method references that are verified to be native. */
|
||||||
var Promise = getNative(root, 'Promise');
|
const Promise = getNative(root, 'Promise');
|
||||||
|
|
||||||
export default Promise;
|
export default Promise;
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import isIndex from './_isIndex.js';
|
|||||||
import isTypedArray from './isTypedArray.js';
|
import isTypedArray from './isTypedArray.js';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
const objectProto = Object.prototype;
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array of the enumerable property names of the array-like `value`.
|
* Creates an array of the enumerable property names of the array-like `value`.
|
||||||
@@ -20,15 +20,15 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* @returns {Array} Returns the array of property names.
|
* @returns {Array} Returns the array of property names.
|
||||||
*/
|
*/
|
||||||
function arrayLikeKeys(value, inherited) {
|
function arrayLikeKeys(value, inherited) {
|
||||||
var isArr = isArray(value),
|
const isArr = isArray(value);
|
||||||
isArg = !isArr && isArguments(value),
|
const isArg = !isArr && isArguments(value);
|
||||||
isBuff = !isArr && !isArg && isBuffer(value),
|
const isBuff = !isArr && !isArg && isBuffer(value);
|
||||||
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
const isType = !isArr && !isArg && !isBuff && isTypedArray(value);
|
||||||
skipIndexes = isArr || isArg || isBuff || isType,
|
const skipIndexes = isArr || isArg || isBuff || isType;
|
||||||
result = skipIndexes ? baseTimes(value.length, String) : [],
|
const result = skipIndexes ? baseTimes(value.length, String) : [];
|
||||||
length = result.length;
|
const length = result.length;
|
||||||
|
|
||||||
for (var key in value) {
|
for (const key in value) {
|
||||||
if ((inherited || hasOwnProperty.call(value, key)) &&
|
if ((inherited || hasOwnProperty.call(value, key)) &&
|
||||||
!(skipIndexes && (
|
!(skipIndexes && (
|
||||||
// Safari 9 has enumerable `arguments.length` in strict mode.
|
// Safari 9 has enumerable `arguments.length` in strict mode.
|
||||||
|
|||||||
@@ -24,36 +24,36 @@ const CLONE_FLAT_FLAG = 2;
|
|||||||
const CLONE_SYMBOLS_FLAG = 4;
|
const CLONE_SYMBOLS_FLAG = 4;
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
const argsTag = '[object Arguments]',
|
const argsTag = '[object Arguments]';
|
||||||
arrayTag = '[object Array]',
|
const arrayTag = '[object Array]';
|
||||||
boolTag = '[object Boolean]',
|
const boolTag = '[object Boolean]';
|
||||||
dateTag = '[object Date]',
|
const dateTag = '[object Date]';
|
||||||
errorTag = '[object Error]',
|
const errorTag = '[object Error]';
|
||||||
funcTag = '[object Function]',
|
const funcTag = '[object Function]';
|
||||||
genTag = '[object GeneratorFunction]',
|
const genTag = '[object GeneratorFunction]';
|
||||||
mapTag = '[object Map]',
|
const mapTag = '[object Map]';
|
||||||
numberTag = '[object Number]',
|
const numberTag = '[object Number]';
|
||||||
objectTag = '[object Object]',
|
const objectTag = '[object Object]';
|
||||||
regexpTag = '[object RegExp]',
|
const regexpTag = '[object RegExp]';
|
||||||
setTag = '[object Set]',
|
const setTag = '[object Set]';
|
||||||
stringTag = '[object String]',
|
const stringTag = '[object String]';
|
||||||
symbolTag = '[object Symbol]',
|
const symbolTag = '[object Symbol]';
|
||||||
weakMapTag = '[object WeakMap]';
|
const weakMapTag = '[object WeakMap]';
|
||||||
|
|
||||||
var arrayBufferTag = '[object ArrayBuffer]',
|
const arrayBufferTag = '[object ArrayBuffer]';
|
||||||
dataViewTag = '[object DataView]',
|
const dataViewTag = '[object DataView]';
|
||||||
float32Tag = '[object Float32Array]',
|
const float32Tag = '[object Float32Array]';
|
||||||
float64Tag = '[object Float64Array]',
|
const float64Tag = '[object Float64Array]';
|
||||||
int8Tag = '[object Int8Array]',
|
const int8Tag = '[object Int8Array]';
|
||||||
int16Tag = '[object Int16Array]',
|
const int16Tag = '[object Int16Array]';
|
||||||
int32Tag = '[object Int32Array]',
|
const int32Tag = '[object Int32Array]';
|
||||||
uint8Tag = '[object Uint8Array]',
|
const uint8Tag = '[object Uint8Array]';
|
||||||
uint8ClampedTag = '[object Uint8ClampedArray]',
|
const uint8ClampedTag = '[object Uint8ClampedArray]';
|
||||||
uint16Tag = '[object Uint16Array]',
|
const uint16Tag = '[object Uint16Array]';
|
||||||
uint32Tag = '[object Uint32Array]';
|
const uint32Tag = '[object Uint32Array]';
|
||||||
|
|
||||||
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
||||||
var cloneableTags = {};
|
const cloneableTags = {};
|
||||||
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
||||||
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
||||||
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
||||||
@@ -85,10 +85,10 @@ cloneableTags[weakMapTag] = false;
|
|||||||
* @returns {*} Returns the cloned value.
|
* @returns {*} Returns the cloned value.
|
||||||
*/
|
*/
|
||||||
function baseClone(value, bitmask, customizer, key, object, stack) {
|
function baseClone(value, bitmask, customizer, key, object, stack) {
|
||||||
var result,
|
let result;
|
||||||
isDeep = bitmask & CLONE_DEEP_FLAG,
|
const isDeep = bitmask & CLONE_DEEP_FLAG;
|
||||||
isFlat = bitmask & CLONE_FLAT_FLAG,
|
const isFlat = bitmask & CLONE_FLAT_FLAG;
|
||||||
isFull = bitmask & CLONE_SYMBOLS_FLAG;
|
const isFull = bitmask & CLONE_SYMBOLS_FLAG;
|
||||||
|
|
||||||
if (customizer) {
|
if (customizer) {
|
||||||
result = object ? customizer(value, key, object, stack) : customizer(value);
|
result = object ? customizer(value, key, object, stack) : customizer(value);
|
||||||
@@ -99,15 +99,15 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
|
|||||||
if (!isObject(value)) {
|
if (!isObject(value)) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
var isArr = isArray(value);
|
const isArr = isArray(value);
|
||||||
if (isArr) {
|
if (isArr) {
|
||||||
result = initCloneArray(value);
|
result = initCloneArray(value);
|
||||||
if (!isDeep) {
|
if (!isDeep) {
|
||||||
return copyArray(value, result);
|
return copyArray(value, result);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var tag = getTag(value),
|
const tag = getTag(value);
|
||||||
isFunc = tag == funcTag || tag == genTag;
|
const isFunc = tag == funcTag || tag == genTag;
|
||||||
|
|
||||||
if (isBuffer(value)) {
|
if (isBuffer(value)) {
|
||||||
return cloneBuffer(value, isDeep);
|
return cloneBuffer(value, isDeep);
|
||||||
@@ -128,17 +128,17 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
|
|||||||
}
|
}
|
||||||
// Check for circular references and return its corresponding clone.
|
// Check for circular references and return its corresponding clone.
|
||||||
stack || (stack = new Stack);
|
stack || (stack = new Stack);
|
||||||
var stacked = stack.get(value);
|
const stacked = stack.get(value);
|
||||||
if (stacked) {
|
if (stacked) {
|
||||||
return stacked;
|
return stacked;
|
||||||
}
|
}
|
||||||
stack.set(value, result);
|
stack.set(value, result);
|
||||||
|
|
||||||
var keysFunc = isFull
|
const keysFunc = isFull
|
||||||
? (isFlat ? getAllKeysIn : getAllKeys)
|
? (isFlat ? getAllKeysIn : getAllKeys)
|
||||||
: (isFlat ? keysIn : keys);
|
: (isFlat ? keysIn : keys);
|
||||||
|
|
||||||
var props = isArr ? undefined : keysFunc(value);
|
const props = isArr ? undefined : keysFunc(value);
|
||||||
arrayEach(props || value, (subValue, key) => {
|
arrayEach(props || value, (subValue, key) => {
|
||||||
if (props) {
|
if (props) {
|
||||||
key = subValue;
|
key = subValue;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import baseUnary from './_baseUnary.js';
|
|||||||
import cacheHas from './_cacheHas.js';
|
import cacheHas from './_cacheHas.js';
|
||||||
|
|
||||||
/** Used as the size to enable large array optimizations. */
|
/** Used as the size to enable large array optimizations. */
|
||||||
var LARGE_ARRAY_SIZE = 200;
|
const LARGE_ARRAY_SIZE = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of methods like `_.difference` without support
|
* The base implementation of methods like `_.difference` without support
|
||||||
@@ -20,12 +20,12 @@ var LARGE_ARRAY_SIZE = 200;
|
|||||||
* @returns {Array} Returns the new array of filtered values.
|
* @returns {Array} Returns the new array of filtered values.
|
||||||
*/
|
*/
|
||||||
function baseDifference(array, values, iteratee, comparator) {
|
function baseDifference(array, values, iteratee, comparator) {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
includes = arrayIncludes,
|
let includes = arrayIncludes;
|
||||||
isCommon = true,
|
let isCommon = true;
|
||||||
length = array.length,
|
const length = array.length;
|
||||||
result = [],
|
const result = [];
|
||||||
valuesLength = values.length;
|
const valuesLength = values.length;
|
||||||
|
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return result;
|
return result;
|
||||||
@@ -44,12 +44,12 @@ function baseDifference(array, values, iteratee, comparator) {
|
|||||||
}
|
}
|
||||||
outer:
|
outer:
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var value = array[index],
|
let value = array[index];
|
||||||
computed = iteratee == null ? value : iteratee(value);
|
const computed = iteratee == null ? value : iteratee(value);
|
||||||
|
|
||||||
value = (comparator || value !== 0) ? value : 0;
|
value = (comparator || value !== 0) ? value : 0;
|
||||||
if (isCommon && computed === computed) {
|
if (isCommon && computed === computed) {
|
||||||
var valuesIndex = valuesLength;
|
let valuesIndex = valuesLength;
|
||||||
while (valuesIndex--) {
|
while (valuesIndex--) {
|
||||||
if (values[valuesIndex] === computed) {
|
if (values[valuesIndex] === computed) {
|
||||||
continue outer;
|
continue outer;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import baseUnary from './_baseUnary.js';
|
|||||||
import cacheHas from './_cacheHas.js';
|
import cacheHas from './_cacheHas.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 nativeMin = Math.min;
|
const nativeMin = Math.min;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of methods like `_.intersection`, without support
|
* The base implementation of methods like `_.intersection`, without support
|
||||||
@@ -19,13 +19,14 @@ var nativeMin = Math.min;
|
|||||||
* @returns {Array} Returns the new array of shared values.
|
* @returns {Array} Returns the new array of shared values.
|
||||||
*/
|
*/
|
||||||
function baseIntersection(arrays, iteratee, comparator) {
|
function baseIntersection(arrays, iteratee, comparator) {
|
||||||
var includes = comparator ? arrayIncludesWith : arrayIncludes,
|
const includes = comparator ? arrayIncludesWith : arrayIncludes;
|
||||||
length = arrays[0].length,
|
const length = arrays[0].length;
|
||||||
othLength = arrays.length,
|
const othLength = arrays.length;
|
||||||
othIndex = othLength,
|
const caches = Array(othLength);
|
||||||
caches = Array(othLength),
|
const result = [];
|
||||||
maxLength = Infinity,
|
|
||||||
result = [];
|
let maxLength = Infinity;
|
||||||
|
let othIndex = othLength;
|
||||||
|
|
||||||
while (othIndex--) {
|
while (othIndex--) {
|
||||||
var array = arrays[othIndex];
|
var array = arrays[othIndex];
|
||||||
@@ -39,13 +40,13 @@ function baseIntersection(arrays, iteratee, comparator) {
|
|||||||
}
|
}
|
||||||
array = arrays[0];
|
array = arrays[0];
|
||||||
|
|
||||||
var index = -1,
|
let index = -1;
|
||||||
seen = caches[0];
|
const seen = caches[0];
|
||||||
|
|
||||||
outer:
|
outer:
|
||||||
while (++index < length && result.length < maxLength) {
|
while (++index < length && result.length < maxLength) {
|
||||||
var value = array[index],
|
let value = array[index];
|
||||||
computed = iteratee ? iteratee(value) : value;
|
const computed = iteratee ? iteratee(value) : value;
|
||||||
|
|
||||||
value = (comparator || value !== 0) ? value : 0;
|
value = (comparator || value !== 0) ? value : 0;
|
||||||
if (!(seen
|
if (!(seen
|
||||||
@@ -54,7 +55,7 @@ function baseIntersection(arrays, iteratee, comparator) {
|
|||||||
)) {
|
)) {
|
||||||
othIndex = othLength;
|
othIndex = othLength;
|
||||||
while (--othIndex) {
|
while (--othIndex) {
|
||||||
var cache = caches[othIndex];
|
const cache = caches[othIndex];
|
||||||
if (!(cache
|
if (!(cache
|
||||||
? cacheHas(cache, computed)
|
? cacheHas(cache, computed)
|
||||||
: includes(arrays[othIndex], computed, comparator))
|
: includes(arrays[othIndex], computed, comparator))
|
||||||
|
|||||||
@@ -8,18 +8,18 @@ import isBuffer from './isBuffer.js';
|
|||||||
import isTypedArray from './isTypedArray.js';
|
import isTypedArray from './isTypedArray.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for value comparisons. */
|
/** Used to compose bitmasks for value comparisons. */
|
||||||
var COMPARE_PARTIAL_FLAG = 1;
|
const COMPARE_PARTIAL_FLAG = 1;
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var argsTag = '[object Arguments]',
|
const argsTag = '[object Arguments]';
|
||||||
arrayTag = '[object Array]',
|
const arrayTag = '[object Array]';
|
||||||
objectTag = '[object Object]';
|
const objectTag = '[object Object]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
const objectProto = Object.prototype;
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
||||||
@@ -36,17 +36,17 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
||||||
*/
|
*/
|
||||||
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
||||||
var objIsArr = isArray(object),
|
let objIsArr = isArray(object);
|
||||||
othIsArr = isArray(other),
|
const othIsArr = isArray(other);
|
||||||
objTag = objIsArr ? arrayTag : getTag(object),
|
let objTag = objIsArr ? arrayTag : getTag(object);
|
||||||
othTag = othIsArr ? arrayTag : getTag(other);
|
let othTag = othIsArr ? arrayTag : getTag(other);
|
||||||
|
|
||||||
objTag = objTag == argsTag ? objectTag : objTag;
|
objTag = objTag == argsTag ? objectTag : objTag;
|
||||||
othTag = othTag == argsTag ? objectTag : othTag;
|
othTag = othTag == argsTag ? objectTag : othTag;
|
||||||
|
|
||||||
var objIsObj = objTag == objectTag,
|
let objIsObj = objTag == objectTag;
|
||||||
othIsObj = othTag == objectTag,
|
const othIsObj = othTag == objectTag;
|
||||||
isSameTag = objTag == othTag;
|
const isSameTag = objTag == othTag;
|
||||||
|
|
||||||
if (isSameTag && isBuffer(object)) {
|
if (isSameTag && isBuffer(object)) {
|
||||||
if (!isBuffer(other)) {
|
if (!isBuffer(other)) {
|
||||||
@@ -62,12 +62,12 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|||||||
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
||||||
}
|
}
|
||||||
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
||||||
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
const objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__');
|
||||||
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
const othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
||||||
|
|
||||||
if (objIsWrapped || othIsWrapped) {
|
if (objIsWrapped || othIsWrapped) {
|
||||||
var objUnwrapped = objIsWrapped ? object.value() : object,
|
const objUnwrapped = objIsWrapped ? object.value() : object;
|
||||||
othUnwrapped = othIsWrapped ? other.value() : other;
|
const othUnwrapped = othIsWrapped ? other.value() : other;
|
||||||
|
|
||||||
stack || (stack = new Stack);
|
stack || (stack = new Stack);
|
||||||
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import Stack from './_Stack.js';
|
|||||||
import baseIsEqual from './_baseIsEqual.js';
|
import baseIsEqual from './_baseIsEqual.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for value comparisons. */
|
/** Used to compose bitmasks for value comparisons. */
|
||||||
var COMPARE_PARTIAL_FLAG = 1,
|
const COMPARE_PARTIAL_FLAG = 1;
|
||||||
COMPARE_UNORDERED_FLAG = 2;
|
const COMPARE_UNORDERED_FLAG = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
||||||
@@ -16,16 +16,18 @@ var COMPARE_PARTIAL_FLAG = 1,
|
|||||||
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
||||||
*/
|
*/
|
||||||
function baseIsMatch(object, source, matchData, customizer) {
|
function baseIsMatch(object, source, matchData, customizer) {
|
||||||
var index = matchData.length,
|
let index = matchData.length;
|
||||||
length = index,
|
const length = index;
|
||||||
noCustomizer = !customizer;
|
const noCustomizer = !customizer;
|
||||||
|
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
return !length;
|
return !length;
|
||||||
}
|
}
|
||||||
|
let data;
|
||||||
|
let result;
|
||||||
object = Object(object);
|
object = Object(object);
|
||||||
while (index--) {
|
while (index--) {
|
||||||
var data = matchData[index];
|
data = matchData[index];
|
||||||
if ((noCustomizer && data[2])
|
if ((noCustomizer && data[2])
|
||||||
? data[1] !== object[data[0]]
|
? data[1] !== object[data[0]]
|
||||||
: !(data[0] in object)
|
: !(data[0] in object)
|
||||||
@@ -35,18 +37,18 @@ function baseIsMatch(object, source, matchData, customizer) {
|
|||||||
}
|
}
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
data = matchData[index];
|
data = matchData[index];
|
||||||
var key = data[0],
|
const key = data[0];
|
||||||
objValue = object[key],
|
const objValue = object[key];
|
||||||
srcValue = data[1];
|
const srcValue = data[1];
|
||||||
|
|
||||||
if (noCustomizer && data[2]) {
|
if (noCustomizer && data[2]) {
|
||||||
if (objValue === undefined && !(key in object)) {
|
if (objValue === undefined && !(key in object)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var stack = new Stack;
|
const stack = new Stack;
|
||||||
if (customizer) {
|
if (customizer) {
|
||||||
var result = customizer(objValue, srcValue, key, object, source, stack);
|
result = customizer(objValue, srcValue, key, object, source, stack);
|
||||||
}
|
}
|
||||||
if (!(result === undefined
|
if (!(result === undefined
|
||||||
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
|
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
|
||||||
|
|||||||
@@ -3,34 +3,34 @@ import isLength from './isLength.js';
|
|||||||
import isObjectLike from './isObjectLike.js';
|
import isObjectLike from './isObjectLike.js';
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var argsTag = '[object Arguments]',
|
const argsTag = '[object Arguments]';
|
||||||
arrayTag = '[object Array]',
|
const arrayTag = '[object Array]';
|
||||||
boolTag = '[object Boolean]',
|
const boolTag = '[object Boolean]';
|
||||||
dateTag = '[object Date]',
|
const dateTag = '[object Date]';
|
||||||
errorTag = '[object Error]',
|
const errorTag = '[object Error]';
|
||||||
funcTag = '[object Function]',
|
const funcTag = '[object Function]';
|
||||||
mapTag = '[object Map]',
|
const mapTag = '[object Map]';
|
||||||
numberTag = '[object Number]',
|
const numberTag = '[object Number]';
|
||||||
objectTag = '[object Object]',
|
const objectTag = '[object Object]';
|
||||||
regexpTag = '[object RegExp]',
|
const regexpTag = '[object RegExp]';
|
||||||
setTag = '[object Set]',
|
const setTag = '[object Set]';
|
||||||
stringTag = '[object String]',
|
const stringTag = '[object String]';
|
||||||
weakMapTag = '[object WeakMap]';
|
const weakMapTag = '[object WeakMap]';
|
||||||
|
|
||||||
var arrayBufferTag = '[object ArrayBuffer]',
|
const arrayBufferTag = '[object ArrayBuffer]';
|
||||||
dataViewTag = '[object DataView]',
|
const dataViewTag = '[object DataView]';
|
||||||
float32Tag = '[object Float32Array]',
|
const float32Tag = '[object Float32Array]';
|
||||||
float64Tag = '[object Float64Array]',
|
const float64Tag = '[object Float64Array]';
|
||||||
int8Tag = '[object Int8Array]',
|
const int8Tag = '[object Int8Array]';
|
||||||
int16Tag = '[object Int16Array]',
|
const int16Tag = '[object Int16Array]';
|
||||||
int32Tag = '[object Int32Array]',
|
const int32Tag = '[object Int32Array]';
|
||||||
uint8Tag = '[object Uint8Array]',
|
const uint8Tag = '[object Uint8Array]';
|
||||||
uint8ClampedTag = '[object Uint8ClampedArray]',
|
const uint8ClampedTag = '[object Uint8ClampedArray]';
|
||||||
uint16Tag = '[object Uint16Array]',
|
const uint16Tag = '[object Uint16Array]';
|
||||||
uint32Tag = '[object Uint32Array]';
|
const uint32Tag = '[object Uint32Array]';
|
||||||
|
|
||||||
/** Used to identify `toStringTag` values of typed arrays. */
|
/** Used to identify `toStringTag` values of typed arrays. */
|
||||||
var typedArrayTags = {};
|
const typedArrayTags = {};
|
||||||
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
||||||
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
||||||
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
||||||
|
|||||||
@@ -29,24 +29,24 @@ import toPlainObject from './toPlainObject.js';
|
|||||||
* counterparts.
|
* counterparts.
|
||||||
*/
|
*/
|
||||||
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
||||||
var objValue = object[key],
|
const objValue = object[key];
|
||||||
srcValue = source[key],
|
const srcValue = source[key];
|
||||||
stacked = stack.get(srcValue);
|
const stacked = stack.get(srcValue);
|
||||||
|
|
||||||
if (stacked) {
|
if (stacked) {
|
||||||
assignMergeValue(object, key, stacked);
|
assignMergeValue(object, key, stacked);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var newValue = customizer
|
let newValue = customizer
|
||||||
? customizer(objValue, srcValue, `${ key }`, object, source, stack)
|
? customizer(objValue, srcValue, `${ key }`, object, source, stack)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
var isCommon = newValue === undefined;
|
let isCommon = newValue === undefined;
|
||||||
|
|
||||||
if (isCommon) {
|
if (isCommon) {
|
||||||
var isArr = isArray(srcValue),
|
const isArr = isArray(srcValue);
|
||||||
isBuff = !isArr && isBuffer(srcValue),
|
const isBuff = !isArr && isBuffer(srcValue);
|
||||||
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
const isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
||||||
|
|
||||||
newValue = srcValue;
|
newValue = srcValue;
|
||||||
if (isArr || isBuff || isTyped) {
|
if (isArr || isBuff || isTyped) {
|
||||||
|
|||||||
@@ -12,14 +12,13 @@ import castPath from './_castPath.js';
|
|||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
*/
|
*/
|
||||||
function basePickBy(object, paths, predicate) {
|
function basePickBy(object, paths, predicate) {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
length = paths.length,
|
const length = paths.length;
|
||||||
result = {};
|
const result = {};
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var path = paths[index],
|
const path = paths[index];
|
||||||
value = baseGet(object, path);
|
const value = baseGet(object, path);
|
||||||
|
|
||||||
if (predicate(value, path)) {
|
if (predicate(value, path)) {
|
||||||
baseSet(result, castPath(path, object), value);
|
baseSet(result, castPath(path, object), value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import baseUnary from './_baseUnary.js';
|
|||||||
import copyArray from './_copyArray.js';
|
import copyArray from './_copyArray.js';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var arrayProto = Array.prototype;
|
const arrayProto = Array.prototype;
|
||||||
|
|
||||||
/** Built-in value references. */
|
/** Built-in value references. */
|
||||||
var splice = arrayProto.splice;
|
const splice = arrayProto.splice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.pullAllBy` without support for iteratee
|
* The base implementation of `_.pullAllBy` without support for iteratee
|
||||||
@@ -22,10 +22,11 @@ var splice = arrayProto.splice;
|
|||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
*/
|
*/
|
||||||
function basePullAll(array, values, iteratee, comparator) {
|
function basePullAll(array, values, iteratee, comparator) {
|
||||||
var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
|
const indexOf = comparator ? baseIndexOfWith : baseIndexOf;
|
||||||
index = -1,
|
const length = values.length;
|
||||||
length = values.length,
|
|
||||||
seen = array;
|
let index = -1;
|
||||||
|
let seen = array;
|
||||||
|
|
||||||
if (array === values) {
|
if (array === values) {
|
||||||
values = copyArray(values);
|
values = copyArray(values);
|
||||||
@@ -34,9 +35,9 @@ function basePullAll(array, values, iteratee, comparator) {
|
|||||||
seen = arrayMap(array, baseUnary(iteratee));
|
seen = arrayMap(array, baseUnary(iteratee));
|
||||||
}
|
}
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var fromIndex = 0,
|
let fromIndex = 0;
|
||||||
value = values[index],
|
const value = values[index];
|
||||||
computed = iteratee ? iteratee(value) : value;
|
const computed = iteratee ? iteratee(value) : value;
|
||||||
|
|
||||||
while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
|
while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
|
||||||
if (seen !== array) {
|
if (seen !== array) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* 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 nativeFloor = Math.floor,
|
const nativeFloor = Math.floor;
|
||||||
nativeRandom = Math.random;
|
const nativeRandom = Math.random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.random` without support for returning
|
* The base implementation of `_.random` without support for returning
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* 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 nativeCeil = Math.ceil,
|
const nativeCeil = Math.ceil;
|
||||||
nativeMax = Math.max;
|
const nativeMax = Math.max;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.range` and `_.rangeRight` which doesn't
|
* The base implementation of `_.range` and `_.rangeRight` which doesn't
|
||||||
@@ -14,9 +14,9 @@ var nativeCeil = Math.ceil,
|
|||||||
* @returns {Array} Returns the range of numbers.
|
* @returns {Array} Returns the range of numbers.
|
||||||
*/
|
*/
|
||||||
function baseRange(start, end, step, fromRight) {
|
function baseRange(start, end, step, fromRight) {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
|
let length = nativeMax(nativeCeil((end - start) / (step || 1)), 0);
|
||||||
result = Array(length);
|
const result = Array(length);
|
||||||
|
|
||||||
while (length--) {
|
while (length--) {
|
||||||
result[fromRight ? length : ++index] = start;
|
result[fromRight ? length : ++index] = start;
|
||||||
|
|||||||
15
_baseSet.js
15
_baseSet.js
@@ -20,17 +20,18 @@ function baseSet(object, path, value, customizer) {
|
|||||||
}
|
}
|
||||||
path = castPath(path, object);
|
path = castPath(path, object);
|
||||||
|
|
||||||
var index = -1,
|
const length = path.length;
|
||||||
length = path.length,
|
const lastIndex = length - 1;
|
||||||
lastIndex = length - 1,
|
|
||||||
nested = object;
|
let index = -1;
|
||||||
|
let nested = object;
|
||||||
|
|
||||||
while (nested != null && ++index < length) {
|
while (nested != null && ++index < length) {
|
||||||
var key = toKey(path[index]),
|
const key = toKey(path[index]);
|
||||||
newValue = value;
|
let newValue = value;
|
||||||
|
|
||||||
if (index != lastIndex) {
|
if (index != lastIndex) {
|
||||||
var objValue = nested[key];
|
const objValue = nested[key];
|
||||||
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
||||||
if (newValue === undefined) {
|
if (newValue === undefined) {
|
||||||
newValue = isObject(objValue)
|
newValue = isObject(objValue)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* @returns {Array} Returns the slice of `array`.
|
* @returns {Array} Returns the slice of `array`.
|
||||||
*/
|
*/
|
||||||
function baseSlice(array, start, end) {
|
function baseSlice(array, start, end) {
|
||||||
var index = -1,
|
let index = -1,
|
||||||
length = array.length;
|
length = array.length;
|
||||||
|
|
||||||
if (start < 0) {
|
if (start < 0) {
|
||||||
@@ -21,7 +21,7 @@ function baseSlice(array, start, end) {
|
|||||||
length = start > end ? 0 : ((end - start) >>> 0);
|
length = start > end ? 0 : ((end - start) >>> 0);
|
||||||
start >>>= 0;
|
start >>>= 0;
|
||||||
|
|
||||||
var result = Array(length);
|
const result = Array(length);
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
result[index] = array[index + start];
|
result[index] = array[index + start];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import identity from './identity.js';
|
|||||||
import isSymbol from './isSymbol.js';
|
import isSymbol from './isSymbol.js';
|
||||||
|
|
||||||
/** Used as references for the maximum length and index of an array. */
|
/** Used as references for the maximum length and index of an array. */
|
||||||
var MAX_ARRAY_LENGTH = 4294967295,
|
const MAX_ARRAY_LENGTH = 4294967295;
|
||||||
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
|
const HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
|
* The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
|
||||||
@@ -19,14 +19,13 @@ var MAX_ARRAY_LENGTH = 4294967295,
|
|||||||
* into `array`.
|
* into `array`.
|
||||||
*/
|
*/
|
||||||
function baseSortedIndex(array, value, retHighest) {
|
function baseSortedIndex(array, value, retHighest) {
|
||||||
var low = 0,
|
let low = 0;
|
||||||
high = array == null ? low : array.length;
|
let high = array == null ? low : array.length;
|
||||||
|
|
||||||
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
|
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
|
||||||
while (low < high) {
|
while (low < high) {
|
||||||
var mid = (low + high) >>> 1,
|
const mid = (low + high) >>> 1;
|
||||||
computed = array[mid];
|
const computed = array[mid];
|
||||||
|
|
||||||
if (computed !== null && !isSymbol(computed) &&
|
if (computed !== null && !isSymbol(computed) &&
|
||||||
(retHighest ? (computed <= value) : (computed < value))) {
|
(retHighest ? (computed <= value) : (computed < value))) {
|
||||||
low = mid + 1;
|
low = mid + 1;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import isSymbol from './isSymbol.js';
|
import isSymbol from './isSymbol.js';
|
||||||
|
|
||||||
/** Used as references for the maximum length and index of an array. */
|
/** Used as references for the maximum length and index of an array. */
|
||||||
var MAX_ARRAY_LENGTH = 4294967295,
|
const MAX_ARRAY_LENGTH = 4294967295;
|
||||||
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
|
const MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
|
||||||
|
|
||||||
/* 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 nativeFloor = Math.floor,
|
const nativeFloor = Math.floor, nativeMin = Math.min;
|
||||||
nativeMin = Math.min;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
|
* The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
|
||||||
@@ -24,20 +23,20 @@ var nativeFloor = Math.floor,
|
|||||||
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
||||||
value = iteratee(value);
|
value = iteratee(value);
|
||||||
|
|
||||||
var low = 0,
|
let low = 0;
|
||||||
high = array == null ? 0 : array.length,
|
let high = array == null ? 0 : array.length;
|
||||||
valIsNaN = value !== value,
|
const valIsNaN = value !== value;
|
||||||
valIsNull = value === null,
|
const valIsNull = value === null;
|
||||||
valIsSymbol = isSymbol(value),
|
const valIsSymbol = isSymbol(value);
|
||||||
valIsUndefined = value === undefined;
|
const valIsUndefined = value === undefined;
|
||||||
|
|
||||||
while (low < high) {
|
while (low < high) {
|
||||||
var mid = nativeFloor((low + high) / 2),
|
const mid = nativeFloor((low + high) / 2);
|
||||||
computed = iteratee(array[mid]),
|
const computed = iteratee(array[mid]);
|
||||||
othIsDefined = computed !== undefined,
|
const othIsDefined = computed !== undefined;
|
||||||
othIsNull = computed === null,
|
const othIsNull = computed === null;
|
||||||
othIsReflexive = computed === computed,
|
const othIsReflexive = computed === computed;
|
||||||
othIsSymbol = isSymbol(computed);
|
const othIsSymbol = isSymbol(computed);
|
||||||
|
|
||||||
if (valIsNaN) {
|
if (valIsNaN) {
|
||||||
var setLow = retHighest || othIsReflexive;
|
var setLow = retHighest || othIsReflexive;
|
||||||
|
|||||||
@@ -10,17 +10,17 @@ import eq from './eq.js';
|
|||||||
* @returns {Array} Returns the new duplicate free array.
|
* @returns {Array} Returns the new duplicate free array.
|
||||||
*/
|
*/
|
||||||
function baseSortedUniq(array, iteratee) {
|
function baseSortedUniq(array, iteratee) {
|
||||||
var index = -1,
|
let seen;
|
||||||
length = array.length,
|
let index = -1;
|
||||||
resIndex = 0,
|
let resIndex = 0;
|
||||||
result = [];
|
|
||||||
|
const length = array.length;
|
||||||
|
const result = [];
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var value = array[index],
|
const value = array[index], computed = iteratee ? iteratee(value) : value;
|
||||||
computed = iteratee ? iteratee(value) : value;
|
|
||||||
|
|
||||||
if (!index || !eq(computed, seen)) {
|
if (!index || !eq(computed, seen)) {
|
||||||
var seen = computed;
|
seen = computed;
|
||||||
result[resIndex++] = value === 0 ? 0 : value;
|
result[resIndex++] = value === 0 ? 0 : value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
23
_baseUniq.js
23
_baseUniq.js
@@ -6,7 +6,7 @@ import createSet from './_createSet.js';
|
|||||||
import setToArray from './_setToArray.js';
|
import setToArray from './_setToArray.js';
|
||||||
|
|
||||||
/** Used as the size to enable large array optimizations. */
|
/** Used as the size to enable large array optimizations. */
|
||||||
var LARGE_ARRAY_SIZE = 200;
|
const LARGE_ARRAY_SIZE = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
|
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
|
||||||
@@ -18,19 +18,20 @@ var LARGE_ARRAY_SIZE = 200;
|
|||||||
* @returns {Array} Returns the new duplicate free array.
|
* @returns {Array} Returns the new duplicate free array.
|
||||||
*/
|
*/
|
||||||
function baseUniq(array, iteratee, comparator) {
|
function baseUniq(array, iteratee, comparator) {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
includes = arrayIncludes,
|
let includes = arrayIncludes;
|
||||||
length = array.length,
|
let isCommon = true;
|
||||||
isCommon = true,
|
|
||||||
result = [],
|
const length = array.length;
|
||||||
seen = result;
|
const result = [];
|
||||||
|
let seen = result;
|
||||||
|
|
||||||
if (comparator) {
|
if (comparator) {
|
||||||
isCommon = false;
|
isCommon = false;
|
||||||
includes = arrayIncludesWith;
|
includes = arrayIncludesWith;
|
||||||
}
|
}
|
||||||
else if (length >= LARGE_ARRAY_SIZE) {
|
else if (length >= LARGE_ARRAY_SIZE) {
|
||||||
var set = iteratee ? null : createSet(array);
|
const set = iteratee ? null : createSet(array);
|
||||||
if (set) {
|
if (set) {
|
||||||
return setToArray(set);
|
return setToArray(set);
|
||||||
}
|
}
|
||||||
@@ -43,12 +44,12 @@ function baseUniq(array, iteratee, comparator) {
|
|||||||
}
|
}
|
||||||
outer:
|
outer:
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var value = array[index],
|
let value = array[index];
|
||||||
computed = iteratee ? iteratee(value) : value;
|
const computed = iteratee ? iteratee(value) : value;
|
||||||
|
|
||||||
value = (comparator || value !== 0) ? value : 0;
|
value = (comparator || value !== 0) ? value : 0;
|
||||||
if (isCommon && computed === computed) {
|
if (isCommon && computed === computed) {
|
||||||
var seenIndex = seen.length;
|
let seenIndex = seen.length;
|
||||||
while (seenIndex--) {
|
while (seenIndex--) {
|
||||||
if (seen[seenIndex] === computed) {
|
if (seen[seenIndex] === computed) {
|
||||||
continue outer;
|
continue outer;
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import root from './_root.js';
|
import root from './_root.js';
|
||||||
|
|
||||||
/** Detect free variable `exports`. */
|
/** Detect free variable `exports`. */
|
||||||
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
const freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
||||||
|
|
||||||
/** Detect free variable `module`. */
|
/** Detect free variable `module`. */
|
||||||
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
const 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;
|
const moduleExports = freeModule && freeModule.exports === freeExports;
|
||||||
|
|
||||||
/** Built-in value references. */
|
/** Built-in value references. */
|
||||||
var Buffer = moduleExports ? root.Buffer : undefined,
|
const Buffer = moduleExports ? root.Buffer : undefined, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
||||||
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a clone of `buffer`.
|
* Creates a clone of `buffer`.
|
||||||
@@ -25,8 +24,8 @@ function cloneBuffer(buffer, isDeep) {
|
|||||||
if (isDeep) {
|
if (isDeep) {
|
||||||
return buffer.slice();
|
return buffer.slice();
|
||||||
}
|
}
|
||||||
var length = buffer.length,
|
const length = buffer.length;
|
||||||
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
const result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
||||||
|
|
||||||
buffer.copy(result);
|
buffer.copy(result);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import Symbol from './_Symbol.js';
|
import Symbol from './_Symbol.js';
|
||||||
|
|
||||||
/** Used to convert symbols to primitives and strings. */
|
/** Used to convert symbols to primitives and strings. */
|
||||||
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
const symbolProto = Symbol ? Symbol.prototype : undefined;
|
||||||
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
const symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a clone of the `symbol` object.
|
* Creates a clone of the `symbol` object.
|
||||||
|
|||||||
@@ -10,15 +10,15 @@ import isSymbol from './isSymbol.js';
|
|||||||
*/
|
*/
|
||||||
function compareAscending(value, other) {
|
function compareAscending(value, other) {
|
||||||
if (value !== other) {
|
if (value !== other) {
|
||||||
var valIsDefined = value !== undefined,
|
const valIsDefined = value !== undefined;
|
||||||
valIsNull = value === null,
|
const valIsNull = value === null;
|
||||||
valIsReflexive = value === value,
|
const valIsReflexive = value === value;
|
||||||
valIsSymbol = isSymbol(value);
|
const valIsSymbol = isSymbol(value);
|
||||||
|
|
||||||
var othIsDefined = other !== undefined,
|
const othIsDefined = other !== undefined;
|
||||||
othIsNull = other === null,
|
const othIsNull = other === null;
|
||||||
othIsReflexive = other === other,
|
const othIsReflexive = other === other;
|
||||||
othIsSymbol = isSymbol(other);
|
const othIsSymbol = isSymbol(other);
|
||||||
|
|
||||||
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
||||||
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
||||||
|
|||||||
@@ -15,19 +15,19 @@ import compareAscending from './_compareAscending.js';
|
|||||||
* @returns {number} Returns the sort order indicator for `object`.
|
* @returns {number} Returns the sort order indicator for `object`.
|
||||||
*/
|
*/
|
||||||
function compareMultiple(object, other, orders) {
|
function compareMultiple(object, other, orders) {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
objCriteria = object.criteria,
|
const objCriteria = object.criteria;
|
||||||
othCriteria = other.criteria,
|
const othCriteria = other.criteria;
|
||||||
length = objCriteria.length,
|
const length = objCriteria.length;
|
||||||
ordersLength = orders.length;
|
const ordersLength = orders.length;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var result = compareAscending(objCriteria[index], othCriteria[index]);
|
const result = compareAscending(objCriteria[index], othCriteria[index]);
|
||||||
if (result) {
|
if (result) {
|
||||||
if (index >= ordersLength) {
|
if (index >= ordersLength) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
var order = orders[index];
|
const order = orders[index];
|
||||||
return result * (order == 'desc' ? -1 : 1);
|
return result * (order == 'desc' ? -1 : 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* 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 nativeMax = Math.max;
|
const nativeMax = Math.max;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array that is the composition of partially applied arguments,
|
* Creates an array that is the composition of partially applied arguments,
|
||||||
@@ -13,14 +13,16 @@ var nativeMax = Math.max;
|
|||||||
* @returns {Array} Returns the new array of composed arguments.
|
* @returns {Array} Returns the new array of composed arguments.
|
||||||
*/
|
*/
|
||||||
function composeArgs(args, partials, holders, isCurried) {
|
function composeArgs(args, partials, holders, isCurried) {
|
||||||
var argsIndex = -1,
|
const argsLength = args.length;
|
||||||
argsLength = args.length,
|
const holdersLength = holders.length;
|
||||||
holdersLength = holders.length,
|
const leftLength = partials.length;
|
||||||
leftIndex = -1,
|
|
||||||
leftLength = partials.length,
|
let argsIndex = -1;
|
||||||
rangeLength = nativeMax(argsLength - holdersLength, 0),
|
let leftIndex = -1;
|
||||||
result = Array(leftLength + rangeLength),
|
let rangeLength = nativeMax(argsLength - holdersLength, 0);
|
||||||
isUncurried = !isCurried;
|
|
||||||
|
const result = Array(leftLength + rangeLength);
|
||||||
|
const isUncurried = !isCurried;
|
||||||
|
|
||||||
while (++leftIndex < leftLength) {
|
while (++leftIndex < leftLength) {
|
||||||
result[leftIndex] = partials[leftIndex];
|
result[leftIndex] = partials[leftIndex];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* 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 nativeMax = Math.max;
|
const nativeMax = Math.max;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is like `composeArgs` except that the arguments composition
|
* This function is like `composeArgs` except that the arguments composition
|
||||||
@@ -13,20 +13,21 @@ var nativeMax = Math.max;
|
|||||||
* @returns {Array} Returns the new array of composed arguments.
|
* @returns {Array} Returns the new array of composed arguments.
|
||||||
*/
|
*/
|
||||||
function composeArgsRight(args, partials, holders, isCurried) {
|
function composeArgsRight(args, partials, holders, isCurried) {
|
||||||
var argsIndex = -1,
|
let argsIndex = -1;
|
||||||
argsLength = args.length,
|
let holdersIndex = -1;
|
||||||
holdersIndex = -1,
|
let rightIndex = -1;
|
||||||
holdersLength = holders.length,
|
|
||||||
rightIndex = -1,
|
const argsLength = args.length;
|
||||||
rightLength = partials.length,
|
const holdersLength = holders.length;
|
||||||
rangeLength = nativeMax(argsLength - holdersLength, 0),
|
const rightLength = partials.length;
|
||||||
result = Array(rangeLength + rightLength),
|
const rangeLength = nativeMax(argsLength - holdersLength, 0);
|
||||||
isUncurried = !isCurried;
|
const result = Array(rangeLength + rightLength);
|
||||||
|
const isUncurried = !isCurried;
|
||||||
|
|
||||||
while (++argsIndex < rangeLength) {
|
while (++argsIndex < rangeLength) {
|
||||||
result[argsIndex] = args[argsIndex];
|
result[argsIndex] = args[argsIndex];
|
||||||
}
|
}
|
||||||
var offset = argsIndex;
|
const offset = argsIndex;
|
||||||
while (++rightIndex < rightLength) {
|
while (++rightIndex < rightLength) {
|
||||||
result[offset + rightIndex] = partials[rightIndex];
|
result[offset + rightIndex] = partials[rightIndex];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
* @returns {number} Returns the placeholder count.
|
* @returns {number} Returns the placeholder count.
|
||||||
*/
|
*/
|
||||||
function countHolders(array, placeholder) {
|
function countHolders(array, placeholder) {
|
||||||
var length = array.length,
|
let length = array.length;
|
||||||
result = 0;
|
let result = 0;
|
||||||
|
|
||||||
while (length--) {
|
while (length--) {
|
||||||
if (array[length] === placeholder) {
|
if (array[length] === placeholder) {
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ import isArray from './isArray.js';
|
|||||||
*/
|
*/
|
||||||
function createAggregator(setter, initializer) {
|
function createAggregator(setter, initializer) {
|
||||||
return (collection, iteratee) => {
|
return (collection, iteratee) => {
|
||||||
var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
const func = isArray(collection) ? arrayAggregator : baseAggregator;
|
||||||
accumulator = initializer ? initializer() : {};
|
const accumulator = initializer ? initializer() : {};
|
||||||
|
|
||||||
return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
|
return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import isIterateeCall from './_isIterateeCall.js';
|
|||||||
*/
|
*/
|
||||||
function createAssigner(assigner) {
|
function createAssigner(assigner) {
|
||||||
return baseRest((object, sources) => {
|
return baseRest((object, sources) => {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
length = sources.length,
|
let length = sources.length;
|
||||||
customizer = length > 1 ? sources[length - 1] : undefined,
|
let customizer = length > 1 ? sources[length - 1] : undefined;
|
||||||
guard = length > 2 ? sources[2] : undefined;
|
const guard = length > 2 ? sources[2] : undefined;
|
||||||
|
|
||||||
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
||||||
? (length--, customizer)
|
? (length--, customizer)
|
||||||
@@ -25,7 +25,7 @@ function createAssigner(assigner) {
|
|||||||
}
|
}
|
||||||
object = Object(object);
|
object = Object(object);
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var source = sources[index];
|
const source = sources[index];
|
||||||
if (source) {
|
if (source) {
|
||||||
assigner(object, source, index, customizer);
|
assigner(object, source, index, customizer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,14 @@
|
|||||||
*/
|
*/
|
||||||
function createBaseFor(fromRight) {
|
function createBaseFor(fromRight) {
|
||||||
return (object, iteratee, keysFunc) => {
|
return (object, iteratee, keysFunc) => {
|
||||||
var index = -1,
|
const iterable = Object(object);
|
||||||
iterable = Object(object),
|
const props = keysFunc(object);
|
||||||
props = keysFunc(object),
|
|
||||||
length = props.length;
|
let index = -1;
|
||||||
|
let length = props.length;
|
||||||
|
|
||||||
while (length--) {
|
while (length--) {
|
||||||
var key = props[fromRight ? length : ++index];
|
const key = props[fromRight ? length : ++index];
|
||||||
if (iteratee(iterable[key], key, iterable) === false) {
|
if (iteratee(iterable[key], key, iterable) === false) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import createCtor from './_createCtor.js';
|
|||||||
import root from './_root.js';
|
import root from './_root.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for function metadata. */
|
/** Used to compose bitmasks for function metadata. */
|
||||||
var WRAP_BIND_FLAG = 1;
|
const WRAP_BIND_FLAG = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that wraps `func` to invoke it with the optional `this`
|
* Creates a function that wraps `func` to invoke it with the optional `this`
|
||||||
@@ -15,11 +15,11 @@ var WRAP_BIND_FLAG = 1;
|
|||||||
* @returns {Function} Returns the new wrapped function.
|
* @returns {Function} Returns the new wrapped function.
|
||||||
*/
|
*/
|
||||||
function createBind(func, bitmask, thisArg) {
|
function createBind(func, bitmask, thisArg) {
|
||||||
var isBind = bitmask & WRAP_BIND_FLAG,
|
const isBind = bitmask & WRAP_BIND_FLAG;
|
||||||
Ctor = createCtor(func);
|
const Ctor = createCtor(func);
|
||||||
|
|
||||||
function wrapper(...args) {
|
function wrapper(...args) {
|
||||||
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
const fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||||
return fn.apply(isBind ? thisArg : this, args);
|
return fn.apply(isBind ? thisArg : this, args);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function createCtor(Ctor) {
|
|||||||
// 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/7.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;
|
const args = arguments;
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0: return new Ctor;
|
case 0: return new Ctor;
|
||||||
case 1: return new Ctor(args[0]);
|
case 1: return new Ctor(args[0]);
|
||||||
@@ -25,8 +25,8 @@ function createCtor(Ctor) {
|
|||||||
case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
|
case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
|
||||||
case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
|
||||||
}
|
}
|
||||||
var thisBinding = baseCreate(Ctor.prototype),
|
const thisBinding = baseCreate(Ctor.prototype);
|
||||||
result = Ctor.apply(thisBinding, args);
|
const result = Ctor.apply(thisBinding, args);
|
||||||
|
|
||||||
// Mimic the constructor's `return` behavior.
|
// Mimic the constructor's `return` behavior.
|
||||||
// See https://es5.github.io/#x13.2.2 for more details.
|
// See https://es5.github.io/#x13.2.2 for more details.
|
||||||
|
|||||||
@@ -16,18 +16,19 @@ import root from './_root.js';
|
|||||||
* @returns {Function} Returns the new wrapped function.
|
* @returns {Function} Returns the new wrapped function.
|
||||||
*/
|
*/
|
||||||
function createCurry(func, bitmask, arity) {
|
function createCurry(func, bitmask, arity) {
|
||||||
var Ctor = createCtor(func);
|
const Ctor = createCtor(func);
|
||||||
|
|
||||||
function wrapper() {
|
function wrapper() {
|
||||||
var length = arguments.length,
|
let length = arguments.length;
|
||||||
args = Array(length),
|
let index = length;
|
||||||
index = length,
|
|
||||||
placeholder = getHolder(wrapper);
|
const args = Array(length);
|
||||||
|
const placeholder = getHolder(wrapper);
|
||||||
|
|
||||||
while (index--) {
|
while (index--) {
|
||||||
args[index] = arguments[index];
|
args[index] = arguments[index];
|
||||||
}
|
}
|
||||||
var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
|
const holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
|
||||||
? []
|
? []
|
||||||
: replaceHolders(args, placeholder);
|
: replaceHolders(args, placeholder);
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ function createCurry(func, bitmask, arity) {
|
|||||||
func, bitmask, createHybrid, wrapper.placeholder, undefined,
|
func, bitmask, createHybrid, wrapper.placeholder, undefined,
|
||||||
args, holders, undefined, undefined, arity - length);
|
args, holders, undefined, undefined, arity - length);
|
||||||
}
|
}
|
||||||
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
const fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||||
return apply(fn, this, args);
|
return apply(fn, this, args);
|
||||||
}
|
}
|
||||||
return wrapper;
|
return wrapper;
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import isArray from './isArray.js';
|
|||||||
import isLaziable from './_isLaziable.js';
|
import isLaziable from './_isLaziable.js';
|
||||||
|
|
||||||
/** Error message constants. */
|
/** Error message constants. */
|
||||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
const FUNC_ERROR_TEXT = 'Expected a function';
|
||||||
|
|
||||||
/** Used to compose bitmasks for function metadata. */
|
/** Used to compose bitmasks for function metadata. */
|
||||||
var WRAP_CURRY_FLAG = 8,
|
const WRAP_CURRY_FLAG = 8;
|
||||||
WRAP_PARTIAL_FLAG = 32,
|
const WRAP_PARTIAL_FLAG = 32;
|
||||||
WRAP_ARY_FLAG = 128,
|
const WRAP_ARY_FLAG = 128;
|
||||||
WRAP_REARG_FLAG = 256;
|
const WRAP_REARG_FLAG = 256;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a `_.flow` or `_.flowRight` function.
|
* Creates a `_.flow` or `_.flowRight` function.
|
||||||
@@ -23,9 +23,9 @@ var WRAP_CURRY_FLAG = 8,
|
|||||||
*/
|
*/
|
||||||
function createFlow(fromRight) {
|
function createFlow(fromRight) {
|
||||||
return flatRest(funcs => {
|
return flatRest(funcs => {
|
||||||
var length = funcs.length,
|
const length = funcs.length;
|
||||||
index = length,
|
const prereq = LodashWrapper.prototype.thru;
|
||||||
prereq = LodashWrapper.prototype.thru;
|
let index = length;
|
||||||
|
|
||||||
if (fromRight) {
|
if (fromRight) {
|
||||||
funcs.reverse();
|
funcs.reverse();
|
||||||
@@ -43,12 +43,12 @@ function createFlow(fromRight) {
|
|||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
func = funcs[index];
|
func = funcs[index];
|
||||||
|
|
||||||
var funcName = getFuncName(func),
|
const funcName = getFuncName(func);
|
||||||
data = funcName == 'wrapper' ? getData(func) : undefined;
|
const data = funcName == 'wrapper' ? getData(func) : undefined;
|
||||||
|
|
||||||
if (data && isLaziable(data[0]) &&
|
if (data && isLaziable(data[0]) &&
|
||||||
data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
|
data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
|
||||||
!data[4].length && data[9] == 1
|
!data[4].length && data[9] == 1
|
||||||
) {
|
) {
|
||||||
wrapper = wrapper[getFuncName(data[0])](...data[3]);
|
wrapper = wrapper[getFuncName(data[0])](...data[3]);
|
||||||
} else {
|
} else {
|
||||||
@@ -58,14 +58,13 @@ function createFlow(fromRight) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return function() {
|
return function() {
|
||||||
var args = arguments,
|
const args = arguments;
|
||||||
value = args[0];
|
const value = args[0];
|
||||||
|
|
||||||
if (wrapper && args.length == 1 && isArray(value)) {
|
if (wrapper && args.length == 1 && isArray(value)) {
|
||||||
return wrapper.plant(value).value();
|
return wrapper.plant(value).value();
|
||||||
}
|
}
|
||||||
var index = 0,
|
let index = 0, result = length ? funcs[index].apply(this, args) : value;
|
||||||
result = length ? funcs[index].apply(this, args) : value;
|
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
result = funcs[index].call(this, result);
|
result = funcs[index].call(this, result);
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import replaceHolders from './_replaceHolders.js';
|
|||||||
import root from './_root.js';
|
import root from './_root.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for function metadata. */
|
/** Used to compose bitmasks for function metadata. */
|
||||||
var WRAP_BIND_FLAG = 1,
|
const WRAP_BIND_FLAG = 1;
|
||||||
WRAP_BIND_KEY_FLAG = 2,
|
const WRAP_BIND_KEY_FLAG = 2;
|
||||||
WRAP_CURRY_FLAG = 8,
|
const WRAP_CURRY_FLAG = 8;
|
||||||
WRAP_CURRY_RIGHT_FLAG = 16,
|
const WRAP_CURRY_RIGHT_FLAG = 16;
|
||||||
WRAP_ARY_FLAG = 128,
|
const WRAP_ARY_FLAG = 128;
|
||||||
WRAP_FLIP_FLAG = 512;
|
const WRAP_FLIP_FLAG = 512;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that wraps `func` to invoke it with optional `this`
|
* Creates a function that wraps `func` to invoke it with optional `this`
|
||||||
@@ -36,24 +36,26 @@ var WRAP_BIND_FLAG = 1,
|
|||||||
* @returns {Function} Returns the new wrapped function.
|
* @returns {Function} Returns the new wrapped function.
|
||||||
*/
|
*/
|
||||||
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
|
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
|
||||||
var isAry = bitmask & WRAP_ARY_FLAG,
|
const isAry = bitmask & WRAP_ARY_FLAG;
|
||||||
isBind = bitmask & WRAP_BIND_FLAG,
|
const isBind = bitmask & WRAP_BIND_FLAG;
|
||||||
isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
|
const isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
|
||||||
isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
|
const isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
|
||||||
isFlip = bitmask & WRAP_FLIP_FLAG,
|
const isFlip = bitmask & WRAP_FLIP_FLAG;
|
||||||
Ctor = isBindKey ? undefined : createCtor(func);
|
const Ctor = isBindKey ? undefined : createCtor(func);
|
||||||
|
|
||||||
function wrapper() {
|
function wrapper() {
|
||||||
var length = arguments.length,
|
let holderCount;
|
||||||
args = Array(length),
|
let placeholder;
|
||||||
index = length;
|
let length = arguments.length;
|
||||||
|
let args = Array(length);
|
||||||
|
let index = length;
|
||||||
|
|
||||||
while (index--) {
|
while (index--) {
|
||||||
args[index] = arguments[index];
|
args[index] = arguments[index];
|
||||||
}
|
}
|
||||||
if (isCurried) {
|
if (isCurried) {
|
||||||
var placeholder = getHolder(wrapper),
|
placeholder = getHolder(wrapper);
|
||||||
holdersCount = countHolders(args, placeholder);
|
holdersCount = countHolders(args, placeholder);
|
||||||
}
|
}
|
||||||
if (partials) {
|
if (partials) {
|
||||||
args = composeArgs(args, partials, holders, isCurried);
|
args = composeArgs(args, partials, holders, isCurried);
|
||||||
@@ -63,14 +65,14 @@ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight,
|
|||||||
}
|
}
|
||||||
length -= holdersCount;
|
length -= holdersCount;
|
||||||
if (isCurried && length < arity) {
|
if (isCurried && length < arity) {
|
||||||
var newHolders = replaceHolders(args, placeholder);
|
const newHolders = replaceHolders(args, placeholder);
|
||||||
return createRecurry(
|
return createRecurry(
|
||||||
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
|
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
|
||||||
args, newHolders, argPos, ary, arity - length
|
args, newHolders, argPos, ary, arity - length
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
var thisBinding = isBind ? thisArg : this,
|
const thisBinding = isBind ? thisArg : this;
|
||||||
fn = isBindKey ? thisBinding[func] : func;
|
let fn = isBindKey ? thisBinding[func] : func;
|
||||||
|
|
||||||
length = args.length;
|
length = args.length;
|
||||||
if (argPos) {
|
if (argPos) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import createCtor from './_createCtor.js';
|
|||||||
import root from './_root.js';
|
import root from './_root.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for function metadata. */
|
/** Used to compose bitmasks for function metadata. */
|
||||||
var WRAP_BIND_FLAG = 1;
|
const WRAP_BIND_FLAG = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that wraps `func` to invoke it with the `this` binding
|
* Creates a function that wraps `func` to invoke it with the `this` binding
|
||||||
@@ -18,16 +18,17 @@ var WRAP_BIND_FLAG = 1;
|
|||||||
* @returns {Function} Returns the new wrapped function.
|
* @returns {Function} Returns the new wrapped function.
|
||||||
*/
|
*/
|
||||||
function createPartial(func, bitmask, thisArg, partials) {
|
function createPartial(func, bitmask, thisArg, partials) {
|
||||||
var isBind = bitmask & WRAP_BIND_FLAG,
|
const isBind = bitmask & WRAP_BIND_FLAG;
|
||||||
Ctor = createCtor(func);
|
const Ctor = createCtor(func);
|
||||||
|
|
||||||
function wrapper() {
|
function wrapper() {
|
||||||
var argsIndex = -1,
|
let argsIndex = -1;
|
||||||
argsLength = arguments.length,
|
let argsLength = arguments.length;
|
||||||
leftIndex = -1,
|
let leftIndex = -1;
|
||||||
leftLength = partials.length,
|
|
||||||
args = Array(leftLength + argsLength),
|
const leftLength = partials.length;
|
||||||
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
const args = Array(leftLength + argsLength);
|
||||||
|
const fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
||||||
|
|
||||||
while (++leftIndex < leftLength) {
|
while (++leftIndex < leftLength) {
|
||||||
args[leftIndex] = partials[leftIndex];
|
args[leftIndex] = partials[leftIndex];
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import setData from './_setData.js';
|
|||||||
import setWrapToString from './_setWrapToString.js';
|
import setWrapToString from './_setWrapToString.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for function metadata. */
|
/** Used to compose bitmasks for function metadata. */
|
||||||
var WRAP_BIND_FLAG = 1,
|
const WRAP_BIND_FLAG = 1;
|
||||||
WRAP_BIND_KEY_FLAG = 2,
|
const WRAP_BIND_KEY_FLAG = 2;
|
||||||
WRAP_CURRY_BOUND_FLAG = 4,
|
const WRAP_CURRY_BOUND_FLAG = 4;
|
||||||
WRAP_CURRY_FLAG = 8,
|
const WRAP_CURRY_FLAG = 8;
|
||||||
WRAP_PARTIAL_FLAG = 32,
|
const WRAP_PARTIAL_FLAG = 32;
|
||||||
WRAP_PARTIAL_RIGHT_FLAG = 64;
|
const WRAP_PARTIAL_RIGHT_FLAG = 64;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that wraps `func` to continue currying.
|
* Creates a function that wraps `func` to continue currying.
|
||||||
@@ -28,11 +28,11 @@ var WRAP_BIND_FLAG = 1,
|
|||||||
* @returns {Function} Returns the new wrapped function.
|
* @returns {Function} Returns the new wrapped function.
|
||||||
*/
|
*/
|
||||||
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
|
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
|
||||||
var isCurry = bitmask & WRAP_CURRY_FLAG,
|
const isCurry = bitmask & WRAP_CURRY_FLAG;
|
||||||
newHolders = isCurry ? holders : undefined,
|
const newHolders = isCurry ? holders : undefined;
|
||||||
newHoldersRight = isCurry ? undefined : holders,
|
const newHoldersRight = isCurry ? undefined : holders;
|
||||||
newPartials = isCurry ? partials : undefined,
|
const newPartials = isCurry ? partials : undefined;
|
||||||
newPartialsRight = isCurry ? undefined : partials;
|
const newPartialsRight = isCurry ? undefined : partials;
|
||||||
|
|
||||||
bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
|
bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
|
||||||
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
|
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
|
||||||
@@ -40,12 +40,12 @@ function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials,
|
|||||||
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
|
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
|
||||||
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
|
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
|
||||||
}
|
}
|
||||||
var newData = [
|
const newData = [
|
||||||
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
||||||
newHoldersRight, argPos, ary, arity
|
newHoldersRight, argPos, ary, arity
|
||||||
];
|
];
|
||||||
|
|
||||||
var result = wrapFunc(...newData);
|
const result = wrapFunc(...newData);
|
||||||
if (isLaziable(func)) {
|
if (isLaziable(func)) {
|
||||||
setData(result, newData);
|
setData(result, newData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import toNumber from './toNumber.js';
|
|||||||
import toString from './toString.js';
|
import toString from './toString.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 nativeMin = Math.min;
|
const nativeMin = Math.min;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function like `_.round`.
|
* Creates a function like `_.round`.
|
||||||
@@ -13,15 +13,15 @@ var nativeMin = Math.min;
|
|||||||
* @returns {Function} Returns the new round function.
|
* @returns {Function} Returns the new round function.
|
||||||
*/
|
*/
|
||||||
function createRound(methodName) {
|
function createRound(methodName) {
|
||||||
var func = Math[methodName];
|
const func = Math[methodName];
|
||||||
return (number, precision) => {
|
return (number, precision) => {
|
||||||
number = toNumber(number);
|
number = toNumber(number);
|
||||||
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
||||||
if (precision) {
|
if (precision) {
|
||||||
// Shift with exponential notation to avoid floating-point issues.
|
// Shift with exponential notation to avoid floating-point issues.
|
||||||
// See [MDN](https://mdn.io/round#Examples) for more details.
|
// See [MDN](https://mdn.io/round#Examples) for more details.
|
||||||
var pair = `${ toString(number) }e`.split('e'),
|
let pair = `${ toString(number) }e`.split('e');
|
||||||
value = func(`${ pair[0] }e${ +pair[1] + precision }`);
|
const value = func(`${ pair[0] }e${ +pair[1] + precision }`);
|
||||||
|
|
||||||
pair = `${ toString(value) }e`.split('e');
|
pair = `${ toString(value) }e`.split('e');
|
||||||
return +`${ pair[0] }e${ +pair[1] - precision }`;
|
return +`${ pair[0] }e${ +pair[1] - precision }`;
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import mapToArray from './_mapToArray.js';
|
|||||||
import setToPairs from './_setToPairs.js';
|
import setToPairs from './_setToPairs.js';
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var mapTag = '[object Map]',
|
const mapTag = '[object Map]';
|
||||||
setTag = '[object Set]';
|
const setTag = '[object Set]';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a `_.toPairs` or `_.toPairsIn` function.
|
* Creates a `_.toPairs` or `_.toPairsIn` function.
|
||||||
@@ -16,7 +16,7 @@ var mapTag = '[object Map]',
|
|||||||
*/
|
*/
|
||||||
function createToPairs(keysFunc) {
|
function createToPairs(keysFunc) {
|
||||||
return object => {
|
return object => {
|
||||||
var tag = getTag(object);
|
const tag = getTag(object);
|
||||||
if (tag == mapTag) {
|
if (tag == mapTag) {
|
||||||
return mapToArray(object);
|
return mapToArray(object);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,18 +10,18 @@ import setWrapToString from './_setWrapToString.js';
|
|||||||
import toInteger from './toInteger.js';
|
import toInteger from './toInteger.js';
|
||||||
|
|
||||||
/** Error message constants. */
|
/** Error message constants. */
|
||||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
const FUNC_ERROR_TEXT = 'Expected a function';
|
||||||
|
|
||||||
/** Used to compose bitmasks for function metadata. */
|
/** Used to compose bitmasks for function metadata. */
|
||||||
var WRAP_BIND_FLAG = 1,
|
const WRAP_BIND_FLAG = 1;
|
||||||
WRAP_BIND_KEY_FLAG = 2,
|
const WRAP_BIND_KEY_FLAG = 2;
|
||||||
WRAP_CURRY_FLAG = 8,
|
const WRAP_CURRY_FLAG = 8;
|
||||||
WRAP_CURRY_RIGHT_FLAG = 16,
|
const WRAP_CURRY_RIGHT_FLAG = 16;
|
||||||
WRAP_PARTIAL_FLAG = 32,
|
const WRAP_PARTIAL_FLAG = 32;
|
||||||
WRAP_PARTIAL_RIGHT_FLAG = 64;
|
const WRAP_PARTIAL_RIGHT_FLAG = 64;
|
||||||
|
|
||||||
/* 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 nativeMax = Math.max;
|
const nativeMax = Math.max;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that either curries or invokes `func` with optional
|
* Creates a function that either curries or invokes `func` with optional
|
||||||
@@ -49,11 +49,11 @@ var nativeMax = Math.max;
|
|||||||
* @returns {Function} Returns the new wrapped function.
|
* @returns {Function} Returns the new wrapped function.
|
||||||
*/
|
*/
|
||||||
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
|
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
|
||||||
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
|
const isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
|
||||||
if (!isBindKey && typeof func != 'function') {
|
if (!isBindKey && typeof func != 'function') {
|
||||||
throw new TypeError(FUNC_ERROR_TEXT);
|
throw new TypeError(FUNC_ERROR_TEXT);
|
||||||
}
|
}
|
||||||
var length = partials ? partials.length : 0;
|
let length = partials ? partials.length : 0;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
|
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
|
||||||
partials = holders = undefined;
|
partials = holders = undefined;
|
||||||
@@ -68,9 +68,9 @@ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arit
|
|||||||
|
|
||||||
partials = holders = undefined;
|
partials = holders = undefined;
|
||||||
}
|
}
|
||||||
var data = isBindKey ? undefined : getData(func);
|
const data = isBindKey ? undefined : getData(func);
|
||||||
|
|
||||||
var newData = [
|
const newData = [
|
||||||
func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
|
func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
|
||||||
argPos, ary, arity
|
argPos, ary, arity
|
||||||
];
|
];
|
||||||
@@ -99,7 +99,7 @@ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arit
|
|||||||
} else {
|
} else {
|
||||||
result = createHybrid(...newData);
|
result = createHybrid(...newData);
|
||||||
}
|
}
|
||||||
var setter = data ? baseSetData : setData;
|
const setter = data ? baseSetData : setData;
|
||||||
return setWrapToString(setter(result, newData), func, bitmask);
|
return setWrapToString(setter(result, newData), func, bitmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import arraySome from './_arraySome.js';
|
|||||||
import cacheHas from './_cacheHas.js';
|
import cacheHas from './_cacheHas.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for value comparisons. */
|
/** Used to compose bitmasks for value comparisons. */
|
||||||
var COMPARE_PARTIAL_FLAG = 1,
|
const COMPARE_PARTIAL_FLAG = 1;
|
||||||
COMPARE_UNORDERED_FLAG = 2;
|
const COMPARE_UNORDERED_FLAG = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
||||||
@@ -20,29 +20,28 @@ var COMPARE_PARTIAL_FLAG = 1,
|
|||||||
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
||||||
*/
|
*/
|
||||||
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
||||||
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
const isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
||||||
arrLength = array.length,
|
const arrLength = array.length;
|
||||||
othLength = other.length;
|
const othLength = other.length;
|
||||||
|
|
||||||
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Assume cyclic values are equal.
|
// Assume cyclic values are equal.
|
||||||
var stacked = stack.get(array);
|
const stacked = stack.get(array);
|
||||||
if (stacked && stack.get(other)) {
|
if (stacked && stack.get(other)) {
|
||||||
return stacked == other;
|
return stacked == other;
|
||||||
}
|
}
|
||||||
var index = -1,
|
let index = -1;
|
||||||
result = true,
|
let result = true;
|
||||||
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
|
const seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
|
||||||
|
|
||||||
stack.set(array, other);
|
stack.set(array, other);
|
||||||
stack.set(other, array);
|
stack.set(other, array);
|
||||||
|
|
||||||
// Ignore non-index properties.
|
// Ignore non-index properties.
|
||||||
while (++index < arrLength) {
|
while (++index < arrLength) {
|
||||||
var arrValue = array[index],
|
const arrValue = array[index], othValue = other[index];
|
||||||
othValue = other[index];
|
|
||||||
|
|
||||||
if (customizer) {
|
if (customizer) {
|
||||||
var compared = isPartial
|
var compared = isPartial
|
||||||
|
|||||||
@@ -6,26 +6,26 @@ import mapToArray from './_mapToArray.js';
|
|||||||
import setToArray from './_setToArray.js';
|
import setToArray from './_setToArray.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for value comparisons. */
|
/** Used to compose bitmasks for value comparisons. */
|
||||||
var COMPARE_PARTIAL_FLAG = 1,
|
const COMPARE_PARTIAL_FLAG = 1;
|
||||||
COMPARE_UNORDERED_FLAG = 2;
|
const COMPARE_UNORDERED_FLAG = 2;
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var boolTag = '[object Boolean]',
|
const boolTag = '[object Boolean]';
|
||||||
dateTag = '[object Date]',
|
const dateTag = '[object Date]';
|
||||||
errorTag = '[object Error]',
|
const errorTag = '[object Error]';
|
||||||
mapTag = '[object Map]',
|
const mapTag = '[object Map]';
|
||||||
numberTag = '[object Number]',
|
const numberTag = '[object Number]';
|
||||||
regexpTag = '[object RegExp]',
|
const regexpTag = '[object RegExp]';
|
||||||
setTag = '[object Set]',
|
const setTag = '[object Set]';
|
||||||
stringTag = '[object String]',
|
const stringTag = '[object String]';
|
||||||
symbolTag = '[object Symbol]';
|
const symbolTag = '[object Symbol]';
|
||||||
|
|
||||||
var arrayBufferTag = '[object ArrayBuffer]',
|
const arrayBufferTag = '[object ArrayBuffer]';
|
||||||
dataViewTag = '[object DataView]';
|
const dataViewTag = '[object DataView]';
|
||||||
|
|
||||||
/** Used to convert symbols to primitives and strings. */
|
/** Used to convert symbols to primitives and strings. */
|
||||||
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
const symbolProto = Symbol ? Symbol.prototype : undefined;
|
||||||
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
const symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
||||||
@@ -79,17 +79,17 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|||||||
return object == `${ other }`;
|
return object == `${ other }`;
|
||||||
|
|
||||||
case mapTag:
|
case mapTag:
|
||||||
var convert = mapToArray;
|
let convert = mapToArray;
|
||||||
|
|
||||||
case setTag:
|
case setTag:
|
||||||
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
const isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
||||||
convert || (convert = setToArray);
|
convert || (convert = setToArray);
|
||||||
|
|
||||||
if (object.size != other.size && !isPartial) {
|
if (object.size != other.size && !isPartial) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Assume cyclic values are equal.
|
// Assume cyclic values are equal.
|
||||||
var stacked = stack.get(object);
|
const stacked = stack.get(object);
|
||||||
if (stacked) {
|
if (stacked) {
|
||||||
return stacked == other;
|
return stacked == other;
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|||||||
|
|
||||||
// Recursively compare objects (susceptible to call stack limits).
|
// Recursively compare objects (susceptible to call stack limits).
|
||||||
stack.set(object, other);
|
stack.set(object, other);
|
||||||
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
const result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
||||||
stack['delete'](object);
|
stack['delete'](object);
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import getAllKeys from './_getAllKeys.js';
|
import getAllKeys from './_getAllKeys.js';
|
||||||
|
|
||||||
/** Used to compose bitmasks for value comparisons. */
|
/** Used to compose bitmasks for value comparisons. */
|
||||||
var COMPARE_PARTIAL_FLAG = 1;
|
const COMPARE_PARTIAL_FLAG = 1;
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
const objectProto = Object.prototype;
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A specialized version of `baseIsEqualDeep` for objects with support for
|
* A specialized version of `baseIsEqualDeep` for objects with support for
|
||||||
@@ -23,39 +23,41 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
||||||
*/
|
*/
|
||||||
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
||||||
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
const isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
||||||
objProps = getAllKeys(object),
|
const objProps = getAllKeys(object);
|
||||||
objLength = objProps.length,
|
const objLength = objProps.length;
|
||||||
othProps = getAllKeys(other),
|
const othProps = getAllKeys(other);
|
||||||
othLength = othProps.length;
|
const othLength = othProps.length;
|
||||||
|
|
||||||
if (objLength != othLength && !isPartial) {
|
if (objLength != othLength && !isPartial) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var index = objLength;
|
let key;
|
||||||
|
let index = objLength;
|
||||||
while (index--) {
|
while (index--) {
|
||||||
var key = objProps[index];
|
key = objProps[index];
|
||||||
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Assume cyclic values are equal.
|
// Assume cyclic values are equal.
|
||||||
var stacked = stack.get(object);
|
const stacked = stack.get(object);
|
||||||
if (stacked && stack.get(other)) {
|
if (stacked && stack.get(other)) {
|
||||||
return stacked == other;
|
return stacked == other;
|
||||||
}
|
}
|
||||||
var result = true;
|
let result = true;
|
||||||
stack.set(object, other);
|
stack.set(object, other);
|
||||||
stack.set(other, object);
|
stack.set(other, object);
|
||||||
|
|
||||||
var skipCtor = isPartial;
|
let compared;
|
||||||
|
let skipCtor = isPartial;
|
||||||
while (++index < objLength) {
|
while (++index < objLength) {
|
||||||
key = objProps[index];
|
key = objProps[index];
|
||||||
var objValue = object[key],
|
const objValue = object[key];
|
||||||
othValue = other[key];
|
const othValue = other[key];
|
||||||
|
|
||||||
if (customizer) {
|
if (customizer) {
|
||||||
var compared = isPartial
|
compared = isPartial
|
||||||
? customizer(othValue, objValue, key, other, object, stack)
|
? customizer(othValue, objValue, key, other, object, stack)
|
||||||
: customizer(objValue, othValue, key, object, other, stack);
|
: customizer(objValue, othValue, key, object, other, stack);
|
||||||
}
|
}
|
||||||
@@ -70,8 +72,8 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|||||||
skipCtor || (skipCtor = key == 'constructor');
|
skipCtor || (skipCtor = key == 'constructor');
|
||||||
}
|
}
|
||||||
if (result && !skipCtor) {
|
if (result && !skipCtor) {
|
||||||
var objCtor = object.constructor,
|
const objCtor = object.constructor;
|
||||||
othCtor = other.constructor;
|
const othCtor = other.constructor;
|
||||||
|
|
||||||
// Non `Object` object instances with different constructors are not equal.
|
// Non `Object` object instances with different constructors are not equal.
|
||||||
if (objCtor != othCtor &&
|
if (objCtor != othCtor &&
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import realNames from './_realNames.js';
|
import realNames from './_realNames.js';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
const objectProto = Object.prototype;
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of `func`.
|
* Gets the name of `func`.
|
||||||
@@ -14,13 +14,13 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* @returns {string} Returns the function name.
|
* @returns {string} Returns the function name.
|
||||||
*/
|
*/
|
||||||
function getFuncName(func) {
|
function getFuncName(func) {
|
||||||
var result = `${ func.name }`,
|
const result = `${ func.name }`;
|
||||||
array = realNames[result],
|
const array = realNames[result];
|
||||||
length = hasOwnProperty.call(realNames, result) ? array.length : 0;
|
let length = hasOwnProperty.call(realNames, result) ? array.length : 0;
|
||||||
|
|
||||||
while (length--) {
|
while (length--) {
|
||||||
var data = array[length],
|
const data = array[length];
|
||||||
otherFunc = data.func;
|
const otherFunc = data.func;
|
||||||
if (otherFunc == null || otherFunc == func) {
|
if (otherFunc == null || otherFunc == func) {
|
||||||
return data.name;
|
return data.name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,12 @@ import keys from './keys.js';
|
|||||||
* @returns {Array} Returns the match data of `object`.
|
* @returns {Array} Returns the match data of `object`.
|
||||||
*/
|
*/
|
||||||
function getMatchData(object) {
|
function getMatchData(object) {
|
||||||
var result = keys(object),
|
const result = keys(object);
|
||||||
length = result.length;
|
let length = result.length;
|
||||||
|
|
||||||
while (length--) {
|
while (length--) {
|
||||||
var key = result[length],
|
const key = result[length];
|
||||||
value = object[key];
|
const value = object[key];
|
||||||
|
|
||||||
result[length] = [key, value, isStrictComparable(value)];
|
result[length] = [key, value, isStrictComparable(value)];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import Symbol from './_Symbol.js';
|
import Symbol from './_Symbol.js';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
const objectProto = Object.prototype;
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to resolve the
|
* Used to resolve the
|
||||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||||
* of values.
|
* of values.
|
||||||
*/
|
*/
|
||||||
var nativeObjectToString = objectProto.toString;
|
const nativeObjectToString = objectProto.toString;
|
||||||
|
|
||||||
/** Built-in value references. */
|
/** Built-in value references. */
|
||||||
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
const symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
||||||
@@ -24,15 +24,15 @@ var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|||||||
* @returns {string} Returns the raw `toStringTag`.
|
* @returns {string} Returns the raw `toStringTag`.
|
||||||
*/
|
*/
|
||||||
function getRawTag(value) {
|
function getRawTag(value) {
|
||||||
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
const isOwn = hasOwnProperty.call(value, symToStringTag);
|
||||||
tag = value[symToStringTag];
|
const tag = value[symToStringTag];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
value[symToStringTag] = undefined;
|
value[symToStringTag] = undefined;
|
||||||
var unmasked = true;
|
var unmasked = true;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
var result = nativeObjectToString.call(value);
|
const result = nativeObjectToString.call(value);
|
||||||
if (unmasked) {
|
if (unmasked) {
|
||||||
if (isOwn) {
|
if (isOwn) {
|
||||||
value[symToStringTag] = tag;
|
value[symToStringTag] = tag;
|
||||||
|
|||||||
31
_getTag.js
31
_getTag.js
@@ -7,20 +7,19 @@ import baseGetTag from './_baseGetTag.js';
|
|||||||
import toSource from './_toSource.js';
|
import toSource from './_toSource.js';
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var mapTag = '[object Map]',
|
const dataViewTag = '[object DataView]';
|
||||||
objectTag = '[object Object]',
|
const mapTag = '[object Map]';
|
||||||
promiseTag = '[object Promise]',
|
const objectTag = '[object Object]';
|
||||||
setTag = '[object Set]',
|
const promiseTag = '[object Promise]';
|
||||||
weakMapTag = '[object WeakMap]';
|
const setTag = '[object Set]';
|
||||||
|
const weakMapTag = '[object WeakMap]';
|
||||||
var dataViewTag = '[object DataView]';
|
|
||||||
|
|
||||||
/** Used to detect maps, sets, and weakmaps. */
|
/** Used to detect maps, sets, and weakmaps. */
|
||||||
var dataViewCtorString = toSource(DataView),
|
const dataViewCtorString = toSource(DataView);
|
||||||
mapCtorString = toSource(Map),
|
const mapCtorString = toSource(Map);
|
||||||
promiseCtorString = toSource(Promise),
|
const promiseCtorString = toSource(Promise);
|
||||||
setCtorString = toSource(Set),
|
const setCtorString = toSource(Set);
|
||||||
weakMapCtorString = toSource(WeakMap);
|
const weakMapCtorString = toSource(WeakMap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the `toStringTag` of `value`.
|
* Gets the `toStringTag` of `value`.
|
||||||
@@ -29,7 +28,7 @@ var dataViewCtorString = toSource(DataView),
|
|||||||
* @param {*} value The value to query.
|
* @param {*} value The value to query.
|
||||||
* @returns {string} Returns the `toStringTag`.
|
* @returns {string} Returns the `toStringTag`.
|
||||||
*/
|
*/
|
||||||
var getTag = baseGetTag;
|
let getTag = baseGetTag;
|
||||||
|
|
||||||
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
||||||
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
||||||
@@ -38,9 +37,9 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|||||||
(Set && getTag(new Set) != setTag) ||
|
(Set && getTag(new Set) != setTag) ||
|
||||||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
||||||
getTag = value => {
|
getTag = value => {
|
||||||
var result = baseGetTag(value),
|
const result = baseGetTag(value);
|
||||||
Ctor = result == objectTag ? value.constructor : undefined,
|
const Ctor = result == objectTag ? value.constructor : undefined;
|
||||||
ctorString = Ctor ? toSource(Ctor) : '';
|
const ctorString = Ctor ? toSource(Ctor) : '';
|
||||||
|
|
||||||
if (ctorString) {
|
if (ctorString) {
|
||||||
switch (ctorString) {
|
switch (ctorString) {
|
||||||
|
|||||||
12
_getView.js
12
_getView.js
@@ -1,6 +1,6 @@
|
|||||||
/* 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 nativeMax = Math.max,
|
const nativeMax = Math.max;
|
||||||
nativeMin = Math.min;
|
const nativeMin = Math.min;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the view, applying any `transforms` to the `start` and `end` positions.
|
* Gets the view, applying any `transforms` to the `start` and `end` positions.
|
||||||
@@ -13,12 +13,12 @@ var nativeMax = Math.max,
|
|||||||
* positions of the view.
|
* positions of the view.
|
||||||
*/
|
*/
|
||||||
function getView(start, end, transforms) {
|
function getView(start, end, transforms) {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
length = transforms.length;
|
const length = transforms.length;
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var data = transforms[index],
|
const data = transforms[index];
|
||||||
size = data.size;
|
const size = data.size;
|
||||||
|
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case 'drop': start += size; break;
|
case 'drop': start += size; break;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/** Used to match wrap detail comments. */
|
/** Used to match wrap detail comments. */
|
||||||
var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
|
const reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
|
||||||
reSplitDetails = /,? & /;
|
const reSplitDetails = /,? & /;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts wrapper details from the `source` body comment.
|
* Extracts wrapper details from the `source` body comment.
|
||||||
@@ -10,7 +10,7 @@ var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
|
|||||||
* @returns {Array} Returns the wrapper details.
|
* @returns {Array} Returns the wrapper details.
|
||||||
*/
|
*/
|
||||||
function getWrapDetails(source) {
|
function getWrapDetails(source) {
|
||||||
var match = source.match(reWrapDetails);
|
const match = source.match(reWrapDetails);
|
||||||
return match ? match[1].split(reSplitDetails) : [];
|
return match ? match[1].split(reSplitDetails) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Used to detect strings that need a more robust regexp to match words. */
|
/** 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 ]/;
|
const 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.
|
* Checks if `string` contains a word composed of Unicode symbols.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
const objectProto = Object.prototype;
|
||||||
|
|
||||||
/** Used to check objects for own properties. */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
const hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes an array clone.
|
* Initializes an array clone.
|
||||||
@@ -12,8 +12,8 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* @returns {Array} Returns the initialized clone.
|
* @returns {Array} Returns the initialized clone.
|
||||||
*/
|
*/
|
||||||
function initCloneArray(array) {
|
function initCloneArray(array) {
|
||||||
var length = array.length,
|
const length = array.length;
|
||||||
result = array.constructor(length);
|
const result = array.constructor(length);
|
||||||
|
|
||||||
// Add properties assigned by `RegExp#exec`.
|
// Add properties assigned by `RegExp#exec`.
|
||||||
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
|
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import isArguments from './isArguments.js';
|
|||||||
import isArray from './isArray.js';
|
import isArray from './isArray.js';
|
||||||
|
|
||||||
/** Built-in value references. */
|
/** Built-in value references. */
|
||||||
var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
|
const spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is a flattenable `arguments` object or array.
|
* Checks if `value` is a flattenable `arguments` object or array.
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/** Used as references for various `Number` constants. */
|
/** Used as references for various `Number` constants. */
|
||||||
var MAX_SAFE_INTEGER = 9007199254740991;
|
const MAX_SAFE_INTEGER = 9007199254740991;
|
||||||
|
|
||||||
/** Used to detect unsigned integer values. */
|
/** Used to detect unsigned integer values. */
|
||||||
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
const reIsUint = /^(?:0|[1-9]\d*)$/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is a valid array-like index.
|
* Checks if `value` is a valid array-like index.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function isIterateeCall(value, index, object) {
|
|||||||
if (!isObject(object)) {
|
if (!isObject(object)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var type = typeof index;
|
const type = typeof index;
|
||||||
if (type == 'number'
|
if (type == 'number'
|
||||||
? (isArrayLike(object) && isIndex(index, object.length))
|
? (isArrayLike(object) && isIndex(index, object.length))
|
||||||
: (type == 'string' && index in object)
|
: (type == 'string' && index in object)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import isArray from './isArray.js';
|
|||||||
import isSymbol from './isSymbol.js';
|
import isSymbol from './isSymbol.js';
|
||||||
|
|
||||||
/** Used to match property names within property paths. */
|
/** Used to match property names within property paths. */
|
||||||
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
const reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
||||||
reIsPlainProp = /^\w*$/;
|
const reIsPlainProp = /^\w*$/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is a property name and not a property path.
|
* Checks if `value` is a property name and not a property path.
|
||||||
@@ -17,7 +17,7 @@ function isKey(value, object) {
|
|||||||
if (isArray(value)) {
|
if (isArray(value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var type = typeof value;
|
const type = typeof value;
|
||||||
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
||||||
value == null || isSymbol(value)) {
|
value == null || isSymbol(value)) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
||||||
*/
|
*/
|
||||||
function isKeyable(value) {
|
function isKeyable(value) {
|
||||||
var type = typeof value;
|
const type = typeof value;
|
||||||
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
||||||
? (value !== '__proto__')
|
? (value !== '__proto__')
|
||||||
: (value === null);
|
: (value === null);
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ import stubFalse from './stubFalse.js';
|
|||||||
* @param {*} value The value to check.
|
* @param {*} value The value to check.
|
||||||
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
|
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
|
||||||
*/
|
*/
|
||||||
var isMaskable = coreJsData ? isFunction : stubFalse;
|
const isMaskable = coreJsData ? isFunction : stubFalse;
|
||||||
|
|
||||||
export default isMaskable;
|
export default isMaskable;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import coreJsData from './_coreJsData.js';
|
import coreJsData from './_coreJsData.js';
|
||||||
|
|
||||||
/** Used to detect methods masquerading as native. */
|
/** Used to detect methods masquerading as native. */
|
||||||
var maskSrcKey = ((() => {
|
const maskSrcKey = ((() => {
|
||||||
const uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
const uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
||||||
return uid ? `Symbol(src)_1.${ uid }` : '';
|
return uid ? `Symbol(src)_1.${ uid }` : '';
|
||||||
})());
|
})());
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
const objectProto = Object.prototype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is likely a prototype object.
|
* Checks if `value` is likely a prototype object.
|
||||||
@@ -9,8 +9,8 @@ var objectProto = Object.prototype;
|
|||||||
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
||||||
*/
|
*/
|
||||||
function isPrototype(value) {
|
function isPrototype(value) {
|
||||||
var Ctor = value && value.constructor,
|
const Ctor = value && value.constructor;
|
||||||
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
const proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
||||||
|
|
||||||
return value === proto;
|
return value === proto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
* @returns {Array} Returns the converted array.
|
* @returns {Array} Returns the converted array.
|
||||||
*/
|
*/
|
||||||
function iteratorToArray(iterator) {
|
function iteratorToArray(iterator) {
|
||||||
var data,
|
let data;
|
||||||
result = [];
|
const result = [];
|
||||||
|
|
||||||
while (!(data = iterator.next()).done) {
|
while (!(data = iterator.next()).done) {
|
||||||
result.push(data.value);
|
result.push(data.value);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import getMapData from './_getMapData.js';
|
|||||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||||
*/
|
*/
|
||||||
function mapCacheDelete(key) {
|
function mapCacheDelete(key) {
|
||||||
var result = getMapData(this, key)['delete'](key);
|
const result = getMapData(this, key)['delete'](key);
|
||||||
this.size -= result ? 1 : 0;
|
this.size -= result ? 1 : 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import getMapData from './_getMapData.js';
|
|||||||
* @returns {Object} Returns the map cache instance.
|
* @returns {Object} Returns the map cache instance.
|
||||||
*/
|
*/
|
||||||
function mapCacheSet(key, value) {
|
function mapCacheSet(key, value) {
|
||||||
var data = getMapData(this, key),
|
const data = getMapData(this, key);
|
||||||
size = data.size;
|
const size = data.size;
|
||||||
|
|
||||||
data.set(key, value);
|
data.set(key, value);
|
||||||
this.size += data.size == size ? 0 : 1;
|
this.size += data.size == size ? 0 : 1;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/** Used to match template delimiters. */
|
/** Used to match template delimiters. */
|
||||||
var reEscape = /<%-([\s\S]+?)%>/g;
|
const reEscape = /<%-([\s\S]+?)%>/g;
|
||||||
|
|
||||||
export default reEscape;
|
export default reEscape;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/** Used to match template delimiters. */
|
/** Used to match template delimiters. */
|
||||||
var reEvaluate = /<%([\s\S]+?)%>/g;
|
const reEvaluate = /<%([\s\S]+?)%>/g;
|
||||||
|
|
||||||
export default reEvaluate;
|
export default reEvaluate;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/** Used to match template delimiters. */
|
/** Used to match template delimiters. */
|
||||||
var reInterpolate = /<%=([\s\S]+?)%>/g;
|
const reInterpolate = /<%=([\s\S]+?)%>/g;
|
||||||
|
|
||||||
export default reInterpolate;
|
export default reInterpolate;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/** Used to lookup unminified function names. */
|
/** Used to lookup unminified function names. */
|
||||||
var realNames = {};
|
const realNames = {};
|
||||||
|
|
||||||
export default realNames;
|
export default realNames;
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ import shortOut from './_shortOut.js';
|
|||||||
* @param {*} data The metadata.
|
* @param {*} data The metadata.
|
||||||
* @returns {Function} Returns `func`.
|
* @returns {Function} Returns `func`.
|
||||||
*/
|
*/
|
||||||
var setData = shortOut(baseSetData);
|
const setData = shortOut(baseSetData);
|
||||||
|
|
||||||
export default setData;
|
export default setData;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
* @returns {Array} Returns the values.
|
* @returns {Array} Returns the values.
|
||||||
*/
|
*/
|
||||||
function setToArray(set) {
|
function setToArray(set) {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
result = Array(set.size);
|
const result = Array(set.size);
|
||||||
|
|
||||||
set.forEach(value => {
|
set.forEach(value => {
|
||||||
result[++index] = value;
|
result[++index] = value;
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ import shortOut from './_shortOut.js';
|
|||||||
* @param {Function} string The `toString` result.
|
* @param {Function} string The `toString` result.
|
||||||
* @returns {Function} Returns `func`.
|
* @returns {Function} Returns `func`.
|
||||||
*/
|
*/
|
||||||
var setToString = shortOut(baseSetToString);
|
const setToString = shortOut(baseSetToString);
|
||||||
|
|
||||||
export default setToString;
|
export default setToString;
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ import baseRandom from './_baseRandom.js';
|
|||||||
* @returns {Array} Returns `array`.
|
* @returns {Array} Returns `array`.
|
||||||
*/
|
*/
|
||||||
function shuffleSelf(array, size) {
|
function shuffleSelf(array, size) {
|
||||||
var index = -1,
|
let index = -1;
|
||||||
length = array.length,
|
const length = array.length;
|
||||||
lastIndex = length - 1;
|
const lastIndex = length - 1;
|
||||||
|
|
||||||
size = size === undefined ? length : size;
|
size = size === undefined ? length : size;
|
||||||
while (++index < size) {
|
while (++index < size) {
|
||||||
var rand = baseRandom(index, lastIndex),
|
const rand = baseRandom(index, lastIndex);
|
||||||
value = array[rand];
|
const value = array[rand];
|
||||||
|
|
||||||
array[rand] = array[index];
|
array[rand] = array[index];
|
||||||
array[index] = value;
|
array[index] = value;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import negate from './negate.js';
|
|||||||
* // => objects for ['barney']
|
* // => objects for ['barney']
|
||||||
*/
|
*/
|
||||||
function reject(collection, predicate) {
|
function reject(collection, predicate) {
|
||||||
var func = isArray(collection) ? arrayFilter : baseFilter;
|
const func = isArray(collection) ? arrayFilter : baseFilter;
|
||||||
return func(collection, negate(baseIteratee(predicate, 3)));
|
return func(collection, negate(baseIteratee(predicate, 3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
rest.js
2
rest.js
@@ -2,7 +2,7 @@ import baseRest from './_baseRest.js';
|
|||||||
import toInteger from './toInteger.js';
|
import toInteger from './toInteger.js';
|
||||||
|
|
||||||
/** Error message constants. */
|
/** Error message constants. */
|
||||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
const FUNC_ERROR_TEXT = 'Expected a function';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that invokes `func` with the `this` binding of the
|
* Creates a function that invokes `func` with the `this` binding of the
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ import toKey from './_toKey.js';
|
|||||||
function result(object, path, defaultValue) {
|
function result(object, path, defaultValue) {
|
||||||
path = castPath(path, object);
|
path = castPath(path, object);
|
||||||
|
|
||||||
var index = -1,
|
let index = -1;
|
||||||
length = path.length;
|
let length = path.length;
|
||||||
|
|
||||||
// Ensure the loop is entered when path is empty.
|
// Ensure the loop is entered when path is empty.
|
||||||
if (!length) {
|
if (!length) {
|
||||||
@@ -43,7 +43,7 @@ function result(object, path, defaultValue) {
|
|||||||
object = undefined;
|
object = undefined;
|
||||||
}
|
}
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var value = object == null ? undefined : object[toKey(path[index])];
|
let value = object == null ? undefined : object[toKey(path[index])];
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
index = length;
|
index = length;
|
||||||
value = defaultValue;
|
value = defaultValue;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var arrayProto = Array.prototype;
|
const arrayProto = Array.prototype;
|
||||||
|
|
||||||
/* 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 nativeReverse = arrayProto.reverse;
|
const nativeReverse = arrayProto.reverse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverses `array` so that the first element becomes the last, the second
|
* Reverses `array` so that the first element becomes the last, the second
|
||||||
|
|||||||
2
round.js
2
round.js
@@ -21,6 +21,6 @@ import createRound from './_createRound.js';
|
|||||||
* _.round(4060, -2);
|
* _.round(4060, -2);
|
||||||
* // => 4100
|
* // => 4100
|
||||||
*/
|
*/
|
||||||
var round = createRound('round');
|
const round = createRound('round');
|
||||||
|
|
||||||
export default round;
|
export default round;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import isArray from './isArray.js';
|
|||||||
* // => 2
|
* // => 2
|
||||||
*/
|
*/
|
||||||
function sample(collection) {
|
function sample(collection) {
|
||||||
var func = isArray(collection) ? arraySample : baseSample;
|
const func = isArray(collection) ? arraySample : baseSample;
|
||||||
return func(collection);
|
return func(collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function sampleSize(collection, n, guard) {
|
|||||||
} else {
|
} else {
|
||||||
n = toInteger(n);
|
n = toInteger(n);
|
||||||
}
|
}
|
||||||
var func = isArray(collection) ? arraySampleSize : baseSampleSize;
|
const func = isArray(collection) ? arraySampleSize : baseSampleSize;
|
||||||
return func(collection, n);
|
return func(collection, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import isArray from './isArray.js';
|
|||||||
* // => [4, 1, 3, 2]
|
* // => [4, 1, 3, 2]
|
||||||
*/
|
*/
|
||||||
function shuffle(collection) {
|
function shuffle(collection) {
|
||||||
var func = isArray(collection) ? arrayShuffle : baseShuffle;
|
const func = isArray(collection) ? arrayShuffle : baseShuffle;
|
||||||
return func(collection);
|
return func(collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
6
size.js
6
size.js
@@ -5,8 +5,8 @@ import isString from './isString.js';
|
|||||||
import stringSize from './_stringSize.js';
|
import stringSize from './_stringSize.js';
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var mapTag = '[object Map]',
|
const mapTag = '[object Map]';
|
||||||
setTag = '[object Set]';
|
const setTag = '[object Set]';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the size of `collection` by returning its length for array-like
|
* Gets the size of `collection` by returning its length for array-like
|
||||||
@@ -36,7 +36,7 @@ function size(collection) {
|
|||||||
if (isArrayLike(collection)) {
|
if (isArrayLike(collection)) {
|
||||||
return isString(collection) ? stringSize(collection) : collection.length;
|
return isString(collection) ? stringSize(collection) : collection.length;
|
||||||
}
|
}
|
||||||
var tag = getTag(collection);
|
const tag = getTag(collection);
|
||||||
if (tag == mapTag || tag == setTag) {
|
if (tag == mapTag || tag == setTag) {
|
||||||
return collection.size;
|
return collection.size;
|
||||||
}
|
}
|
||||||
|
|||||||
2
slice.js
2
slice.js
@@ -19,7 +19,7 @@ import toInteger from './toInteger.js';
|
|||||||
* @returns {Array} Returns the slice of `array`.
|
* @returns {Array} Returns the slice of `array`.
|
||||||
*/
|
*/
|
||||||
function slice(array, start, end) {
|
function slice(array, start, end) {
|
||||||
var length = array == null ? 0 : array.length;
|
const length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
2
some.js
2
some.js
@@ -41,7 +41,7 @@ import isIterateeCall from './_isIterateeCall.js';
|
|||||||
* // => true
|
* // => true
|
||||||
*/
|
*/
|
||||||
function some(collection, predicate, guard) {
|
function some(collection, predicate, guard) {
|
||||||
var func = isArray(collection) ? arraySome : baseSome;
|
const func = isArray(collection) ? arraySome : baseSome;
|
||||||
if (guard && isIterateeCall(collection, predicate, guard)) {
|
if (guard && isIterateeCall(collection, predicate, guard)) {
|
||||||
predicate = undefined;
|
predicate = undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import eq from './eq.js';
|
|||||||
* // => 1
|
* // => 1
|
||||||
*/
|
*/
|
||||||
function sortedIndexOf(array, value) {
|
function sortedIndexOf(array, value) {
|
||||||
var length = array == null ? 0 : array.length;
|
const length = array == null ? 0 : array.length;
|
||||||
if (length) {
|
if (length) {
|
||||||
var index = baseSortedIndex(array, value);
|
const index = baseSortedIndex(array, value);
|
||||||
if (index < length && eq(array[index], value)) {
|
if (index < length && eq(array[index], value)) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import eq from './eq.js';
|
|||||||
* // => 3
|
* // => 3
|
||||||
*/
|
*/
|
||||||
function sortedLastIndexOf(array, value) {
|
function sortedLastIndexOf(array, value) {
|
||||||
var length = array == null ? 0 : array.length;
|
const length = array == null ? 0 : array.length;
|
||||||
if (length) {
|
if (length) {
|
||||||
var index = baseSortedIndex(array, value, true) - 1;
|
const index = baseSortedIndex(array, value, true) - 1;
|
||||||
if (eq(array[index], value)) {
|
if (eq(array[index], value)) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|||||||
2
split.js
2
split.js
@@ -7,7 +7,7 @@ import stringToArray from './_stringToArray.js';
|
|||||||
import toString from './toString.js';
|
import toString from './toString.js';
|
||||||
|
|
||||||
/** Used as references for the maximum length and index of an array. */
|
/** Used as references for the maximum length and index of an array. */
|
||||||
var MAX_ARRAY_LENGTH = 4294967295;
|
const MAX_ARRAY_LENGTH = 4294967295;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splits `string` by `separator`.
|
* Splits `string` by `separator`.
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import castSlice from './_castSlice.js';
|
|||||||
import toInteger from './toInteger.js';
|
import toInteger from './toInteger.js';
|
||||||
|
|
||||||
/** Error message constants. */
|
/** Error message constants. */
|
||||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
const FUNC_ERROR_TEXT = 'Expected a function';
|
||||||
|
|
||||||
/* 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 nativeMax = Math.max;
|
const nativeMax = Math.max;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that invokes `func` with the `this` binding of the
|
* Creates a function that invokes `func` with the `this` binding of the
|
||||||
@@ -50,8 +50,8 @@ function spread(func, start) {
|
|||||||
}
|
}
|
||||||
start = start == null ? 0 : nativeMax(toInteger(start), 0);
|
start = start == null ? 0 : nativeMax(toInteger(start), 0);
|
||||||
return baseRest(function(args) {
|
return baseRest(function(args) {
|
||||||
var array = args[start],
|
const array = args[start];
|
||||||
otherArgs = castSlice(args, 0, start);
|
const otherArgs = castSlice(args, 0, start);
|
||||||
|
|
||||||
if (array) {
|
if (array) {
|
||||||
arrayPush(otherArgs, array);
|
arrayPush(otherArgs, array);
|
||||||
|
|||||||
@@ -22,6 +22,6 @@ import upperFirst from './upperFirst.js';
|
|||||||
* _.startCase('__FOO_BAR__');
|
* _.startCase('__FOO_BAR__');
|
||||||
* // => 'FOO BAR'
|
* // => 'FOO BAR'
|
||||||
*/
|
*/
|
||||||
var startCase = createCompounder((result, word, index) => result + (index ? ' ' : '') + upperFirst(word));
|
const startCase = createCompounder((result, word, index) => result + (index ? ' ' : '') + upperFirst(word));
|
||||||
|
|
||||||
export default startCase;
|
export default startCase;
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ import createMathOperation from './_createMathOperation.js';
|
|||||||
* _.subtract(6, 4);
|
* _.subtract(6, 4);
|
||||||
* // => 2
|
* // => 2
|
||||||
*/
|
*/
|
||||||
var subtract = createMathOperation((minuend, subtrahend) => minuend - subtrahend, 0);
|
const subtract = createMathOperation((minuend, subtrahend) => minuend - subtrahend, 0);
|
||||||
|
|
||||||
export default subtract;
|
export default subtract;
|
||||||
|
|||||||
2
tail.js
2
tail.js
@@ -15,7 +15,7 @@ import baseSlice from './_baseSlice.js';
|
|||||||
* // => [2, 3]
|
* // => [2, 3]
|
||||||
*/
|
*/
|
||||||
function tail(array) {
|
function tail(array) {
|
||||||
var length = array == null ? 0 : array.length;
|
const length = array == null ? 0 : array.length;
|
||||||
return length ? baseSlice(array, 1, length) : [];
|
return length ? baseSlice(array, 1, length) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import toInteger from './toInteger.js';
|
|||||||
* // => []
|
* // => []
|
||||||
*/
|
*/
|
||||||
function takeRight(array, n, guard) {
|
function takeRight(array, n, guard) {
|
||||||
var length = array == null ? 0 : array.length;
|
const length = array == null ? 0 : array.length;
|
||||||
if (!length) {
|
if (!length) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
39
template.js
39
template.js
@@ -11,21 +11,21 @@ import templateSettings from './templateSettings.js';
|
|||||||
import toString from './toString.js';
|
import toString from './toString.js';
|
||||||
|
|
||||||
/** Used to match empty string literals in compiled template source. */
|
/** Used to match empty string literals in compiled template source. */
|
||||||
var reEmptyStringLeading = /\b__p \+= '';/g,
|
const reEmptyStringLeading = /\b__p \+= '';/g;
|
||||||
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
const reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
|
||||||
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
const reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to match
|
* Used to match
|
||||||
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
|
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
|
||||||
*/
|
*/
|
||||||
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
const reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
||||||
|
|
||||||
/** Used to ensure capturing order of template delimiters. */
|
/** Used to ensure capturing order of template delimiters. */
|
||||||
var reNoMatch = /($^)/;
|
const reNoMatch = /($^)/;
|
||||||
|
|
||||||
/** Used to match unescaped characters in compiled string literals. */
|
/** Used to match unescaped characters in compiled string literals. */
|
||||||
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
const reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a compiled template function that can interpolate data properties
|
* Creates a compiled template function that can interpolate data properties
|
||||||
@@ -135,7 +135,7 @@ function template(string, options, guard) {
|
|||||||
// Based on John Resig's `tmpl` implementation
|
// Based on John Resig's `tmpl` implementation
|
||||||
// (http://ejohn.org/blog/javascript-micro-templating/)
|
// (http://ejohn.org/blog/javascript-micro-templating/)
|
||||||
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
|
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
|
||||||
var settings = templateSettings.imports._.templateSettings || templateSettings;
|
let settings = templateSettings.imports._.templateSettings || templateSettings;
|
||||||
|
|
||||||
if (guard && isIterateeCall(string, options, guard)) {
|
if (guard && isIterateeCall(string, options, guard)) {
|
||||||
options = undefined;
|
options = undefined;
|
||||||
@@ -143,18 +143,19 @@ function template(string, options, guard) {
|
|||||||
string = toString(string);
|
string = toString(string);
|
||||||
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
options = assignInWith({}, options, settings, customDefaultsAssignIn);
|
||||||
|
|
||||||
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
|
const imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn);
|
||||||
importsKeys = keys(imports),
|
const importsKeys = keys(imports);
|
||||||
importsValues = baseValues(imports, importsKeys);
|
const importsValues = baseValues(imports, importsKeys);
|
||||||
|
|
||||||
var isEscaping,
|
let isEscaping;
|
||||||
isEvaluating,
|
let isEvaluating;
|
||||||
index = 0,
|
let index = 0;
|
||||||
interpolate = options.interpolate || reNoMatch,
|
|
||||||
source = "__p += '";
|
const interpolate = options.interpolate || reNoMatch;
|
||||||
|
let source = "__p += '";
|
||||||
|
|
||||||
// Compile the regexp to match each delimiter.
|
// Compile the regexp to match each delimiter.
|
||||||
var reDelimiters = RegExp(
|
const reDelimiters = RegExp(
|
||||||
(options.escape || reNoMatch).source + '|' +
|
(options.escape || reNoMatch).source + '|' +
|
||||||
interpolate.source + '|' +
|
interpolate.source + '|' +
|
||||||
(interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
|
(interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
|
||||||
@@ -162,7 +163,7 @@ function template(string, options, guard) {
|
|||||||
, 'g');
|
, 'g');
|
||||||
|
|
||||||
// Use a sourceURL for easier debugging.
|
// Use a sourceURL for easier debugging.
|
||||||
var sourceURL = 'sourceURL' in options ? `//# sourceURL=${ options.sourceURL }\n` : '';
|
const sourceURL = 'sourceURL' in options ? `//# sourceURL=${ options.sourceURL }\n` : '';
|
||||||
|
|
||||||
string.replace(reDelimiters, (
|
string.replace(reDelimiters, (
|
||||||
match,
|
match,
|
||||||
@@ -200,7 +201,7 @@ function template(string, options, guard) {
|
|||||||
|
|
||||||
// If `variable` is not specified wrap a with-statement around the generated
|
// If `variable` is not specified wrap a with-statement around the generated
|
||||||
// code to add the data object to the top of the scope chain.
|
// code to add the data object to the top of the scope chain.
|
||||||
var variable = options.variable;
|
const variable = options.variable;
|
||||||
if (!variable) {
|
if (!variable) {
|
||||||
source = `with (obj) {\n${ source }\n}\n`;
|
source = `with (obj) {\n${ source }\n}\n`;
|
||||||
}
|
}
|
||||||
@@ -228,7 +229,7 @@ function template(string, options, guard) {
|
|||||||
source +
|
source +
|
||||||
'return __p\n}';
|
'return __p\n}';
|
||||||
|
|
||||||
var result = attempt(() => Function(importsKeys, `${ sourceURL }return ${ source }`))(...importsValues);
|
const result = attempt(() => Function(importsKeys, `${ sourceURL }return ${ source }`))(...importsValues);
|
||||||
|
|
||||||
// Provide the compiled function's source by its `toString` method or
|
// Provide the compiled function's source by its `toString` method or
|
||||||
// the `source` property as a convenience for inlining compiled templates.
|
// the `source` property as a convenience for inlining compiled templates.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import reInterpolate from './_reInterpolate.js';
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
var templateSettings = {
|
const templateSettings = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to detect `data` property values to be HTML-escaped.
|
* Used to detect `data` property values to be HTML-escaped.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import debounce from './debounce.js';
|
|||||||
import isObject from './isObject.js';
|
import isObject from './isObject.js';
|
||||||
|
|
||||||
/** Error message constants. */
|
/** Error message constants. */
|
||||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
const FUNC_ERROR_TEXT = 'Expected a function';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a throttled function that only invokes `func` at most once per
|
* Creates a throttled function that only invokes `func` at most once per
|
||||||
@@ -49,8 +49,8 @@ var FUNC_ERROR_TEXT = 'Expected a function';
|
|||||||
* jQuery(window).on('popstate', throttled.cancel);
|
* jQuery(window).on('popstate', throttled.cancel);
|
||||||
*/
|
*/
|
||||||
function throttle(func, wait, options) {
|
function throttle(func, wait, options) {
|
||||||
var leading = true,
|
let leading = true;
|
||||||
trailing = true;
|
let trailing = true;
|
||||||
|
|
||||||
if (typeof func != 'function') {
|
if (typeof func != 'function') {
|
||||||
throw new TypeError(FUNC_ERROR_TEXT);
|
throw new TypeError(FUNC_ERROR_TEXT);
|
||||||
|
|||||||
12
times.js
12
times.js
@@ -3,13 +3,13 @@ import castFunction from './_castFunction.js';
|
|||||||
import toInteger from './toInteger.js';
|
import toInteger from './toInteger.js';
|
||||||
|
|
||||||
/** Used as references for various `Number` constants. */
|
/** Used as references for various `Number` constants. */
|
||||||
var MAX_SAFE_INTEGER = 9007199254740991;
|
const MAX_SAFE_INTEGER = 9007199254740991;
|
||||||
|
|
||||||
/** Used as references for the maximum length and index of an array. */
|
/** Used as references for the maximum length and index of an array. */
|
||||||
var MAX_ARRAY_LENGTH = 4294967295;
|
const MAX_ARRAY_LENGTH = 4294967295;
|
||||||
|
|
||||||
/* 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 nativeMin = Math.min;
|
const nativeMin = Math.min;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invokes the iteratee `n` times, returning an array of the results of
|
* Invokes the iteratee `n` times, returning an array of the results of
|
||||||
@@ -35,13 +35,13 @@ function times(n, iteratee) {
|
|||||||
if (n < 1 || n > MAX_SAFE_INTEGER) {
|
if (n < 1 || n > MAX_SAFE_INTEGER) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
var index = MAX_ARRAY_LENGTH,
|
let index = MAX_ARRAY_LENGTH;
|
||||||
length = nativeMin(n, MAX_ARRAY_LENGTH);
|
const length = nativeMin(n, MAX_ARRAY_LENGTH);
|
||||||
|
|
||||||
iteratee = castFunction(iteratee);
|
iteratee = castFunction(iteratee);
|
||||||
n -= MAX_ARRAY_LENGTH;
|
n -= MAX_ARRAY_LENGTH;
|
||||||
|
|
||||||
var result = baseTimes(length, iteratee);
|
const result = baseTimes(length, iteratee);
|
||||||
while (++index < n) {
|
while (++index < n) {
|
||||||
iteratee(index);
|
iteratee(index);
|
||||||
}
|
}
|
||||||
|
|||||||
10
toArray.js
10
toArray.js
@@ -10,11 +10,11 @@ import stringToArray from './_stringToArray.js';
|
|||||||
import values from './values.js';
|
import values from './values.js';
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var mapTag = '[object Map]',
|
const mapTag = '[object Map]';
|
||||||
setTag = '[object Set]';
|
const setTag = '[object Set]';
|
||||||
|
|
||||||
/** Built-in value references. */
|
/** Built-in value references. */
|
||||||
var symIterator = Symbol ? Symbol.iterator : undefined;
|
const symIterator = Symbol ? Symbol.iterator : undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts `value` to an array.
|
* Converts `value` to an array.
|
||||||
@@ -49,8 +49,8 @@ function toArray(value) {
|
|||||||
if (symIterator && value[symIterator]) {
|
if (symIterator && value[symIterator]) {
|
||||||
return iteratorToArray(value[symIterator]());
|
return iteratorToArray(value[symIterator]());
|
||||||
}
|
}
|
||||||
var tag = getTag(value),
|
const tag = getTag(value);
|
||||||
func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
|
const func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
|
||||||
|
|
||||||
return func(value);
|
return func(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import toNumber from './toNumber.js';
|
import toNumber from './toNumber.js';
|
||||||
|
|
||||||
/** Used as references for various `Number` constants. */
|
/** Used as references for various `Number` constants. */
|
||||||
var INFINITY = 1 / 0,
|
const INFINITY = 1 / 0;
|
||||||
MAX_INTEGER = 1.7976931348623157e+308;
|
const MAX_INTEGER = 1.7976931348623157e+308;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts `value` to a finite number.
|
* Converts `value` to a finite number.
|
||||||
@@ -33,7 +33,7 @@ function toFinite(value) {
|
|||||||
}
|
}
|
||||||
value = toNumber(value);
|
value = toNumber(value);
|
||||||
if (value === INFINITY || value === -INFINITY) {
|
if (value === INFINITY || value === -INFINITY) {
|
||||||
var sign = (value < 0 ? -1 : 1);
|
const sign = (value < 0 ? -1 : 1);
|
||||||
return sign * MAX_INTEGER;
|
return sign * MAX_INTEGER;
|
||||||
}
|
}
|
||||||
return value === value ? value : 0;
|
return value === value ? value : 0;
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ import toFinite from './toFinite.js';
|
|||||||
* // => 3
|
* // => 3
|
||||||
*/
|
*/
|
||||||
function toInteger(value) {
|
function toInteger(value) {
|
||||||
var result = toFinite(value),
|
const result = toFinite(value);
|
||||||
remainder = result % 1;
|
const remainder = result % 1;
|
||||||
|
|
||||||
return result === result ? (remainder ? result - remainder : result) : 0;
|
return result === result ? (remainder ? result - remainder : result) : 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import baseClamp from './_baseClamp.js';
|
|||||||
import toInteger from './toInteger.js';
|
import toInteger from './toInteger.js';
|
||||||
|
|
||||||
/** Used as references for the maximum length and index of an array. */
|
/** Used as references for the maximum length and index of an array. */
|
||||||
var MAX_ARRAY_LENGTH = 4294967295;
|
const MAX_ARRAY_LENGTH = 4294967295;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts `value` to an integer suitable for use as the length of an
|
* Converts `value` to an integer suitable for use as the length of an
|
||||||
|
|||||||
16
toNumber.js
16
toNumber.js
@@ -2,22 +2,22 @@ import isObject from './isObject.js';
|
|||||||
import isSymbol from './isSymbol.js';
|
import isSymbol from './isSymbol.js';
|
||||||
|
|
||||||
/** Used as references for various `Number` constants. */
|
/** Used as references for various `Number` constants. */
|
||||||
var NAN = 0 / 0;
|
const NAN = 0 / 0;
|
||||||
|
|
||||||
/** Used to match leading and trailing whitespace. */
|
/** Used to match leading and trailing whitespace. */
|
||||||
var reTrim = /^\s+|\s+$/g;
|
const reTrim = /^\s+|\s+$/g;
|
||||||
|
|
||||||
/** Used to detect bad signed hexadecimal string values. */
|
/** Used to detect bad signed hexadecimal string values. */
|
||||||
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
const reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
||||||
|
|
||||||
/** Used to detect binary string values. */
|
/** Used to detect binary string values. */
|
||||||
var reIsBinary = /^0b[01]+$/i;
|
const reIsBinary = /^0b[01]+$/i;
|
||||||
|
|
||||||
/** Used to detect octal string values. */
|
/** Used to detect octal string values. */
|
||||||
var reIsOctal = /^0o[0-7]+$/i;
|
const reIsOctal = /^0o[0-7]+$/i;
|
||||||
|
|
||||||
/** Built-in method references without a dependency on `root`. */
|
/** Built-in method references without a dependency on `root`. */
|
||||||
var freeParseInt = parseInt;
|
const freeParseInt = parseInt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts `value` to a number.
|
* Converts `value` to a number.
|
||||||
@@ -50,14 +50,14 @@ function toNumber(value) {
|
|||||||
return NAN;
|
return NAN;
|
||||||
}
|
}
|
||||||
if (isObject(value)) {
|
if (isObject(value)) {
|
||||||
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
const other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
||||||
value = isObject(other) ? `${ other }` : other;
|
value = isObject(other) ? `${ other }` : other;
|
||||||
}
|
}
|
||||||
if (typeof value != 'string') {
|
if (typeof value != 'string') {
|
||||||
return value === 0 ? value : +value;
|
return value === 0 ? value : +value;
|
||||||
}
|
}
|
||||||
value = value.replace(reTrim, '');
|
value = value.replace(reTrim, '');
|
||||||
var isBinary = reIsBinary.test(value);
|
const isBinary = reIsBinary.test(value);
|
||||||
return (isBinary || reIsOctal.test(value))
|
return (isBinary || reIsOctal.test(value))
|
||||||
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
||||||
: (reIsBadHex.test(value) ? NAN : +value);
|
: (reIsBadHex.test(value) ? NAN : +value);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user