Apply more let/const transforms.

This commit is contained in:
John-David Dalton
2017-01-08 23:38:19 -08:00
parent ca9e6fa087
commit 4d0c15b49e
115 changed files with 621 additions and 613 deletions

View File

@@ -12,12 +12,12 @@ import listCacheSet from './_listCacheSet.js';
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
let index = -1;
const length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
const entry = entries[index];
this.set(entry[0], entry[1]);
}
}

View File

@@ -2,6 +2,6 @@ import getNative from './_getNative.js';
import root from './_root.js';
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map');
const Map = getNative(root, 'Map');
export default Map;

View File

@@ -12,12 +12,12 @@ import mapCacheSet from './_mapCacheSet.js';
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
let index = -1;
const length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
const entry = entries[index];
this.set(entry[0], entry[1]);
}
}

View File

@@ -2,6 +2,6 @@ import getNative from './_getNative.js';
import root from './_root.js';
/* Built-in method references that are verified to be native. */
var Promise = getNative(root, 'Promise');
const Promise = getNative(root, 'Promise');
export default Promise;

View File

@@ -6,10 +6,10 @@ import isIndex from './_isIndex.js';
import isTypedArray from './isTypedArray.js';
/** Used for built-in method references. */
var objectProto = Object.prototype;
const objectProto = Object.prototype;
/** 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`.
@@ -20,15 +20,15 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray(value),
isArg = !isArr && isArguments(value),
isBuff = !isArr && !isArg && isBuffer(value),
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? baseTimes(value.length, String) : [],
length = result.length;
const isArr = isArray(value);
const isArg = !isArr && isArguments(value);
const isBuff = !isArr && !isArg && isBuffer(value);
const isType = !isArr && !isArg && !isBuff && isTypedArray(value);
const skipIndexes = isArr || isArg || isBuff || isType;
const result = skipIndexes ? baseTimes(value.length, String) : [];
const length = result.length;
for (var key in value) {
for (const key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.

View File

@@ -24,36 +24,36 @@ const CLONE_FLAT_FLAG = 2;
const CLONE_SYMBOLS_FLAG = 4;
/** `Object#toString` result references. */
const argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
weakMapTag = '[object WeakMap]';
const argsTag = '[object Arguments]';
const arrayTag = '[object Array]';
const boolTag = '[object Boolean]';
const dateTag = '[object Date]';
const errorTag = '[object Error]';
const funcTag = '[object Function]';
const genTag = '[object GeneratorFunction]';
const mapTag = '[object Map]';
const numberTag = '[object Number]';
const objectTag = '[object Object]';
const regexpTag = '[object RegExp]';
const setTag = '[object Set]';
const stringTag = '[object String]';
const symbolTag = '[object Symbol]';
const weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
const arrayBufferTag = '[object ArrayBuffer]';
const dataViewTag = '[object DataView]';
const float32Tag = '[object Float32Array]';
const float64Tag = '[object Float64Array]';
const int8Tag = '[object Int8Array]';
const int16Tag = '[object Int16Array]';
const int32Tag = '[object Int32Array]';
const uint8Tag = '[object Uint8Array]';
const uint8ClampedTag = '[object Uint8ClampedArray]';
const uint16Tag = '[object Uint16Array]';
const uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
const cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] =
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
cloneableTags[boolTag] = cloneableTags[dateTag] =
@@ -85,10 +85,10 @@ cloneableTags[weakMapTag] = false;
* @returns {*} Returns the cloned value.
*/
function baseClone(value, bitmask, customizer, key, object, stack) {
var result,
isDeep = bitmask & CLONE_DEEP_FLAG,
isFlat = bitmask & CLONE_FLAT_FLAG,
isFull = bitmask & CLONE_SYMBOLS_FLAG;
let result;
const isDeep = bitmask & CLONE_DEEP_FLAG;
const isFlat = bitmask & CLONE_FLAT_FLAG;
const isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
@@ -99,15 +99,15 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
if (!isObject(value)) {
return value;
}
var isArr = isArray(value);
const isArr = isArray(value);
if (isArr) {
result = initCloneArray(value);
if (!isDeep) {
return copyArray(value, result);
}
} else {
var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag;
const tag = getTag(value);
const isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
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.
stack || (stack = new Stack);
var stacked = stack.get(value);
const stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
var keysFunc = isFull
const keysFunc = isFull
? (isFlat ? getAllKeysIn : getAllKeys)
: (isFlat ? keysIn : keys);
var props = isArr ? undefined : keysFunc(value);
const props = isArr ? undefined : keysFunc(value);
arrayEach(props || value, (subValue, key) => {
if (props) {
key = subValue;

View File

@@ -6,7 +6,7 @@ import baseUnary from './_baseUnary.js';
import cacheHas from './_cacheHas.js';
/** 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
@@ -20,12 +20,12 @@ var LARGE_ARRAY_SIZE = 200;
* @returns {Array} Returns the new array of filtered values.
*/
function baseDifference(array, values, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
isCommon = true,
length = array.length,
result = [],
valuesLength = values.length;
let index = -1;
let includes = arrayIncludes;
let isCommon = true;
const length = array.length;
const result = [];
const valuesLength = values.length;
if (!length) {
return result;
@@ -44,12 +44,12 @@ function baseDifference(array, values, iteratee, comparator) {
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee == null ? value : iteratee(value);
let value = array[index];
const computed = iteratee == null ? value : iteratee(value);
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
let valuesIndex = valuesLength;
while (valuesIndex--) {
if (values[valuesIndex] === computed) {
continue outer;

View File

@@ -6,7 +6,7 @@ import baseUnary from './_baseUnary.js';
import cacheHas from './_cacheHas.js';
/* 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
@@ -19,13 +19,14 @@ var nativeMin = Math.min;
* @returns {Array} Returns the new array of shared values.
*/
function baseIntersection(arrays, iteratee, comparator) {
var includes = comparator ? arrayIncludesWith : arrayIncludes,
length = arrays[0].length,
othLength = arrays.length,
othIndex = othLength,
caches = Array(othLength),
maxLength = Infinity,
result = [];
const includes = comparator ? arrayIncludesWith : arrayIncludes;
const length = arrays[0].length;
const othLength = arrays.length;
const caches = Array(othLength);
const result = [];
let maxLength = Infinity;
let othIndex = othLength;
while (othIndex--) {
var array = arrays[othIndex];
@@ -39,13 +40,13 @@ function baseIntersection(arrays, iteratee, comparator) {
}
array = arrays[0];
var index = -1,
seen = caches[0];
let index = -1;
const seen = caches[0];
outer:
while (++index < length && result.length < maxLength) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
let value = array[index];
const computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (!(seen
@@ -54,7 +55,7 @@ function baseIntersection(arrays, iteratee, comparator) {
)) {
othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
const cache = caches[othIndex];
if (!(cache
? cacheHas(cache, computed)
: includes(arrays[othIndex], computed, comparator))

View File

@@ -8,18 +8,18 @@ import isBuffer from './isBuffer.js';
import isTypedArray from './isTypedArray.js';
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1;
const COMPARE_PARTIAL_FLAG = 1;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
objectTag = '[object Object]';
const argsTag = '[object Arguments]';
const arrayTag = '[object Array]';
const objectTag = '[object Object]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
const objectProto = Object.prototype;
/** 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
@@ -36,17 +36,17 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = objIsArr ? arrayTag : getTag(object),
othTag = othIsArr ? arrayTag : getTag(other);
let objIsArr = isArray(object);
const othIsArr = isArray(other);
let objTag = objIsArr ? arrayTag : getTag(object);
let othTag = othIsArr ? arrayTag : getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag,
isSameTag = objTag == othTag;
let objIsObj = objTag == objectTag;
const othIsObj = othTag == objectTag;
const isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object)) {
if (!isBuffer(other)) {
@@ -62,12 +62,12 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
const objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__');
const othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
const objUnwrapped = objIsWrapped ? object.value() : object;
const othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);

View File

@@ -2,8 +2,8 @@ import Stack from './_Stack.js';
import baseIsEqual from './_baseIsEqual.js';
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
const COMPARE_PARTIAL_FLAG = 1;
const COMPARE_UNORDERED_FLAG = 2;
/**
* 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`.
*/
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
let index = matchData.length;
const length = index;
const noCustomizer = !customizer;
if (object == null) {
return !length;
}
let data;
let result;
object = Object(object);
while (index--) {
var data = matchData[index];
data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
@@ -35,18 +37,18 @@ function baseIsMatch(object, source, matchData, customizer) {
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
const key = data[0];
const objValue = object[key];
const srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var stack = new Stack;
const stack = new Stack;
if (customizer) {
var result = customizer(objValue, srcValue, key, object, source, stack);
result = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result === undefined
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)

View File

@@ -3,34 +3,34 @@ import isLength from './isLength.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
const argsTag = '[object Arguments]';
const arrayTag = '[object Array]';
const boolTag = '[object Boolean]';
const dateTag = '[object Date]';
const errorTag = '[object Error]';
const funcTag = '[object Function]';
const mapTag = '[object Map]';
const numberTag = '[object Number]';
const objectTag = '[object Object]';
const regexpTag = '[object RegExp]';
const setTag = '[object Set]';
const stringTag = '[object String]';
const weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
const arrayBufferTag = '[object ArrayBuffer]';
const dataViewTag = '[object DataView]';
const float32Tag = '[object Float32Array]';
const float64Tag = '[object Float64Array]';
const int8Tag = '[object Int8Array]';
const int16Tag = '[object Int16Array]';
const int32Tag = '[object Int32Array]';
const uint8Tag = '[object Uint8Array]';
const uint8ClampedTag = '[object Uint8ClampedArray]';
const uint16Tag = '[object Uint16Array]';
const uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
const typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =

View File

@@ -29,24 +29,24 @@ import toPlainObject from './toPlainObject.js';
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = object[key],
srcValue = source[key],
stacked = stack.get(srcValue);
const objValue = object[key];
const srcValue = source[key];
const stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer
let newValue = customizer
? customizer(objValue, srcValue, `${ key }`, object, source, stack)
: undefined;
var isCommon = newValue === undefined;
let isCommon = newValue === undefined;
if (isCommon) {
var isArr = isArray(srcValue),
isBuff = !isArr && isBuffer(srcValue),
isTyped = !isArr && !isBuff && isTypedArray(srcValue);
const isArr = isArray(srcValue);
const isBuff = !isArr && isBuffer(srcValue);
const isTyped = !isArr && !isBuff && isTypedArray(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {

View File

@@ -12,14 +12,13 @@ import castPath from './_castPath.js';
* @returns {Object} Returns the new object.
*/
function basePickBy(object, paths, predicate) {
var index = -1,
length = paths.length,
result = {};
let index = -1;
const length = paths.length;
const result = {};
while (++index < length) {
var path = paths[index],
value = baseGet(object, path);
const path = paths[index];
const value = baseGet(object, path);
if (predicate(value, path)) {
baseSet(result, castPath(path, object), value);
}

View File

@@ -5,10 +5,10 @@ import baseUnary from './_baseUnary.js';
import copyArray from './_copyArray.js';
/** Used for built-in method references. */
var arrayProto = Array.prototype;
const arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
const splice = arrayProto.splice;
/**
* The base implementation of `_.pullAllBy` without support for iteratee
@@ -22,10 +22,11 @@ var splice = arrayProto.splice;
* @returns {Array} Returns `array`.
*/
function basePullAll(array, values, iteratee, comparator) {
var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
index = -1,
length = values.length,
seen = array;
const indexOf = comparator ? baseIndexOfWith : baseIndexOf;
const length = values.length;
let index = -1;
let seen = array;
if (array === values) {
values = copyArray(values);
@@ -34,9 +35,9 @@ function basePullAll(array, values, iteratee, comparator) {
seen = arrayMap(array, baseUnary(iteratee));
}
while (++index < length) {
var fromIndex = 0,
value = values[index],
computed = iteratee ? iteratee(value) : value;
let fromIndex = 0;
const value = values[index];
const computed = iteratee ? iteratee(value) : value;
while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
if (seen !== array) {

View File

@@ -1,6 +1,6 @@
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeFloor = Math.floor,
nativeRandom = Math.random;
const nativeFloor = Math.floor;
const nativeRandom = Math.random;
/**
* The base implementation of `_.random` without support for returning

View File

@@ -1,6 +1,6 @@
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil,
nativeMax = Math.max;
const nativeCeil = Math.ceil;
const nativeMax = Math.max;
/**
* 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.
*/
function baseRange(start, end, step, fromRight) {
var index = -1,
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
result = Array(length);
let index = -1;
let length = nativeMax(nativeCeil((end - start) / (step || 1)), 0);
const result = Array(length);
while (length--) {
result[fromRight ? length : ++index] = start;

View File

@@ -20,17 +20,18 @@ function baseSet(object, path, value, customizer) {
}
path = castPath(path, object);
var index = -1,
length = path.length,
lastIndex = length - 1,
nested = object;
const length = path.length;
const lastIndex = length - 1;
let index = -1;
let nested = object;
while (nested != null && ++index < length) {
var key = toKey(path[index]),
newValue = value;
const key = toKey(path[index]);
let newValue = value;
if (index != lastIndex) {
var objValue = nested[key];
const objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined;
if (newValue === undefined) {
newValue = isObject(objValue)

View File

@@ -8,7 +8,7 @@
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice(array, start, end) {
var index = -1,
let index = -1,
length = array.length;
if (start < 0) {
@@ -21,7 +21,7 @@ function baseSlice(array, start, end) {
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
var result = Array(length);
const result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}

View File

@@ -3,8 +3,8 @@ import identity from './identity.js';
import isSymbol from './isSymbol.js';
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295,
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
const MAX_ARRAY_LENGTH = 4294967295;
const HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
/**
* The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
@@ -19,14 +19,13 @@ var MAX_ARRAY_LENGTH = 4294967295,
* into `array`.
*/
function baseSortedIndex(array, value, retHighest) {
var low = 0,
high = array == null ? low : array.length;
let low = 0;
let high = array == null ? low : array.length;
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
while (low < high) {
var mid = (low + high) >>> 1,
computed = array[mid];
const mid = (low + high) >>> 1;
const computed = array[mid];
if (computed !== null && !isSymbol(computed) &&
(retHighest ? (computed <= value) : (computed < value))) {
low = mid + 1;

View File

@@ -1,12 +1,11 @@
import isSymbol from './isSymbol.js';
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295,
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
const MAX_ARRAY_LENGTH = 4294967295;
const MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeFloor = Math.floor,
nativeMin = Math.min;
const nativeFloor = Math.floor, nativeMin = Math.min;
/**
* The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
@@ -24,20 +23,20 @@ var nativeFloor = Math.floor,
function baseSortedIndexBy(array, value, iteratee, retHighest) {
value = iteratee(value);
var low = 0,
high = array == null ? 0 : array.length,
valIsNaN = value !== value,
valIsNull = value === null,
valIsSymbol = isSymbol(value),
valIsUndefined = value === undefined;
let low = 0;
let high = array == null ? 0 : array.length;
const valIsNaN = value !== value;
const valIsNull = value === null;
const valIsSymbol = isSymbol(value);
const valIsUndefined = value === undefined;
while (low < high) {
var mid = nativeFloor((low + high) / 2),
computed = iteratee(array[mid]),
othIsDefined = computed !== undefined,
othIsNull = computed === null,
othIsReflexive = computed === computed,
othIsSymbol = isSymbol(computed);
const mid = nativeFloor((low + high) / 2);
const computed = iteratee(array[mid]);
const othIsDefined = computed !== undefined;
const othIsNull = computed === null;
const othIsReflexive = computed === computed;
const othIsSymbol = isSymbol(computed);
if (valIsNaN) {
var setLow = retHighest || othIsReflexive;

View File

@@ -10,17 +10,17 @@ import eq from './eq.js';
* @returns {Array} Returns the new duplicate free array.
*/
function baseSortedUniq(array, iteratee) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
let seen;
let index = -1;
let resIndex = 0;
const length = array.length;
const result = [];
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
const value = array[index], computed = iteratee ? iteratee(value) : value;
if (!index || !eq(computed, seen)) {
var seen = computed;
seen = computed;
result[resIndex++] = value === 0 ? 0 : value;
}
}

View File

@@ -6,7 +6,7 @@ import createSet from './_createSet.js';
import setToArray from './_setToArray.js';
/** 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.
@@ -18,19 +18,20 @@ var LARGE_ARRAY_SIZE = 200;
* @returns {Array} Returns the new duplicate free array.
*/
function baseUniq(array, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
length = array.length,
isCommon = true,
result = [],
seen = result;
let index = -1;
let includes = arrayIncludes;
let isCommon = true;
const length = array.length;
const result = [];
let seen = result;
if (comparator) {
isCommon = false;
includes = arrayIncludesWith;
}
else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : createSet(array);
const set = iteratee ? null : createSet(array);
if (set) {
return setToArray(set);
}
@@ -43,12 +44,12 @@ function baseUniq(array, iteratee, comparator) {
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
let value = array[index];
const computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
let seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;

View File

@@ -1,17 +1,16 @@
import root from './_root.js';
/** 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`. */
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`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
const moduleExports = freeModule && freeModule.exports === freeExports;
/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined,
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
const Buffer = moduleExports ? root.Buffer : undefined, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
/**
* Creates a clone of `buffer`.
@@ -25,8 +24,8 @@ function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var length = buffer.length,
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
const length = buffer.length;
const result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result);
return result;

View File

@@ -1,8 +1,8 @@
import Symbol from './_Symbol.js';
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
const symbolProto = Symbol ? Symbol.prototype : undefined;
const symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* Creates a clone of the `symbol` object.

View File

@@ -10,15 +10,15 @@ import isSymbol from './isSymbol.js';
*/
function compareAscending(value, other) {
if (value !== other) {
var valIsDefined = value !== undefined,
valIsNull = value === null,
valIsReflexive = value === value,
valIsSymbol = isSymbol(value);
const valIsDefined = value !== undefined;
const valIsNull = value === null;
const valIsReflexive = value === value;
const valIsSymbol = isSymbol(value);
var othIsDefined = other !== undefined,
othIsNull = other === null,
othIsReflexive = other === other,
othIsSymbol = isSymbol(other);
const othIsDefined = other !== undefined;
const othIsNull = other === null;
const othIsReflexive = other === other;
const othIsSymbol = isSymbol(other);
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||

View File

@@ -15,19 +15,19 @@ import compareAscending from './_compareAscending.js';
* @returns {number} Returns the sort order indicator for `object`.
*/
function compareMultiple(object, other, orders) {
var index = -1,
objCriteria = object.criteria,
othCriteria = other.criteria,
length = objCriteria.length,
ordersLength = orders.length;
let index = -1;
const objCriteria = object.criteria;
const othCriteria = other.criteria;
const length = objCriteria.length;
const ordersLength = orders.length;
while (++index < length) {
var result = compareAscending(objCriteria[index], othCriteria[index]);
const result = compareAscending(objCriteria[index], othCriteria[index]);
if (result) {
if (index >= ordersLength) {
return result;
}
var order = orders[index];
const order = orders[index];
return result * (order == 'desc' ? -1 : 1);
}
}

View File

@@ -1,5 +1,5 @@
/* 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,
@@ -13,14 +13,16 @@ var nativeMax = Math.max;
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgs(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersLength = holders.length,
leftIndex = -1,
leftLength = partials.length,
rangeLength = nativeMax(argsLength - holdersLength, 0),
result = Array(leftLength + rangeLength),
isUncurried = !isCurried;
const argsLength = args.length;
const holdersLength = holders.length;
const leftLength = partials.length;
let argsIndex = -1;
let leftIndex = -1;
let rangeLength = nativeMax(argsLength - holdersLength, 0);
const result = Array(leftLength + rangeLength);
const isUncurried = !isCurried;
while (++leftIndex < leftLength) {
result[leftIndex] = partials[leftIndex];

View File

@@ -1,5 +1,5 @@
/* 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
@@ -13,20 +13,21 @@ var nativeMax = Math.max;
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgsRight(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersIndex = -1,
holdersLength = holders.length,
rightIndex = -1,
rightLength = partials.length,
rangeLength = nativeMax(argsLength - holdersLength, 0),
result = Array(rangeLength + rightLength),
isUncurried = !isCurried;
let argsIndex = -1;
let holdersIndex = -1;
let rightIndex = -1;
const argsLength = args.length;
const holdersLength = holders.length;
const rightLength = partials.length;
const rangeLength = nativeMax(argsLength - holdersLength, 0);
const result = Array(rangeLength + rightLength);
const isUncurried = !isCurried;
while (++argsIndex < rangeLength) {
result[argsIndex] = args[argsIndex];
}
var offset = argsIndex;
const offset = argsIndex;
while (++rightIndex < rightLength) {
result[offset + rightIndex] = partials[rightIndex];
}

View File

@@ -7,8 +7,8 @@
* @returns {number} Returns the placeholder count.
*/
function countHolders(array, placeholder) {
var length = array.length,
result = 0;
let length = array.length;
let result = 0;
while (length--) {
if (array[length] === placeholder) {

View File

@@ -13,9 +13,8 @@ import isArray from './isArray.js';
*/
function createAggregator(setter, initializer) {
return (collection, iteratee) => {
var func = isArray(collection) ? arrayAggregator : baseAggregator,
accumulator = initializer ? initializer() : {};
const func = isArray(collection) ? arrayAggregator : baseAggregator;
const accumulator = initializer ? initializer() : {};
return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
};
}

View File

@@ -10,10 +10,10 @@ import isIterateeCall from './_isIterateeCall.js';
*/
function createAssigner(assigner) {
return baseRest((object, sources) => {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,
guard = length > 2 ? sources[2] : undefined;
let index = -1;
let length = sources.length;
let customizer = length > 1 ? sources[length - 1] : undefined;
const guard = length > 2 ? sources[2] : undefined;
customizer = (assigner.length > 3 && typeof customizer == 'function')
? (length--, customizer)
@@ -25,7 +25,7 @@ function createAssigner(assigner) {
}
object = Object(object);
while (++index < length) {
var source = sources[index];
const source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}

View File

@@ -7,13 +7,14 @@
*/
function createBaseFor(fromRight) {
return (object, iteratee, keysFunc) => {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
const iterable = Object(object);
const props = keysFunc(object);
let index = -1;
let length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
const key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}

View File

@@ -2,7 +2,7 @@ import createCtor from './_createCtor.js';
import root from './_root.js';
/** 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`
@@ -15,11 +15,11 @@ var WRAP_BIND_FLAG = 1;
* @returns {Function} Returns the new wrapped function.
*/
function createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG,
Ctor = createCtor(func);
const isBind = bitmask & WRAP_BIND_FLAG;
const Ctor = createCtor(func);
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 wrapper;

View File

@@ -14,7 +14,7 @@ function createCtor(Ctor) {
// 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
// for more details.
var args = arguments;
const args = arguments;
switch (args.length) {
case 0: return new Ctor;
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 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
var thisBinding = baseCreate(Ctor.prototype),
result = Ctor.apply(thisBinding, args);
const thisBinding = baseCreate(Ctor.prototype);
const result = Ctor.apply(thisBinding, args);
// Mimic the constructor's `return` behavior.
// See https://es5.github.io/#x13.2.2 for more details.

View File

@@ -16,18 +16,19 @@ import root from './_root.js';
* @returns {Function} Returns the new wrapped function.
*/
function createCurry(func, bitmask, arity) {
var Ctor = createCtor(func);
const Ctor = createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length,
placeholder = getHolder(wrapper);
let length = arguments.length;
let index = length;
const args = Array(length);
const placeholder = getHolder(wrapper);
while (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);
@@ -37,7 +38,7 @@ function createCurry(func, bitmask, arity) {
func, bitmask, createHybrid, wrapper.placeholder, undefined,
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 wrapper;

View File

@@ -6,13 +6,13 @@ import isArray from './isArray.js';
import isLaziable from './_isLaziable.js';
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
const FUNC_ERROR_TEXT = 'Expected a function';
/** Used to compose bitmasks for function metadata. */
var WRAP_CURRY_FLAG = 8,
WRAP_PARTIAL_FLAG = 32,
WRAP_ARY_FLAG = 128,
WRAP_REARG_FLAG = 256;
const WRAP_CURRY_FLAG = 8;
const WRAP_PARTIAL_FLAG = 32;
const WRAP_ARY_FLAG = 128;
const WRAP_REARG_FLAG = 256;
/**
* Creates a `_.flow` or `_.flowRight` function.
@@ -23,9 +23,9 @@ var WRAP_CURRY_FLAG = 8,
*/
function createFlow(fromRight) {
return flatRest(funcs => {
var length = funcs.length,
index = length,
prereq = LodashWrapper.prototype.thru;
const length = funcs.length;
const prereq = LodashWrapper.prototype.thru;
let index = length;
if (fromRight) {
funcs.reverse();
@@ -43,12 +43,12 @@ function createFlow(fromRight) {
while (++index < length) {
func = funcs[index];
var funcName = getFuncName(func),
data = funcName == 'wrapper' ? getData(func) : undefined;
const funcName = getFuncName(func);
const data = funcName == 'wrapper' ? getData(func) : undefined;
if (data && isLaziable(data[0]) &&
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]);
} else {
@@ -58,14 +58,13 @@ function createFlow(fromRight) {
}
}
return function() {
var args = arguments,
value = args[0];
const args = arguments;
const value = args[0];
if (wrapper && args.length == 1 && isArray(value)) {
return wrapper.plant(value).value();
}
var index = 0,
result = length ? funcs[index].apply(this, args) : value;
let index = 0, result = length ? funcs[index].apply(this, args) : value;
while (++index < length) {
result = funcs[index].call(this, result);

View File

@@ -9,12 +9,12 @@ import replaceHolders from './_replaceHolders.js';
import root from './_root.js';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_CURRY_FLAG = 8,
WRAP_CURRY_RIGHT_FLAG = 16,
WRAP_ARY_FLAG = 128,
WRAP_FLIP_FLAG = 512;
const WRAP_BIND_FLAG = 1;
const WRAP_BIND_KEY_FLAG = 2;
const WRAP_CURRY_FLAG = 8;
const WRAP_CURRY_RIGHT_FLAG = 16;
const WRAP_ARY_FLAG = 128;
const WRAP_FLIP_FLAG = 512;
/**
* 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.
*/
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & WRAP_ARY_FLAG,
isBind = bitmask & WRAP_BIND_FLAG,
isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
isFlip = bitmask & WRAP_FLIP_FLAG,
Ctor = isBindKey ? undefined : createCtor(func);
const isAry = bitmask & WRAP_ARY_FLAG;
const isBind = bitmask & WRAP_BIND_FLAG;
const isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
const isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
const isFlip = bitmask & WRAP_FLIP_FLAG;
const Ctor = isBindKey ? undefined : createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length;
let holderCount;
let placeholder;
let length = arguments.length;
let args = Array(length);
let index = length;
while (index--) {
args[index] = arguments[index];
}
if (isCurried) {
var placeholder = getHolder(wrapper),
holdersCount = countHolders(args, placeholder);
placeholder = getHolder(wrapper);
holdersCount = countHolders(args, placeholder);
}
if (partials) {
args = composeArgs(args, partials, holders, isCurried);
@@ -63,14 +65,14 @@ function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight,
}
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
const newHolders = replaceHolders(args, placeholder);
return createRecurry(
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
args, newHolders, argPos, ary, arity - length
);
}
var thisBinding = isBind ? thisArg : this,
fn = isBindKey ? thisBinding[func] : func;
const thisBinding = isBind ? thisArg : this;
let fn = isBindKey ? thisBinding[func] : func;
length = args.length;
if (argPos) {

View File

@@ -3,7 +3,7 @@ import createCtor from './_createCtor.js';
import root from './_root.js';
/** 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
@@ -18,16 +18,17 @@ var WRAP_BIND_FLAG = 1;
* @returns {Function} Returns the new wrapped function.
*/
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & WRAP_BIND_FLAG,
Ctor = createCtor(func);
const isBind = bitmask & WRAP_BIND_FLAG;
const Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1,
argsLength = arguments.length,
leftIndex = -1,
leftLength = partials.length,
args = Array(leftLength + argsLength),
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
let argsIndex = -1;
let argsLength = arguments.length;
let leftIndex = -1;
const leftLength = partials.length;
const args = Array(leftLength + argsLength);
const fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];

View File

@@ -3,12 +3,12 @@ import setData from './_setData.js';
import setWrapToString from './_setWrapToString.js';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_CURRY_BOUND_FLAG = 4,
WRAP_CURRY_FLAG = 8,
WRAP_PARTIAL_FLAG = 32,
WRAP_PARTIAL_RIGHT_FLAG = 64;
const WRAP_BIND_FLAG = 1;
const WRAP_BIND_KEY_FLAG = 2;
const WRAP_CURRY_BOUND_FLAG = 4;
const WRAP_CURRY_FLAG = 8;
const WRAP_PARTIAL_FLAG = 32;
const WRAP_PARTIAL_RIGHT_FLAG = 64;
/**
* 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.
*/
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
var isCurry = bitmask & WRAP_CURRY_FLAG,
newHolders = isCurry ? holders : undefined,
newHoldersRight = isCurry ? undefined : holders,
newPartials = isCurry ? partials : undefined,
newPartialsRight = isCurry ? undefined : partials;
const isCurry = bitmask & WRAP_CURRY_FLAG;
const newHolders = isCurry ? holders : undefined;
const newHoldersRight = isCurry ? undefined : holders;
const newPartials = isCurry ? partials : undefined;
const newPartialsRight = isCurry ? undefined : partials;
bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_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)) {
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
}
var newData = [
const newData = [
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
newHoldersRight, argPos, ary, arity
];
var result = wrapFunc(...newData);
const result = wrapFunc(...newData);
if (isLaziable(func)) {
setData(result, newData);
}

View File

@@ -3,7 +3,7 @@ import toNumber from './toNumber.js';
import toString from './toString.js';
/* 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`.
@@ -13,15 +13,15 @@ var nativeMin = Math.min;
* @returns {Function} Returns the new round function.
*/
function createRound(methodName) {
var func = Math[methodName];
const func = Math[methodName];
return (number, precision) => {
number = toNumber(number);
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
if (precision) {
// Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details.
var pair = `${ toString(number) }e`.split('e'),
value = func(`${ pair[0] }e${ +pair[1] + precision }`);
let pair = `${ toString(number) }e`.split('e');
const value = func(`${ pair[0] }e${ +pair[1] + precision }`);
pair = `${ toString(value) }e`.split('e');
return +`${ pair[0] }e${ +pair[1] - precision }`;

View File

@@ -4,8 +4,8 @@ import mapToArray from './_mapToArray.js';
import setToPairs from './_setToPairs.js';
/** `Object#toString` result references. */
var mapTag = '[object Map]',
setTag = '[object Set]';
const mapTag = '[object Map]';
const setTag = '[object Set]';
/**
* Creates a `_.toPairs` or `_.toPairsIn` function.
@@ -16,7 +16,7 @@ var mapTag = '[object Map]',
*/
function createToPairs(keysFunc) {
return object => {
var tag = getTag(object);
const tag = getTag(object);
if (tag == mapTag) {
return mapToArray(object);
}

View File

@@ -10,18 +10,18 @@ import setWrapToString from './_setWrapToString.js';
import toInteger from './toInteger.js';
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
const FUNC_ERROR_TEXT = 'Expected a function';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_CURRY_FLAG = 8,
WRAP_CURRY_RIGHT_FLAG = 16,
WRAP_PARTIAL_FLAG = 32,
WRAP_PARTIAL_RIGHT_FLAG = 64;
const WRAP_BIND_FLAG = 1;
const WRAP_BIND_KEY_FLAG = 2;
const WRAP_CURRY_FLAG = 8;
const WRAP_CURRY_RIGHT_FLAG = 16;
const WRAP_PARTIAL_FLAG = 32;
const WRAP_PARTIAL_RIGHT_FLAG = 64;
/* 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
@@ -49,11 +49,11 @@ var nativeMax = Math.max;
* @returns {Function} Returns the new wrapped function.
*/
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') {
throw new TypeError(FUNC_ERROR_TEXT);
}
var length = partials ? partials.length : 0;
let length = partials ? partials.length : 0;
if (!length) {
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
partials = holders = undefined;
@@ -68,9 +68,9 @@ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arit
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,
argPos, ary, arity
];
@@ -99,7 +99,7 @@ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arit
} else {
result = createHybrid(...newData);
}
var setter = data ? baseSetData : setData;
const setter = data ? baseSetData : setData;
return setWrapToString(setter(result, newData), func, bitmask);
}

View File

@@ -3,8 +3,8 @@ import arraySome from './_arraySome.js';
import cacheHas from './_cacheHas.js';
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
const COMPARE_PARTIAL_FLAG = 1;
const COMPARE_UNORDERED_FLAG = 2;
/**
* 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`.
*/
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
arrLength = array.length,
othLength = other.length;
const isPartial = bitmask & COMPARE_PARTIAL_FLAG;
const arrLength = array.length;
const othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
const stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
let index = -1;
let result = true;
const seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
const arrValue = array[index], othValue = other[index];
if (customizer) {
var compared = isPartial

View File

@@ -6,26 +6,26 @@ import mapToArray from './_mapToArray.js';
import setToArray from './_setToArray.js';
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
const COMPARE_PARTIAL_FLAG = 1;
const COMPARE_UNORDERED_FLAG = 2;
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
mapTag = '[object Map]',
numberTag = '[object Number]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]';
const boolTag = '[object Boolean]';
const dateTag = '[object Date]';
const errorTag = '[object Error]';
const mapTag = '[object Map]';
const numberTag = '[object Number]';
const regexpTag = '[object RegExp]';
const setTag = '[object Set]';
const stringTag = '[object String]';
const symbolTag = '[object Symbol]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]';
const arrayBufferTag = '[object ArrayBuffer]';
const dataViewTag = '[object DataView]';
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
const symbolProto = Symbol ? Symbol.prototype : undefined;
const symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* 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 }`;
case mapTag:
var convert = mapToArray;
let convert = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
const isPartial = bitmask & COMPARE_PARTIAL_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
const stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
@@ -97,7 +97,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
// Recursively compare objects (susceptible to call stack limits).
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);
return result;

View File

@@ -1,13 +1,13 @@
import getAllKeys from './_getAllKeys.js';
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1;
const COMPARE_PARTIAL_FLAG = 1;
/** Used for built-in method references. */
var objectProto = Object.prototype;
const objectProto = Object.prototype;
/** 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
@@ -23,39 +23,41 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
objProps = getAllKeys(object),
objLength = objProps.length,
othProps = getAllKeys(other),
othLength = othProps.length;
const isPartial = bitmask & COMPARE_PARTIAL_FLAG;
const objProps = getAllKeys(object);
const objLength = objProps.length;
const othProps = getAllKeys(other);
const othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
let key;
let index = objLength;
while (index--) {
var key = objProps[index];
key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
const stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
let result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
let compared;
let skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
const objValue = object[key];
const othValue = other[key];
if (customizer) {
var compared = isPartial
compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
@@ -70,8 +72,8 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
const objCtor = object.constructor;
const othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&

View File

@@ -1,10 +1,10 @@
import realNames from './_realNames.js';
/** Used for built-in method references. */
var objectProto = Object.prototype;
const objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
const hasOwnProperty = objectProto.hasOwnProperty;
/**
* Gets the name of `func`.
@@ -14,13 +14,13 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @returns {string} Returns the function name.
*/
function getFuncName(func) {
var result = `${ func.name }`,
array = realNames[result],
length = hasOwnProperty.call(realNames, result) ? array.length : 0;
const result = `${ func.name }`;
const array = realNames[result];
let length = hasOwnProperty.call(realNames, result) ? array.length : 0;
while (length--) {
var data = array[length],
otherFunc = data.func;
const data = array[length];
const otherFunc = data.func;
if (otherFunc == null || otherFunc == func) {
return data.name;
}

View File

@@ -9,13 +9,12 @@ import keys from './keys.js';
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = keys(object),
length = result.length;
const result = keys(object);
let length = result.length;
while (length--) {
var key = result[length],
value = object[key];
const key = result[length];
const value = object[key];
result[length] = [key, value, isStrictComparable(value)];
}
return result;

View File

@@ -1,20 +1,20 @@
import Symbol from './_Symbol.js';
/** Used for built-in method references. */
var objectProto = Object.prototype;
const objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
const hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
const nativeObjectToString = objectProto.toString;
/** 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.
@@ -24,15 +24,15 @@ var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
const isOwn = hasOwnProperty.call(value, symToStringTag);
const tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
const result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;

View File

@@ -7,20 +7,19 @@ import baseGetTag from './_baseGetTag.js';
import toSource from './_toSource.js';
/** `Object#toString` result references. */
var mapTag = '[object Map]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
setTag = '[object Set]',
weakMapTag = '[object WeakMap]';
var dataViewTag = '[object DataView]';
const dataViewTag = '[object DataView]';
const mapTag = '[object Map]';
const objectTag = '[object Object]';
const promiseTag = '[object Promise]';
const setTag = '[object Set]';
const weakMapTag = '[object WeakMap]';
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
const dataViewCtorString = toSource(DataView);
const mapCtorString = toSource(Map);
const promiseCtorString = toSource(Promise);
const setCtorString = toSource(Set);
const weakMapCtorString = toSource(WeakMap);
/**
* Gets the `toStringTag` of `value`.
@@ -29,7 +28,7 @@ var dataViewCtorString = toSource(DataView),
* @param {*} value The value to query.
* @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.
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) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = value => {
var result = baseGetTag(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : '';
const result = baseGetTag(value);
const Ctor = result == objectTag ? value.constructor : undefined;
const ctorString = Ctor ? toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {

View File

@@ -1,6 +1,6 @@
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max,
nativeMin = Math.min;
const nativeMax = Math.max;
const nativeMin = Math.min;
/**
* Gets the view, applying any `transforms` to the `start` and `end` positions.
@@ -13,12 +13,12 @@ var nativeMax = Math.max,
* positions of the view.
*/
function getView(start, end, transforms) {
var index = -1,
length = transforms.length;
let index = -1;
const length = transforms.length;
while (++index < length) {
var data = transforms[index],
size = data.size;
const data = transforms[index];
const size = data.size;
switch (data.type) {
case 'drop': start += size; break;

View File

@@ -1,6 +1,6 @@
/** Used to match wrap detail comments. */
var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
reSplitDetails = /,? & /;
const reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
const reSplitDetails = /,? & /;
/**
* Extracts wrapper details from the `source` body comment.
@@ -10,7 +10,7 @@ var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
* @returns {Array} Returns the wrapper details.
*/
function getWrapDetails(source) {
var match = source.match(reWrapDetails);
const match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
}

View File

@@ -1,5 +1,5 @@
/** 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.

View File

@@ -1,8 +1,8 @@
/** Used for built-in method references. */
var objectProto = Object.prototype;
const objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
const hasOwnProperty = objectProto.hasOwnProperty;
/**
* Initializes an array clone.
@@ -12,8 +12,8 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
var length = array.length,
result = array.constructor(length);
const length = array.length;
const result = array.constructor(length);
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {

View File

@@ -3,7 +3,7 @@ import isArguments from './isArguments.js';
import isArray from './isArray.js';
/** 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.

View File

@@ -1,8 +1,8 @@
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
const MAX_SAFE_INTEGER = 9007199254740991;
/** 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.

View File

@@ -17,7 +17,7 @@ function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
const type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)

View File

@@ -2,8 +2,8 @@ import isArray from './isArray.js';
import isSymbol from './isSymbol.js';
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/;
const reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
const reIsPlainProp = /^\w*$/;
/**
* Checks if `value` is a property name and not a property path.
@@ -17,7 +17,7 @@ function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
const type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;

View File

@@ -6,7 +6,7 @@
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
const type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);

View File

@@ -9,6 +9,6 @@ import stubFalse from './stubFalse.js';
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
*/
var isMaskable = coreJsData ? isFunction : stubFalse;
const isMaskable = coreJsData ? isFunction : stubFalse;
export default isMaskable;

View File

@@ -1,7 +1,7 @@
import coreJsData from './_coreJsData.js';
/** Used to detect methods masquerading as native. */
var maskSrcKey = ((() => {
const maskSrcKey = ((() => {
const uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? `Symbol(src)_1.${ uid }` : '';
})());

View File

@@ -1,5 +1,5 @@
/** Used for built-in method references. */
var objectProto = Object.prototype;
const objectProto = Object.prototype;
/**
* 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`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
const Ctor = value && value.constructor;
const proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}

View File

@@ -6,8 +6,8 @@
* @returns {Array} Returns the converted array.
*/
function iteratorToArray(iterator) {
var data,
result = [];
let data;
const result = [];
while (!(data = iterator.next()).done) {
result.push(data.value);

View File

@@ -10,7 +10,7 @@ import getMapData from './_getMapData.js';
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = getMapData(this, key)['delete'](key);
const result = getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}

View File

@@ -11,8 +11,8 @@ import getMapData from './_getMapData.js';
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = getMapData(this, key),
size = data.size;
const data = getMapData(this, key);
const size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;

View File

@@ -1,4 +1,4 @@
/** Used to match template delimiters. */
var reEscape = /<%-([\s\S]+?)%>/g;
const reEscape = /<%-([\s\S]+?)%>/g;
export default reEscape;

View File

@@ -1,4 +1,4 @@
/** Used to match template delimiters. */
var reEvaluate = /<%([\s\S]+?)%>/g;
const reEvaluate = /<%([\s\S]+?)%>/g;
export default reEvaluate;

View File

@@ -1,4 +1,4 @@
/** Used to match template delimiters. */
var reInterpolate = /<%=([\s\S]+?)%>/g;
const reInterpolate = /<%=([\s\S]+?)%>/g;
export default reInterpolate;

View File

@@ -1,4 +1,4 @@
/** Used to lookup unminified function names. */
var realNames = {};
const realNames = {};
export default realNames;

View File

@@ -15,6 +15,6 @@ import shortOut from './_shortOut.js';
* @param {*} data The metadata.
* @returns {Function} Returns `func`.
*/
var setData = shortOut(baseSetData);
const setData = shortOut(baseSetData);
export default setData;

View File

@@ -6,8 +6,8 @@
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
let index = -1;
const result = Array(set.size);
set.forEach(value => {
result[++index] = value;

View File

@@ -9,6 +9,6 @@ import shortOut from './_shortOut.js';
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var setToString = shortOut(baseSetToString);
const setToString = shortOut(baseSetToString);
export default setToString;

View File

@@ -9,14 +9,14 @@ import baseRandom from './_baseRandom.js';
* @returns {Array} Returns `array`.
*/
function shuffleSelf(array, size) {
var index = -1,
length = array.length,
lastIndex = length - 1;
let index = -1;
const length = array.length;
const lastIndex = length - 1;
size = size === undefined ? length : size;
while (++index < size) {
var rand = baseRandom(index, lastIndex),
value = array[rand];
const rand = baseRandom(index, lastIndex);
const value = array[rand];
array[rand] = array[index];
array[index] = value;

View File

@@ -39,7 +39,7 @@ import negate from './negate.js';
* // => objects for ['barney']
*/
function reject(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
const func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, negate(baseIteratee(predicate, 3)));
}

View File

@@ -2,7 +2,7 @@ import baseRest from './_baseRest.js';
import toInteger from './toInteger.js';
/** 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

View File

@@ -34,8 +34,8 @@ import toKey from './_toKey.js';
function result(object, path, defaultValue) {
path = castPath(path, object);
var index = -1,
length = path.length;
let index = -1;
let length = path.length;
// Ensure the loop is entered when path is empty.
if (!length) {
@@ -43,7 +43,7 @@ function result(object, path, defaultValue) {
object = undefined;
}
while (++index < length) {
var value = object == null ? undefined : object[toKey(path[index])];
let value = object == null ? undefined : object[toKey(path[index])];
if (value === undefined) {
index = length;
value = defaultValue;

View File

@@ -1,8 +1,8 @@
/** 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. */
var nativeReverse = arrayProto.reverse;
const nativeReverse = arrayProto.reverse;
/**
* Reverses `array` so that the first element becomes the last, the second

View File

@@ -21,6 +21,6 @@ import createRound from './_createRound.js';
* _.round(4060, -2);
* // => 4100
*/
var round = createRound('round');
const round = createRound('round');
export default round;

View File

@@ -17,7 +17,7 @@ import isArray from './isArray.js';
* // => 2
*/
function sample(collection) {
var func = isArray(collection) ? arraySample : baseSample;
const func = isArray(collection) ? arraySample : baseSample;
return func(collection);
}

View File

@@ -30,7 +30,7 @@ function sampleSize(collection, n, guard) {
} else {
n = toInteger(n);
}
var func = isArray(collection) ? arraySampleSize : baseSampleSize;
const func = isArray(collection) ? arraySampleSize : baseSampleSize;
return func(collection, n);
}

View File

@@ -18,7 +18,7 @@ import isArray from './isArray.js';
* // => [4, 1, 3, 2]
*/
function shuffle(collection) {
var func = isArray(collection) ? arrayShuffle : baseShuffle;
const func = isArray(collection) ? arrayShuffle : baseShuffle;
return func(collection);
}

View File

@@ -5,8 +5,8 @@ import isString from './isString.js';
import stringSize from './_stringSize.js';
/** `Object#toString` result references. */
var mapTag = '[object Map]',
setTag = '[object Set]';
const mapTag = '[object Map]';
const setTag = '[object Set]';
/**
* Gets the size of `collection` by returning its length for array-like
@@ -36,7 +36,7 @@ function size(collection) {
if (isArrayLike(collection)) {
return isString(collection) ? stringSize(collection) : collection.length;
}
var tag = getTag(collection);
const tag = getTag(collection);
if (tag == mapTag || tag == setTag) {
return collection.size;
}

View File

@@ -19,7 +19,7 @@ import toInteger from './toInteger.js';
* @returns {Array} Returns the slice of `array`.
*/
function slice(array, start, end) {
var length = array == null ? 0 : array.length;
const length = array == null ? 0 : array.length;
if (!length) {
return [];
}

View File

@@ -41,7 +41,7 @@ import isIterateeCall from './_isIterateeCall.js';
* // => true
*/
function some(collection, predicate, guard) {
var func = isArray(collection) ? arraySome : baseSome;
const func = isArray(collection) ? arraySome : baseSome;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined;
}

View File

@@ -18,9 +18,9 @@ import eq from './eq.js';
* // => 1
*/
function sortedIndexOf(array, value) {
var length = array == null ? 0 : array.length;
const length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value);
const index = baseSortedIndex(array, value);
if (index < length && eq(array[index], value)) {
return index;
}

View File

@@ -18,9 +18,9 @@ import eq from './eq.js';
* // => 3
*/
function sortedLastIndexOf(array, value) {
var length = array == null ? 0 : array.length;
const length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value, true) - 1;
const index = baseSortedIndex(array, value, true) - 1;
if (eq(array[index], value)) {
return index;
}

View File

@@ -7,7 +7,7 @@ import stringToArray from './_stringToArray.js';
import toString from './toString.js';
/** 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`.

View File

@@ -5,10 +5,10 @@ import castSlice from './_castSlice.js';
import toInteger from './toInteger.js';
/** 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. */
var nativeMax = Math.max;
const nativeMax = Math.max;
/**
* 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);
return baseRest(function(args) {
var array = args[start],
otherArgs = castSlice(args, 0, start);
const array = args[start];
const otherArgs = castSlice(args, 0, start);
if (array) {
arrayPush(otherArgs, array);

View File

@@ -22,6 +22,6 @@ import upperFirst from './upperFirst.js';
* _.startCase('__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;

View File

@@ -15,6 +15,6 @@ import createMathOperation from './_createMathOperation.js';
* _.subtract(6, 4);
* // => 2
*/
var subtract = createMathOperation((minuend, subtrahend) => minuend - subtrahend, 0);
const subtract = createMathOperation((minuend, subtrahend) => minuend - subtrahend, 0);
export default subtract;

View File

@@ -15,7 +15,7 @@ import baseSlice from './_baseSlice.js';
* // => [2, 3]
*/
function tail(array) {
var length = array == null ? 0 : array.length;
const length = array == null ? 0 : array.length;
return length ? baseSlice(array, 1, length) : [];
}

View File

@@ -27,7 +27,7 @@ import toInteger from './toInteger.js';
* // => []
*/
function takeRight(array, n, guard) {
var length = array == null ? 0 : array.length;
const length = array == null ? 0 : array.length;
if (!length) {
return [];
}

View File

@@ -11,21 +11,21 @@ import templateSettings from './templateSettings.js';
import toString from './toString.js';
/** Used to match empty string literals in compiled template source. */
var reEmptyStringLeading = /\b__p \+= '';/g,
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
const reEmptyStringLeading = /\b__p \+= '';/g;
const reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
const reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
/**
* Used to match
* [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. */
var reNoMatch = /($^)/;
const reNoMatch = /($^)/;
/** 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
@@ -135,7 +135,7 @@ function template(string, options, guard) {
// Based on John Resig's `tmpl` implementation
// (http://ejohn.org/blog/javascript-micro-templating/)
// 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)) {
options = undefined;
@@ -143,18 +143,19 @@ function template(string, options, guard) {
string = toString(string);
options = assignInWith({}, options, settings, customDefaultsAssignIn);
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
importsKeys = keys(imports),
importsValues = baseValues(imports, importsKeys);
const imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn);
const importsKeys = keys(imports);
const importsValues = baseValues(imports, importsKeys);
var isEscaping,
isEvaluating,
index = 0,
interpolate = options.interpolate || reNoMatch,
source = "__p += '";
let isEscaping;
let isEvaluating;
let index = 0;
const interpolate = options.interpolate || reNoMatch;
let source = "__p += '";
// Compile the regexp to match each delimiter.
var reDelimiters = RegExp(
const reDelimiters = RegExp(
(options.escape || reNoMatch).source + '|' +
interpolate.source + '|' +
(interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
@@ -162,7 +163,7 @@ function template(string, options, guard) {
, 'g');
// 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, (
match,
@@ -200,7 +201,7 @@ function template(string, options, guard) {
// 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.
var variable = options.variable;
const variable = options.variable;
if (!variable) {
source = `with (obj) {\n${ source }\n}\n`;
}
@@ -228,7 +229,7 @@ function template(string, options, guard) {
source +
'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
// the `source` property as a convenience for inlining compiled templates.

View File

@@ -12,7 +12,7 @@ import reInterpolate from './_reInterpolate.js';
* @memberOf _
* @type {Object}
*/
var templateSettings = {
const templateSettings = {
/**
* Used to detect `data` property values to be HTML-escaped.

View File

@@ -2,7 +2,7 @@ import debounce from './debounce.js';
import isObject from './isObject.js';
/** 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
@@ -49,8 +49,8 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* jQuery(window).on('popstate', throttled.cancel);
*/
function throttle(func, wait, options) {
var leading = true,
trailing = true;
let leading = true;
let trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);

View File

@@ -3,13 +3,13 @@ import castFunction from './_castFunction.js';
import toInteger from './toInteger.js';
/** 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. */
var MAX_ARRAY_LENGTH = 4294967295;
const MAX_ARRAY_LENGTH = 4294967295;
/* 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
@@ -35,13 +35,13 @@ function times(n, iteratee) {
if (n < 1 || n > MAX_SAFE_INTEGER) {
return [];
}
var index = MAX_ARRAY_LENGTH,
length = nativeMin(n, MAX_ARRAY_LENGTH);
let index = MAX_ARRAY_LENGTH;
const length = nativeMin(n, MAX_ARRAY_LENGTH);
iteratee = castFunction(iteratee);
n -= MAX_ARRAY_LENGTH;
var result = baseTimes(length, iteratee);
const result = baseTimes(length, iteratee);
while (++index < n) {
iteratee(index);
}

View File

@@ -10,11 +10,11 @@ import stringToArray from './_stringToArray.js';
import values from './values.js';
/** `Object#toString` result references. */
var mapTag = '[object Map]',
setTag = '[object Set]';
const mapTag = '[object Map]';
const setTag = '[object Set]';
/** Built-in value references. */
var symIterator = Symbol ? Symbol.iterator : undefined;
const symIterator = Symbol ? Symbol.iterator : undefined;
/**
* Converts `value` to an array.
@@ -49,8 +49,8 @@ function toArray(value) {
if (symIterator && value[symIterator]) {
return iteratorToArray(value[symIterator]());
}
var tag = getTag(value),
func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
const tag = getTag(value);
const func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
return func(value);
}

View File

@@ -1,8 +1,8 @@
import toNumber from './toNumber.js';
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0,
MAX_INTEGER = 1.7976931348623157e+308;
const INFINITY = 1 / 0;
const MAX_INTEGER = 1.7976931348623157e+308;
/**
* Converts `value` to a finite number.
@@ -33,7 +33,7 @@ function toFinite(value) {
}
value = toNumber(value);
if (value === INFINITY || value === -INFINITY) {
var sign = (value < 0 ? -1 : 1);
const sign = (value < 0 ? -1 : 1);
return sign * MAX_INTEGER;
}
return value === value ? value : 0;

View File

@@ -27,8 +27,8 @@ import toFinite from './toFinite.js';
* // => 3
*/
function toInteger(value) {
var result = toFinite(value),
remainder = result % 1;
const result = toFinite(value);
const remainder = result % 1;
return result === result ? (remainder ? result - remainder : result) : 0;
}

View File

@@ -2,7 +2,7 @@ import baseClamp from './_baseClamp.js';
import toInteger from './toInteger.js';
/** 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

View File

@@ -2,22 +2,22 @@ import isObject from './isObject.js';
import isSymbol from './isSymbol.js';
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
const NAN = 0 / 0;
/** 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. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
const reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
const reIsBinary = /^0b[01]+$/i;
/** 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`. */
var freeParseInt = parseInt;
const freeParseInt = parseInt;
/**
* Converts `value` to a number.
@@ -50,14 +50,14 @@ function toNumber(value) {
return NAN;
}
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;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value);
const isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex.test(value) ? NAN : +value);

Some files were not shown because too many files have changed in this diff Show More