diff --git a/_DataView.js b/_DataView.js index 1bbaaa190..a87db7d07 100644 --- a/_DataView.js +++ b/_DataView.js @@ -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 DataView = getNative(root, 'DataView'); +const DataView = getNative(root, 'DataView'); export default DataView; diff --git a/_Hash.js b/_Hash.js index 8ecacb008..db6e0142f 100644 --- a/_Hash.js +++ b/_Hash.js @@ -12,12 +12,12 @@ import hashSet from './_hashSet.js'; * @param {Array} [entries] The key-value pairs to cache. */ function Hash(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]); } } diff --git a/_arrayAggregator.js b/_arrayAggregator.js index d45187929..eb0f3edf8 100644 --- a/_arrayAggregator.js +++ b/_arrayAggregator.js @@ -9,11 +9,11 @@ * @returns {Function} Returns `accumulator`. */ function arrayAggregator(array, setter, iteratee, accumulator) { - var index = -1, - length = array == null ? 0 : array.length; + let index = -1; + const length = array == null ? 0 : array.length; while (++index < length) { - var value = array[index]; + const value = array[index]; setter(accumulator, value, iteratee(value), array); } return accumulator; diff --git a/_arrayEach.js b/_arrayEach.js index 2a570bf7f..0158205ee 100644 --- a/_arrayEach.js +++ b/_arrayEach.js @@ -8,8 +8,8 @@ * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length; + let index = -1; + const length = array == null ? 0 : array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { diff --git a/_arrayEachRight.js b/_arrayEachRight.js index ce87d1acc..713406c15 100644 --- a/_arrayEachRight.js +++ b/_arrayEachRight.js @@ -8,7 +8,7 @@ * @returns {Array} Returns `array`. */ function arrayEachRight(array, iteratee) { - var length = array == null ? 0 : array.length; + let length = array == null ? 0 : array.length; while (length--) { if (iteratee(array[length], length, array) === false) { diff --git a/_arrayEvery.js b/_arrayEvery.js index 93f30a9bc..a24e76600 100644 --- a/_arrayEvery.js +++ b/_arrayEvery.js @@ -9,8 +9,8 @@ * else `false`. */ function arrayEvery(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; + let index = -1; + const length = array == null ? 0 : array.length; while (++index < length) { if (!predicate(array[index], index, array)) { diff --git a/_arrayFilter.js b/_arrayFilter.js index 20d376994..84b6e7e28 100644 --- a/_arrayFilter.js +++ b/_arrayFilter.js @@ -8,13 +8,13 @@ * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length, - resIndex = 0, - result = []; + let index = -1; + let resIndex = 0; + const length = array == null ? 0 : array.length; + const result = []; while (++index < length) { - var value = array[index]; + const value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } diff --git a/_arrayIncludes.js b/_arrayIncludes.js index d515af900..894511a6a 100644 --- a/_arrayIncludes.js +++ b/_arrayIncludes.js @@ -10,7 +10,7 @@ import baseIndexOf from './_baseIndexOf.js'; * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludes(array, value) { - var length = array == null ? 0 : array.length; + const length = array == null ? 0 : array.length; return !!length && baseIndexOf(array, value, 0) > -1; } diff --git a/_arrayIncludesWith.js b/_arrayIncludesWith.js index 9dedaa253..2fb367414 100644 --- a/_arrayIncludesWith.js +++ b/_arrayIncludesWith.js @@ -8,8 +8,8 @@ * @returns {boolean} Returns `true` if `target` is found, else `false`. */ function arrayIncludesWith(array, value, comparator) { - var index = -1, - length = array == null ? 0 : array.length; + let index = -1; + const length = array == null ? 0 : array.length; while (++index < length) { if (comparator(value, array[index])) { diff --git a/_arrayMap.js b/_arrayMap.js index 8d32a4e65..811f9dbb3 100644 --- a/_arrayMap.js +++ b/_arrayMap.js @@ -8,9 +8,9 @@ * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length, - result = Array(length); + let index = -1; + const length = array == null ? 0 : array.length; + const result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); diff --git a/_arrayPush.js b/_arrayPush.js index 3660a7dbc..fec702a09 100644 --- a/_arrayPush.js +++ b/_arrayPush.js @@ -7,9 +7,9 @@ * @returns {Array} Returns `array`. */ function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; + let index = -1; + const length = values.length; + const offset = array.length; while (++index < length) { array[offset + index] = values[index]; diff --git a/_arrayReduce.js b/_arrayReduce.js index 58e1df310..15a961582 100644 --- a/_arrayReduce.js +++ b/_arrayReduce.js @@ -11,8 +11,8 @@ * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array == null ? 0 : array.length; + let index = -1; + const length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[++index]; diff --git a/_arrayReduceRight.js b/_arrayReduceRight.js index c185bebef..63d2ca542 100644 --- a/_arrayReduceRight.js +++ b/_arrayReduceRight.js @@ -11,7 +11,7 @@ * @returns {*} Returns the accumulated value. */ function arrayReduceRight(array, iteratee, accumulator, initAccum) { - var length = array == null ? 0 : array.length; + let length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[--length]; } diff --git a/_arraySample.js b/_arraySample.js index 008596fc9..d91b3a43d 100644 --- a/_arraySample.js +++ b/_arraySample.js @@ -8,7 +8,7 @@ import baseRandom from './_baseRandom.js'; * @returns {*} Returns the random element. */ function arraySample(array) { - var length = array.length; + const length = array.length; return length ? array[baseRandom(0, length - 1)] : undefined; } diff --git a/_arraySome.js b/_arraySome.js index d66f4c320..afffba804 100644 --- a/_arraySome.js +++ b/_arraySome.js @@ -9,8 +9,8 @@ * else `false`. */ function arraySome(array, predicate) { - var index = -1, - length = array == null ? 0 : array.length; + let index = -1; + const length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { diff --git a/_asciiSize.js b/_asciiSize.js index bbf4df436..76f861afa 100644 --- a/_asciiSize.js +++ b/_asciiSize.js @@ -7,6 +7,6 @@ import baseProperty from './_baseProperty.js'; * @param {string} string The string inspect. * @returns {number} Returns the string size. */ -var asciiSize = baseProperty('length'); +const asciiSize = baseProperty('length'); export default asciiSize; diff --git a/_asciiWords.js b/_asciiWords.js index 7840636ba..479f537b6 100644 --- a/_asciiWords.js +++ b/_asciiWords.js @@ -1,5 +1,5 @@ /** Used to match words composed of alphanumeric characters. */ -var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; +const reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; /** * Splits an ASCII `string` into an array of its words. diff --git a/_assignValue.js b/_assignValue.js index c858e92e0..8ec98a086 100644 --- a/_assignValue.js +++ b/_assignValue.js @@ -2,10 +2,10 @@ import baseAssignValue from './_baseAssignValue.js'; import eq from './eq.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; /** * Assigns `value` to `key` of `object` if the existing value is not equivalent @@ -18,7 +18,7 @@ var hasOwnProperty = objectProto.hasOwnProperty; * @param {*} value The value to assign. */ function assignValue(object, key, value) { - var objValue = object[key]; + const objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); diff --git a/_assocIndexOf.js b/_assocIndexOf.js index 88afb3979..ac0d5888b 100644 --- a/_assocIndexOf.js +++ b/_assocIndexOf.js @@ -9,7 +9,7 @@ import eq from './eq.js'; * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { - var length = array.length; + let length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; diff --git a/_baseAt.js b/_baseAt.js index 394738914..ce1e3f204 100644 --- a/_baseAt.js +++ b/_baseAt.js @@ -9,10 +9,10 @@ import get from './get.js'; * @returns {Array} Returns the picked elements. */ function baseAt(object, paths) { - var index = -1, - length = paths.length, - result = Array(length), - skip = object == null; + let index = -1; + const length = paths.length; + const result = Array(length); + const skip = object == null; while (++index < length) { result[index] = skip ? undefined : get(object, paths[index]); diff --git a/_baseConformsTo.js b/_baseConformsTo.js index 3406ec5df..c002b023b 100644 --- a/_baseConformsTo.js +++ b/_baseConformsTo.js @@ -7,15 +7,15 @@ * @returns {boolean} Returns `true` if `object` conforms, else `false`. */ function baseConformsTo(object, source, props) { - var length = props.length; + let length = props.length; if (object == null) { return !length; } object = Object(object); while (length--) { - var key = props[length], - predicate = source[key], - value = object[key]; + const key = props[length]; + const predicate = source[key]; + const value = object[key]; if ((value === undefined && !(key in object)) || !predicate(value)) { return false; diff --git a/_baseCreate.js b/_baseCreate.js index bb546324f..19b057a4f 100644 --- a/_baseCreate.js +++ b/_baseCreate.js @@ -21,7 +21,7 @@ const baseCreate = (() => { return objectCreate(proto); } object.prototype = proto; - var result = new object; + const result = new object; object.prototype = undefined; return result; }; diff --git a/_baseEach.js b/_baseEach.js index 038e9366d..1495f8376 100644 --- a/_baseEach.js +++ b/_baseEach.js @@ -9,6 +9,6 @@ import createBaseEach from './_createBaseEach.js'; * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ -var baseEach = createBaseEach(baseForOwn); +const baseEach = createBaseEach(baseForOwn); export default baseEach; diff --git a/_baseEachRight.js b/_baseEachRight.js index 0e4b053de..c722b0557 100644 --- a/_baseEachRight.js +++ b/_baseEachRight.js @@ -9,6 +9,6 @@ import createBaseEach from './_createBaseEach.js'; * @param {Function} iteratee The function invoked per iteration. * @returns {Array|Object} Returns `collection`. */ -var baseEachRight = createBaseEach(baseForOwnRight, true); +const baseEachRight = createBaseEach(baseForOwnRight, true); export default baseEachRight; diff --git a/_baseExtremum.js b/_baseExtremum.js index d154c6127..8929cacbf 100644 --- a/_baseExtremum.js +++ b/_baseExtremum.js @@ -11,12 +11,12 @@ import isSymbol from './isSymbol.js'; * @returns {*} Returns the extremum value. */ function baseExtremum(array, iteratee, comparator) { - var index = -1, - length = array.length; + let index = -1; + const length = array.length; while (++index < length) { - var value = array[index], - current = iteratee(value); + const value = array[index]; + const current = iteratee(value); if (current != null && (computed === undefined ? (current === current && !isSymbol(current)) diff --git a/_baseFill.js b/_baseFill.js index c7ef26e73..de407866d 100644 --- a/_baseFill.js +++ b/_baseFill.js @@ -12,7 +12,7 @@ import toLength from './toLength.js'; * @returns {Array} Returns `array`. */ function baseFill(array, value, start, end) { - var length = array.length; + const length = array.length; start = toInteger(start); if (start < 0) { diff --git a/_baseFindIndex.js b/_baseFindIndex.js index 860636ee5..26042d78e 100644 --- a/_baseFindIndex.js +++ b/_baseFindIndex.js @@ -10,8 +10,8 @@ * @returns {number} Returns the index of the matched value, else `-1`. */ function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); + const length = array.length; + let index = fromIndex + (fromRight ? 1 : -1); while ((fromRight ? index-- : ++index < length)) { if (predicate(array[index], index, array)) { diff --git a/_baseFlatten.js b/_baseFlatten.js index b42dee6b9..1330b6d4e 100644 --- a/_baseFlatten.js +++ b/_baseFlatten.js @@ -13,14 +13,14 @@ import isFlattenable from './_isFlattenable.js'; * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, depth, predicate, isStrict, result) { - var index = -1, - length = array.length; + let index = -1; + const length = array.length; predicate || (predicate = isFlattenable); result || (result = []); while (++index < length) { - var value = array[index]; + const value = array[index]; if (depth > 0 && predicate(value)) { if (depth > 1) { // Recursively flatten arrays (susceptible to call stack limits). diff --git a/_baseFor.js b/_baseFor.js index debbcf8cb..c8e080e01 100644 --- a/_baseFor.js +++ b/_baseFor.js @@ -11,6 +11,6 @@ import createBaseFor from './_createBaseFor.js'; * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ -var baseFor = createBaseFor(); +const baseFor = createBaseFor(); export default baseFor; diff --git a/_baseForRight.js b/_baseForRight.js index 85596da28..838f7f6c0 100644 --- a/_baseForRight.js +++ b/_baseForRight.js @@ -10,6 +10,6 @@ import createBaseFor from './_createBaseFor.js'; * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ -var baseForRight = createBaseFor(true); +const baseForRight = createBaseFor(true); export default baseForRight; diff --git a/_baseGet.js b/_baseGet.js index 16a2912ac..75e1ab06b 100644 --- a/_baseGet.js +++ b/_baseGet.js @@ -12,8 +12,8 @@ import toKey from './_toKey.js'; function baseGet(object, path) { path = castPath(path, object); - var index = 0, - length = path.length; + let index = 0; + const length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; diff --git a/_baseGetAllKeys.js b/_baseGetAllKeys.js index af5533b09..16d8f4a85 100644 --- a/_baseGetAllKeys.js +++ b/_baseGetAllKeys.js @@ -13,7 +13,7 @@ import isArray from './isArray.js'; * @returns {Array} Returns the array of property names and symbols. */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); + const result = keysFunc(object); return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } diff --git a/_baseGetTag.js b/_baseGetTag.js index 61b440a06..4dc4df2a7 100644 --- a/_baseGetTag.js +++ b/_baseGetTag.js @@ -3,11 +3,11 @@ import getRawTag from './_getRawTag.js'; import objectToString from './_objectToString.js'; /** `Object#toString` result references. */ -var nullTag = '[object Null]', - undefinedTag = '[object Undefined]'; +const nullTag = '[object Null]'; +const undefinedTag = '[object Undefined]'; /** Built-in value references. */ -var symToStringTag = Symbol ? Symbol.toStringTag : undefined; +const symToStringTag = Symbol ? Symbol.toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. diff --git a/_baseHas.js b/_baseHas.js index edbbe5feb..6838b7bcc 100644 --- a/_baseHas.js +++ b/_baseHas.js @@ -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; /** * The base implementation of `_.has` without support for deep paths. diff --git a/_baseInRange.js b/_baseInRange.js index 4b249a55b..1b11989bf 100644 --- a/_baseInRange.js +++ b/_baseInRange.js @@ -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; /** * The base implementation of `_.inRange` which doesn't coerce arguments. diff --git a/_baseIndexOfWith.js b/_baseIndexOfWith.js index 38831b26b..f1a2206d8 100644 --- a/_baseIndexOfWith.js +++ b/_baseIndexOfWith.js @@ -9,8 +9,8 @@ * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOfWith(array, value, fromIndex, comparator) { - var index = fromIndex - 1, - length = array.length; + let index = fromIndex - 1; + const length = array.length; while (++index < length) { if (comparator(array[index], value)) { diff --git a/_baseInvoke.js b/_baseInvoke.js index e465d8460..48a1c5bb4 100644 --- a/_baseInvoke.js +++ b/_baseInvoke.js @@ -17,7 +17,7 @@ import toKey from './_toKey.js'; function baseInvoke(object, path, args) { path = castPath(path, object); object = parent(object, path); - var func = object == null ? object : object[toKey(last(path))]; + const func = object == null ? object : object[toKey(last(path))]; return func == null ? undefined : apply(func, object, args); } diff --git a/_baseIsArguments.js b/_baseIsArguments.js index cbf4ca686..7116586f0 100644 --- a/_baseIsArguments.js +++ b/_baseIsArguments.js @@ -2,7 +2,7 @@ import baseGetTag from './_baseGetTag.js'; import isObjectLike from './isObjectLike.js'; /** `Object#toString` result references. */ -var argsTag = '[object Arguments]'; +const argsTag = '[object Arguments]'; /** * The base implementation of `_.isArguments`. diff --git a/_baseIsArrayBuffer.js b/_baseIsArrayBuffer.js index 7a25a8f61..248536240 100644 --- a/_baseIsArrayBuffer.js +++ b/_baseIsArrayBuffer.js @@ -1,7 +1,7 @@ import baseGetTag from './_baseGetTag.js'; import isObjectLike from './isObjectLike.js'; -var arrayBufferTag = '[object ArrayBuffer]'; +const arrayBufferTag = '[object ArrayBuffer]'; /** * The base implementation of `_.isArrayBuffer` without Node.js optimizations. diff --git a/_baseIsDate.js b/_baseIsDate.js index 5487cb51b..ce5883296 100644 --- a/_baseIsDate.js +++ b/_baseIsDate.js @@ -2,7 +2,7 @@ import baseGetTag from './_baseGetTag.js'; import isObjectLike from './isObjectLike.js'; /** `Object#toString` result references. */ -var dateTag = '[object Date]'; +const dateTag = '[object Date]'; /** * The base implementation of `_.isDate` without Node.js optimizations. diff --git a/_baseIsMap.js b/_baseIsMap.js index 6438d2b03..87ff3f36d 100644 --- a/_baseIsMap.js +++ b/_baseIsMap.js @@ -2,7 +2,7 @@ import getTag from './_getTag.js'; import isObjectLike from './isObjectLike.js'; /** `Object#toString` result references. */ -var mapTag = '[object Map]'; +const mapTag = '[object Map]'; /** * The base implementation of `_.isMap` without Node.js optimizations. diff --git a/_baseIsRegExp.js b/_baseIsRegExp.js index e73971b39..2a8f21f85 100644 --- a/_baseIsRegExp.js +++ b/_baseIsRegExp.js @@ -2,7 +2,7 @@ import baseGetTag from './_baseGetTag.js'; import isObjectLike from './isObjectLike.js'; /** `Object#toString` result references. */ -var regexpTag = '[object RegExp]'; +const regexpTag = '[object RegExp]'; /** * The base implementation of `_.isRegExp` without Node.js optimizations. diff --git a/_baseIsSet.js b/_baseIsSet.js index bee4a8e4b..4e953b30c 100644 --- a/_baseIsSet.js +++ b/_baseIsSet.js @@ -2,7 +2,7 @@ import getTag from './_getTag.js'; import isObjectLike from './isObjectLike.js'; /** `Object#toString` result references. */ -var setTag = '[object Set]'; +const setTag = '[object Set]'; /** * The base implementation of `_.isSet` without Node.js optimizations. diff --git a/_baseKeys.js b/_baseKeys.js index 5a7622490..8d71d6c6d 100644 --- a/_baseKeys.js +++ b/_baseKeys.js @@ -2,10 +2,10 @@ import isPrototype from './_isPrototype.js'; import nativeKeys from './_nativeKeys.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; /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. @@ -18,8 +18,8 @@ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } - var result = []; - for (var key in Object(object)) { + const result = []; + for (const key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } diff --git a/_baseKeysIn.js b/_baseKeysIn.js index 84c1395cf..f7bca0392 100644 --- a/_baseKeysIn.js +++ b/_baseKeysIn.js @@ -3,10 +3,10 @@ import isPrototype from './_isPrototype.js'; import nativeKeysIn from './_nativeKeysIn.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; /** * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. @@ -19,10 +19,10 @@ function baseKeysIn(object) { if (!isObject(object)) { return nativeKeysIn(object); } - var isProto = isPrototype(object), - result = []; + const isProto = isPrototype(object); + const result = []; - for (var key in object) { + for (const key in object) { if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } diff --git a/_baseMatches.js b/_baseMatches.js index a8b556fed..5486c11f2 100644 --- a/_baseMatches.js +++ b/_baseMatches.js @@ -10,7 +10,7 @@ import matchesStrictComparable from './_matchesStrictComparable.js'; * @returns {Function} Returns the new spec function. */ function baseMatches(source) { - var matchData = getMatchData(source); + const matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } diff --git a/_baseMatchesProperty.js b/_baseMatchesProperty.js index 6370abd5a..f6e6b36dc 100644 --- a/_baseMatchesProperty.js +++ b/_baseMatchesProperty.js @@ -7,8 +7,8 @@ import matchesStrictComparable from './_matchesStrictComparable.js'; import toKey from './_toKey.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 `_.matchesProperty` which doesn't clone `srcValue`. @@ -23,7 +23,7 @@ function baseMatchesProperty(path, srcValue) { return matchesStrictComparable(toKey(path), srcValue); } return object => { - var objValue = get(object, path); + const objValue = get(object, path); return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); diff --git a/_baseMean.js b/_baseMean.js index f2f1c57fb..c87baec2c 100644 --- a/_baseMean.js +++ b/_baseMean.js @@ -1,7 +1,7 @@ import baseSum from './_baseSum.js'; /** Used as references for various `Number` constants. */ -var NAN = 0 / 0; +const NAN = 0 / 0; /** * The base implementation of `_.mean` and `_.meanBy` without support for @@ -13,7 +13,7 @@ var NAN = 0 / 0; * @returns {number} Returns the mean. */ function baseMean(array, iteratee) { - var length = array == null ? 0 : array.length; + const length = array == null ? 0 : array.length; return length ? (baseSum(array, iteratee) / length) : NAN; } diff --git a/_baseNth.js b/_baseNth.js index 0a6e9998b..c4f5bde4c 100644 --- a/_baseNth.js +++ b/_baseNth.js @@ -9,7 +9,7 @@ import isIndex from './_isIndex.js'; * @returns {*} Returns the nth element of `array`. */ function baseNth(array, n) { - var length = array.length; + const length = array.length; if (!length) { return; } diff --git a/_baseOrderBy.js b/_baseOrderBy.js index bc8a47e64..641599472 100644 --- a/_baseOrderBy.js +++ b/_baseOrderBy.js @@ -16,11 +16,11 @@ import identity from './identity.js'; * @returns {Array} Returns the new sorted array. */ function baseOrderBy(collection, iteratees, orders) { - var index = -1; + let index = -1; iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee)); - var result = baseMap(collection, (value, key, collection) => { - var criteria = arrayMap(iteratees, iteratee => iteratee(value)); + const result = baseMap(collection, (value, key, collection) => { + const criteria = arrayMap(iteratees, iteratee => iteratee(value)); return { 'criteria': criteria, 'index': ++index, 'value': value }; }); diff --git a/_basePullAt.js b/_basePullAt.js index 9305613ed..ace3465f6 100644 --- a/_basePullAt.js +++ b/_basePullAt.js @@ -2,10 +2,10 @@ import baseUnset from './_baseUnset.js'; import isIndex from './_isIndex.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 `_.pullAt` without support for individual @@ -17,11 +17,11 @@ var splice = arrayProto.splice; * @returns {Array} Returns `array`. */ function basePullAt(array, indexes) { - var length = array ? indexes.length : 0, - lastIndex = length - 1; + let length = array ? indexes.length : 0; + const lastIndex = length - 1; while (length--) { - var index = indexes[length]; + const index = indexes[length]; if (length == lastIndex || index !== previous) { var previous = index; if (isIndex(index)) { diff --git a/_baseRepeat.js b/_baseRepeat.js index 594539a7a..5e7c35a6d 100644 --- a/_baseRepeat.js +++ b/_baseRepeat.js @@ -1,8 +1,8 @@ /** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; +const MAX_SAFE_INTEGER = 9007199254740991; /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeFloor = Math.floor; +const nativeFloor = Math.floor; /** * The base implementation of `_.repeat` which doesn't coerce arguments. @@ -13,7 +13,7 @@ var nativeFloor = Math.floor; * @returns {string} Returns the repeated string. */ function baseRepeat(string, n) { - var result = ''; + let result = ''; if (!string || n < 1 || n > MAX_SAFE_INTEGER) { return result; } diff --git a/_baseSampleSize.js b/_baseSampleSize.js index 04877a16b..c693c6f5a 100644 --- a/_baseSampleSize.js +++ b/_baseSampleSize.js @@ -11,7 +11,7 @@ import values from './values.js'; * @returns {Array} Returns the random elements. */ function baseSampleSize(collection, n) { - var array = values(collection); + const array = values(collection); return shuffleSelf(array, baseClamp(n, 0, array.length)); } diff --git a/_baseSetData.js b/_baseSetData.js index f901afef2..fc36f3bed 100644 --- a/_baseSetData.js +++ b/_baseSetData.js @@ -9,7 +9,7 @@ import metaMap from './_metaMap.js'; * @param {*} data The metadata. * @returns {Function} Returns `func`. */ -var baseSetData = !metaMap ? identity : (func, data) => { +const baseSetData = !metaMap ? identity : (func, data) => { metaMap.set(func, data); return func; }; diff --git a/_baseSetToString.js b/_baseSetToString.js index 2a00fceff..d2bed4b79 100644 --- a/_baseSetToString.js +++ b/_baseSetToString.js @@ -10,7 +10,7 @@ import identity from './identity.js'; * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ -var baseSetToString = !defineProperty ? identity : (func, string) => defineProperty(func, 'toString', { +const baseSetToString = !defineProperty ? identity : (func, string) => defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, 'value': constant(string), diff --git a/_baseSome.js b/_baseSome.js index aec0ff733..7db1a7b6d 100644 --- a/_baseSome.js +++ b/_baseSome.js @@ -10,7 +10,7 @@ import baseEach from './_baseEach.js'; * else `false`. */ function baseSome(collection, predicate) { - var result; + let result; baseEach(collection, (value, index, collection) => { result = predicate(value, index, collection); diff --git a/_baseSortBy.js b/_baseSortBy.js index e2041cd66..682bc88fa 100644 --- a/_baseSortBy.js +++ b/_baseSortBy.js @@ -9,7 +9,7 @@ * @returns {Array} Returns `array`. */ function baseSortBy(array, comparer) { - var length = array.length; + let length = array.length; array.sort(comparer); while (length--) { diff --git a/_baseSum.js b/_baseSum.js index 61b3da44f..9d79920f7 100644 --- a/_baseSum.js +++ b/_baseSum.js @@ -8,12 +8,12 @@ * @returns {number} Returns the sum. */ function baseSum(array, iteratee) { - var result, - index = -1, - length = array.length; + let result; + let index = -1; + const length = array.length; while (++index < length) { - var current = iteratee(array[index]); + const current = iteratee(array[index]); if (current !== undefined) { result = result === undefined ? current : (result + current); } diff --git a/_baseTimes.js b/_baseTimes.js index d5d0e274f..e4954747e 100644 --- a/_baseTimes.js +++ b/_baseTimes.js @@ -8,8 +8,8 @@ * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); + let index = -1; + const result = Array(n); while (++index < n) { result[index] = iteratee(index); diff --git a/_baseToNumber.js b/_baseToNumber.js index 3552d1a21..167108ef5 100644 --- a/_baseToNumber.js +++ b/_baseToNumber.js @@ -1,7 +1,7 @@ import isSymbol from './isSymbol.js'; /** Used as references for various `Number` constants. */ -var NAN = 0 / 0; +const NAN = 0 / 0; /** * The base implementation of `_.toNumber` which doesn't ensure correct diff --git a/_baseWhile.js b/_baseWhile.js index 5536ea6ef..d9fbe0c4a 100644 --- a/_baseWhile.js +++ b/_baseWhile.js @@ -12,8 +12,8 @@ import baseSlice from './_baseSlice.js'; * @returns {Array} Returns the slice of `array`. */ function baseWhile(array, predicate, isDrop, fromRight) { - var length = array.length, - index = fromRight ? length : -1; + const length = array.length; + let index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} diff --git a/_baseWrapperValue.js b/_baseWrapperValue.js index 3e6990ad8..f264820b1 100644 --- a/_baseWrapperValue.js +++ b/_baseWrapperValue.js @@ -13,7 +13,7 @@ import arrayReduce from './_arrayReduce.js'; * @returns {*} Returns the resolved value. */ function baseWrapperValue(value, actions) { - var result = value; + let result = value; if (result instanceof LazyWrapper) { result = result.value(); } diff --git a/_baseXor.js b/_baseXor.js index 9cebe6748..8509f3807 100644 --- a/_baseXor.js +++ b/_baseXor.js @@ -13,16 +13,16 @@ import baseUniq from './_baseUniq.js'; * @returns {Array} Returns the new array of values. */ function baseXor(arrays, iteratee, comparator) { - var length = arrays.length; + const length = arrays.length; if (length < 2) { return length ? baseUniq(arrays[0]) : []; } - var index = -1, - result = Array(length); + let index = -1; + const result = Array(length); while (++index < length) { - var array = arrays[index], - othIndex = -1; + const array = arrays[index]; + let othIndex = -1; while (++othIndex < length) { if (othIndex != index) { diff --git a/_baseZipObject.js b/_baseZipObject.js index f6f4a3cc5..e3f840ac6 100644 --- a/_baseZipObject.js +++ b/_baseZipObject.js @@ -8,13 +8,13 @@ * @returns {Object} Returns the new object. */ function baseZipObject(props, values, assignFunc) { - var index = -1, - length = props.length, - valsLength = values.length, - result = {}; + let index = -1; + const length = props.length; + const valsLength = values.length; + const result = {}; while (++index < length) { - var value = index < valsLength ? values[index] : undefined; + const value = index < valsLength ? values[index] : undefined; assignFunc(result, props[index], value); } return result; diff --git a/_castRest.js b/_castRest.js index 6f43d021a..e8e7ddf53 100644 --- a/_castRest.js +++ b/_castRest.js @@ -9,6 +9,6 @@ import baseRest from './_baseRest.js'; * @param {Function} func The function to apply a rest parameter to. * @returns {Function} Returns the new function. */ -var castRest = baseRest; +const castRest = baseRest; export default castRest; diff --git a/_castSlice.js b/_castSlice.js index 011bbe4eb..9e906fb9c 100644 --- a/_castSlice.js +++ b/_castSlice.js @@ -10,7 +10,7 @@ import baseSlice from './_baseSlice.js'; * @returns {Array} Returns the cast slice. */ function castSlice(array, start, end) { - var length = array.length; + const length = array.length; end = end === undefined ? length : end; return (!start && end >= length) ? array : baseSlice(array, start, end); } diff --git a/_charsEndIndex.js b/_charsEndIndex.js index af9926e7a..92ba6411a 100644 --- a/_charsEndIndex.js +++ b/_charsEndIndex.js @@ -10,7 +10,7 @@ import baseIndexOf from './_baseIndexOf.js'; * @returns {number} Returns the index of the last unmatched string symbol. */ function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; + let index = strSymbols.length; while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; diff --git a/_charsStartIndex.js b/_charsStartIndex.js index 7406b19f4..25018d28b 100644 --- a/_charsStartIndex.js +++ b/_charsStartIndex.js @@ -10,11 +10,11 @@ import baseIndexOf from './_baseIndexOf.js'; * @returns {number} Returns the index of the first unmatched string symbol. */ function charsStartIndex(strSymbols, chrSymbols) { - var index = -1, - length = strSymbols.length; + let index = -1; + const length = strSymbols.length; - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; } export default charsStartIndex; diff --git a/_cloneArrayBuffer.js b/_cloneArrayBuffer.js index 9f33e7a7c..2c8cb0fae 100644 --- a/_cloneArrayBuffer.js +++ b/_cloneArrayBuffer.js @@ -8,7 +8,7 @@ import Uint8Array from './_Uint8Array.js'; * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + const result = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array(result).set(new Uint8Array(arrayBuffer)); return result; } diff --git a/_cloneDataView.js b/_cloneDataView.js index f9b9a6f03..c7294e03a 100644 --- a/_cloneDataView.js +++ b/_cloneDataView.js @@ -9,7 +9,7 @@ import cloneArrayBuffer from './_cloneArrayBuffer.js'; * @returns {Object} Returns the cloned data view. */ function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; + const buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); } diff --git a/_cloneMap.js b/_cloneMap.js index a4aa5b5d6..31f27a368 100644 --- a/_cloneMap.js +++ b/_cloneMap.js @@ -3,7 +3,7 @@ import arrayReduce from './_arrayReduce.js'; import mapToArray from './_mapToArray.js'; /** Used to compose bitmasks for cloning. */ -var CLONE_DEEP_FLAG = 1; +const CLONE_DEEP_FLAG = 1; /** * Creates a clone of `map`. @@ -15,7 +15,7 @@ var CLONE_DEEP_FLAG = 1; * @returns {Object} Returns the cloned map. */ function cloneMap(map, isDeep, cloneFunc) { - var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map); + const array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map); return arrayReduce(array, addMapEntry, new map.constructor); } diff --git a/_cloneRegExp.js b/_cloneRegExp.js index 0ddb49b4c..1616a124c 100644 --- a/_cloneRegExp.js +++ b/_cloneRegExp.js @@ -1,5 +1,5 @@ /** Used to match `RegExp` flags from their coerced string values. */ -var reFlags = /\w*$/; +const reFlags = /\w*$/; /** * Creates a clone of `regexp`. @@ -9,7 +9,7 @@ var reFlags = /\w*$/; * @returns {Object} Returns the cloned regexp. */ function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + const result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } diff --git a/_cloneSet.js b/_cloneSet.js index e1d1063d0..361c55d27 100644 --- a/_cloneSet.js +++ b/_cloneSet.js @@ -3,7 +3,7 @@ import arrayReduce from './_arrayReduce.js'; import setToArray from './_setToArray.js'; /** Used to compose bitmasks for cloning. */ -var CLONE_DEEP_FLAG = 1; +const CLONE_DEEP_FLAG = 1; /** * Creates a clone of `set`. @@ -15,7 +15,7 @@ var CLONE_DEEP_FLAG = 1; * @returns {Object} Returns the cloned set. */ function cloneSet(set, isDeep, cloneFunc) { - var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set); + const array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set); return arrayReduce(array, addSetEntry, new set.constructor); } diff --git a/_cloneTypedArray.js b/_cloneTypedArray.js index 2fa9b8a6a..8f962fc15 100644 --- a/_cloneTypedArray.js +++ b/_cloneTypedArray.js @@ -9,7 +9,7 @@ import cloneArrayBuffer from './_cloneArrayBuffer.js'; * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; + const buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } diff --git a/_copyArray.js b/_copyArray.js index b29b71e95..7968f3787 100644 --- a/_copyArray.js +++ b/_copyArray.js @@ -7,8 +7,8 @@ * @returns {Array} Returns `array`. */ function copyArray(source, array) { - var index = -1, - length = source.length; + let index = -1; + const length = source.length; array || (array = Array(length)); while (++index < length) { diff --git a/_copyObject.js b/_copyObject.js index 4e2475553..1f83892b4 100644 --- a/_copyObject.js +++ b/_copyObject.js @@ -12,16 +12,16 @@ import baseAssignValue from './_baseAssignValue.js'; * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { - var isNew = !object; + const isNew = !object; object || (object = {}); - var index = -1, - length = props.length; + let index = -1; + const length = props.length; while (++index < length) { - var key = props[index]; + const key = props[index]; - var newValue = customizer + let newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; diff --git a/_coreJsData.js b/_coreJsData.js index 2ad4fc142..7e944be80 100644 --- a/_coreJsData.js +++ b/_coreJsData.js @@ -1,6 +1,6 @@ import root from './_root.js'; /** Used to detect overreaching core-js shims. */ -var coreJsData = root['__core-js_shared__']; +const coreJsData = root['__core-js_shared__']; export default coreJsData; diff --git a/_createBaseEach.js b/_createBaseEach.js index 94f6fa28a..96ccda7fb 100644 --- a/_createBaseEach.js +++ b/_createBaseEach.js @@ -16,9 +16,9 @@ function createBaseEach(eachFunc, fromRight) { if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } - var length = collection.length, - index = fromRight ? length : -1, - iterable = Object(collection); + const length = collection.length; + const iterable = Object(collection); + let index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length)) { if (iteratee(iterable[index], index, iterable) === false) { diff --git a/_createCaseFirst.js b/_createCaseFirst.js index 83847c576..43af01d52 100644 --- a/_createCaseFirst.js +++ b/_createCaseFirst.js @@ -14,15 +14,15 @@ function createCaseFirst(methodName) { return string => { string = toString(string); - var strSymbols = hasUnicode(string) + const strSymbols = hasUnicode(string) ? stringToArray(string) : undefined; - var chr = strSymbols + const chr = strSymbols ? strSymbols[0] : string.charAt(0); - var trailing = strSymbols + const trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1); diff --git a/_createCompounder.js b/_createCompounder.js index a64ce89e4..5154f58a4 100644 --- a/_createCompounder.js +++ b/_createCompounder.js @@ -3,10 +3,10 @@ import deburr from './deburr.js'; import words from './words.js'; /** Used to compose unicode capture groups. */ -var rsApos = "['\u2019]"; +const rsApos = "['\u2019]"; /** Used to match apostrophes. */ -var reApos = RegExp(rsApos, 'g'); +const reApos = RegExp(rsApos, 'g'); /** * Creates a function like `_.camelCase`. diff --git a/_createFind.js b/_createFind.js index a6f6c2169..94a5fbd43 100644 --- a/_createFind.js +++ b/_createFind.js @@ -11,13 +11,13 @@ import keys from './keys.js'; */ function createFind(findIndexFunc) { return (collection, predicate, fromIndex) => { - var iterable = Object(collection); + const iterable = Object(collection); if (!isArrayLike(collection)) { var iteratee = baseIteratee(predicate, 3); collection = keys(collection); predicate = key => iteratee(iterable[key], key, iterable); } - var index = findIndexFunc(collection, predicate, fromIndex); + const index = findIndexFunc(collection, predicate, fromIndex); return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; }; } diff --git a/_createMathOperation.js b/_createMathOperation.js index fd26eb2e2..4b46b7d1c 100644 --- a/_createMathOperation.js +++ b/_createMathOperation.js @@ -11,7 +11,7 @@ import baseToString from './_baseToString.js'; */ function createMathOperation(operator, defaultValue) { return (value, other) => { - var result; + let result; if (value === undefined && other === undefined) { return defaultValue; } diff --git a/_createOver.js b/_createOver.js index 68d67cc3f..4093c5fd6 100644 --- a/_createOver.js +++ b/_createOver.js @@ -16,7 +16,7 @@ function createOver(arrayFunc) { return flatRest(iteratees => { iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); return baseRest(function(args) { - var thisArg = this; + const thisArg = this; return arrayFunc(iteratees, iteratee => apply(iteratee, thisArg, args)); }); }); diff --git a/_createPadding.js b/_createPadding.js index 1e35cd82b..fd118122b 100644 --- a/_createPadding.js +++ b/_createPadding.js @@ -6,7 +6,7 @@ import stringSize from './_stringSize.js'; import stringToArray from './_stringToArray.js'; /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeCeil = Math.ceil; +const nativeCeil = Math.ceil; /** * Creates the padding for `string` based on `length`. The `chars` string @@ -20,11 +20,11 @@ var nativeCeil = Math.ceil; function createPadding(length, chars) { chars = chars === undefined ? ' ' : baseToString(chars); - var charsLength = chars.length; + const charsLength = chars.length; if (charsLength < 2) { return charsLength ? baseRepeat(chars, length) : chars; } - var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); + const result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join('') : result.slice(0, length); diff --git a/_createSet.js b/_createSet.js index 811d1109a..a103e0c28 100644 --- a/_createSet.js +++ b/_createSet.js @@ -3,7 +3,7 @@ import noop from './noop.js'; import setToArray from './_setToArray.js'; /** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; +const INFINITY = 1 / 0; /** * Creates a set object of `values`. @@ -12,6 +12,6 @@ var INFINITY = 1 / 0; * @param {Array} values The values to add to the set. * @returns {Object} Returns the new set. */ -var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : values => new Set(values); +const createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : values => new Set(values); export default createSet; diff --git a/_customDefaultsAssignIn.js b/_customDefaultsAssignIn.js index 0de9339b2..f15495f72 100644 --- a/_customDefaultsAssignIn.js +++ b/_customDefaultsAssignIn.js @@ -1,10 +1,10 @@ import eq from './eq.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 by `_.defaults` to customize its `_.assignIn` use to assign properties diff --git a/_deburrLetter.js b/_deburrLetter.js index 88a7b99df..b89e776e3 100644 --- a/_deburrLetter.js +++ b/_deburrLetter.js @@ -1,7 +1,7 @@ import basePropertyOf from './_basePropertyOf.js'; /** Used to map Latin Unicode letters to basic Latin letters. */ -var deburredLetters = { +const deburredLetters = { // Latin-1 Supplement block. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', @@ -66,6 +66,6 @@ var deburredLetters = { * @param {string} letter The matched letter to deburr. * @returns {string} Returns the deburred letter. */ -var deburrLetter = basePropertyOf(deburredLetters); +const deburrLetter = basePropertyOf(deburredLetters); export default deburrLetter; diff --git a/_defineProperty.js b/_defineProperty.js index e94f8fa47..b2b07a94c 100644 --- a/_defineProperty.js +++ b/_defineProperty.js @@ -1,8 +1,8 @@ import getNative from './_getNative.js'; -var defineProperty = ((() => { +const defineProperty = ((() => { try { - var func = getNative(Object, 'defineProperty'); + const func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} diff --git a/_escapeHtmlChar.js b/_escapeHtmlChar.js index 536240335..ab600d1db 100644 --- a/_escapeHtmlChar.js +++ b/_escapeHtmlChar.js @@ -1,7 +1,7 @@ import basePropertyOf from './_basePropertyOf.js'; /** Used to map characters to HTML entities. */ -var htmlEscapes = { +const htmlEscapes = { '&': '&', '<': '<', '>': '>', @@ -16,6 +16,6 @@ var htmlEscapes = { * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ -var escapeHtmlChar = basePropertyOf(htmlEscapes); +const escapeHtmlChar = basePropertyOf(htmlEscapes); export default escapeHtmlChar; diff --git a/_escapeStringChar.js b/_escapeStringChar.js index 164270a72..80f1b1a66 100644 --- a/_escapeStringChar.js +++ b/_escapeStringChar.js @@ -1,5 +1,5 @@ /** Used to escape characters for inclusion in compiled string literals. */ -var stringEscapes = { +const stringEscapes = { '\\': '\\', "'": "'", '\n': 'n', diff --git a/_freeGlobal.js b/_freeGlobal.js index 5e383a14c..a2e2e1735 100644 --- a/_freeGlobal.js +++ b/_freeGlobal.js @@ -1,4 +1,4 @@ /** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; +const freeGlobal = typeof global == 'object' && global && global.Object === Object && global; export default freeGlobal; diff --git a/_getData.js b/_getData.js index 237c60a9a..b27eb8706 100644 --- a/_getData.js +++ b/_getData.js @@ -8,6 +8,6 @@ import noop from './noop.js'; * @param {Function} func The function to query. * @returns {*} Returns the metadata for `func`. */ -var getData = !metaMap ? noop : func => metaMap.get(func); +const getData = !metaMap ? noop : func => metaMap.get(func); export default getData; diff --git a/_getHolder.js b/_getHolder.js index 9f76b190b..1e4ce3ecc 100644 --- a/_getHolder.js +++ b/_getHolder.js @@ -6,7 +6,7 @@ * @returns {*} Returns the placeholder value. */ function getHolder(func) { - var object = func; + const object = func; return object.placeholder; } diff --git a/_getMapData.js b/_getMapData.js index 7851b5403..6617cc2ce 100644 --- a/_getMapData.js +++ b/_getMapData.js @@ -9,7 +9,7 @@ import isKeyable from './_isKeyable.js'; * @returns {*} Returns the map data. */ function getMapData({ __data__ }, key) { - var data = __data__; + const data = __data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; diff --git a/_getNative.js b/_getNative.js index d2cb43860..1a737ad9b 100644 --- a/_getNative.js +++ b/_getNative.js @@ -10,7 +10,7 @@ import getValue from './_getValue.js'; * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { - var value = getValue(object, key); + const value = getValue(object, key); return baseIsNative(value) ? value : undefined; } diff --git a/_getPrototype.js b/_getPrototype.js index ce92d4885..04370e6ac 100644 --- a/_getPrototype.js +++ b/_getPrototype.js @@ -1,6 +1,6 @@ import overArg from './_overArg.js'; /** Built-in value references. */ -var getPrototype = overArg(Object.getPrototypeOf, Object); +const getPrototype = overArg(Object.getPrototypeOf, Object); export default getPrototype; diff --git a/_getSymbols.js b/_getSymbols.js index 985337634..72687d3f6 100644 --- a/_getSymbols.js +++ b/_getSymbols.js @@ -2,13 +2,13 @@ import arrayFilter from './_arrayFilter.js'; import stubArray from './stubArray.js'; /** Used for built-in method references. */ -var objectProto = Object.prototype; +const objectProto = Object.prototype; /** Built-in value references. */ -var propertyIsEnumerable = objectProto.propertyIsEnumerable; +const propertyIsEnumerable = objectProto.propertyIsEnumerable; /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetSymbols = Object.getOwnPropertySymbols; +const nativeGetSymbols = Object.getOwnPropertySymbols; /** * Creates an array of the own enumerable symbols of `object`. @@ -17,7 +17,7 @@ var nativeGetSymbols = Object.getOwnPropertySymbols; * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ -var getSymbols = !nativeGetSymbols ? stubArray : object => { +const getSymbols = !nativeGetSymbols ? stubArray : object => { if (object == null) { return []; } diff --git a/_getSymbolsIn.js b/_getSymbolsIn.js index 3e5dd4ef9..419906b2b 100644 --- a/_getSymbolsIn.js +++ b/_getSymbolsIn.js @@ -4,7 +4,7 @@ import getSymbols from './_getSymbols.js'; import stubArray from './stubArray.js'; /* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetSymbols = Object.getOwnPropertySymbols; +const nativeGetSymbols = Object.getOwnPropertySymbols; /** * Creates an array of the own and inherited enumerable symbols of `object`. @@ -13,8 +13,8 @@ var nativeGetSymbols = Object.getOwnPropertySymbols; * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ -var getSymbolsIn = !nativeGetSymbols ? stubArray : object => { - var result = []; +const getSymbolsIn = !nativeGetSymbols ? stubArray : object => { + const result = []; while (object) { arrayPush(result, getSymbols(object)); object = getPrototype(object); diff --git a/_hasPath.js b/_hasPath.js index 7decc6c06..44c25d3fd 100644 --- a/_hasPath.js +++ b/_hasPath.js @@ -17,7 +17,7 @@ import toKey from './_toKey.js'; function hasPath(object, path, hasFunc) { path = castPath(path, object); - var index = -1, + let index = -1, length = path.length, result = false; diff --git a/_hashDelete.js b/_hashDelete.js index 509839f51..863dc6d69 100644 --- a/_hashDelete.js +++ b/_hashDelete.js @@ -9,7 +9,7 @@ * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { - var result = this.has(key) && delete this.__data__[key]; + const result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } diff --git a/_hashGet.js b/_hashGet.js index 4a3f43b27..14718d052 100644 --- a/_hashGet.js +++ b/_hashGet.js @@ -1,13 +1,13 @@ import nativeCreate from './_nativeCreate.js'; /** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; +const HASH_UNDEFINED = '__lodash_hash_undefined__'; /** 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 hash value for `key`. @@ -19,9 +19,9 @@ var hasOwnProperty = objectProto.hasOwnProperty; * @returns {*} Returns the entry value. */ function hashGet(key) { - var data = this.__data__; + const data = this.__data__; if (nativeCreate) { - var result = data[key]; + const result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; diff --git a/_hashHas.js b/_hashHas.js index 6db025d8e..ba9c40703 100644 --- a/_hashHas.js +++ b/_hashHas.js @@ -1,10 +1,10 @@ import nativeCreate from './_nativeCreate.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; /** * Checks if a hash value for `key` exists. @@ -16,7 +16,7 @@ var hasOwnProperty = objectProto.hasOwnProperty; * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { - var data = this.__data__; + const data = this.__data__; return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); } diff --git a/_hashSet.js b/_hashSet.js index 63a0115b0..3f7084008 100644 --- a/_hashSet.js +++ b/_hashSet.js @@ -1,7 +1,7 @@ import nativeCreate from './_nativeCreate.js'; /** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; +const HASH_UNDEFINED = '__lodash_hash_undefined__'; /** * Sets the hash `key` to `value`. @@ -14,7 +14,7 @@ var HASH_UNDEFINED = '__lodash_hash_undefined__'; * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { - var data = this.__data__; + const data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this;