Apply even more let/const transforms.

This commit is contained in:
John-David Dalton
2017-01-09 12:23:34 -08:00
parent e6152a97e8
commit dc687c1d85
177 changed files with 433 additions and 437 deletions

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 Set = getNative(root, 'Set');
const Set = getNative(root, 'Set');
export default Set;

View File

@@ -11,8 +11,8 @@ import setCacheHas from './_setCacheHas.js';
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
let index = -1;
const length = values == null ? 0 : values.length;
this.__data__ = new MapCache;
while (++index < length) {

View File

@@ -13,7 +13,7 @@ import stackSet from './_stackSet.js';
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
const data = this.__data__ = new ListCache(entries);
this.size = data.size;
}

View File

@@ -1,6 +1,6 @@
import root from './_root.js';
/** Built-in value references. */
var Symbol = root.Symbol;
const Symbol = root.Symbol;
export default Symbol;

View File

@@ -1,6 +1,6 @@
import root from './_root.js';
/** Built-in value references. */
var Uint8Array = root.Uint8Array;
const Uint8Array = root.Uint8Array;
export default Uint8Array;

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 WeakMap = getNative(root, 'WeakMap');
const WeakMap = getNative(root, 'WeakMap');
export default WeakMap;

View File

@@ -1,16 +1,16 @@
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f',
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
rsComboSymbolsRange = '\\u20d0-\\u20ff',
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
rsVarRange = '\\ufe0e\\ufe0f';
const rsAstralRange = '\\ud800-\\udfff';
const rsComboMarksRange = '\\u0300-\\u036f';
const reComboHalfMarksRange = '\\ufe20-\\ufe2f';
const rsComboSymbolsRange = '\\u20d0-\\u20ff';
const rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
const rsVarRange = '\\ufe0e\\ufe0f';
/** Used to compose unicode capture groups. */
var rsZWJ = '\\u200d';
const rsZWJ = '\\u200d';
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasUnicode = RegExp(`[${ rsZWJ + rsAstralRange + rsComboRange + rsVarRange }]`);
const reHasUnicode = RegExp(`[${ rsZWJ + rsAstralRange + rsComboRange + rsVarRange }]`);
/**
* Checks if `string` contains Unicode symbols.

View File

@@ -7,26 +7,26 @@ import cloneSymbol from './_cloneSymbol.js';
import cloneTypedArray from './_cloneTypedArray.js';
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
dateTag = '[object Date]',
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 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]',
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]';
/**
* Initializes an object clone based on its `toStringTag`.
@@ -42,7 +42,7 @@ var arrayBufferTag = '[object ArrayBuffer]',
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, cloneFunc, isDeep) {
var Ctor = object.constructor;
const Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return cloneArrayBuffer(object);

View File

@@ -1,5 +1,5 @@
/** Used to match wrap detail comments. */
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
const reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
/**
* Inserts wrapper `details` in a comment at the top of the `source` body.

View File

@@ -1,10 +1,10 @@
import assocIndexOf from './_assocIndexOf.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;
/**
* Removes `key` and its value from the list cache.
@@ -16,13 +16,13 @@ var splice = arrayProto.splice;
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
const data = this.__data__;
const index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
const lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {

View File

@@ -10,8 +10,8 @@ import assocIndexOf from './_assocIndexOf.js';
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
const data = this.__data__;
const index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}

View File

@@ -11,8 +11,8 @@ import assocIndexOf from './_assocIndexOf.js';
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
const data = this.__data__;
const index = assocIndexOf(data, key);
if (index < 0) {
++this.size;

View File

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

View File

@@ -1,7 +1,7 @@
import memoize from './memoize.js';
/** Used as the maximum memoize cache size. */
var MAX_MEMOIZE_SIZE = 500;
const MAX_MEMOIZE_SIZE = 500;
/**
* A specialized version of `_.memoize` which clears the memoized function's
@@ -12,7 +12,7 @@ var MAX_MEMOIZE_SIZE = 500;
* @returns {Function} Returns the new memoized function.
*/
function memoizeCapped(func) {
var result = memoize(func, key => {
const result = memoize(func, key => {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}

View File

@@ -3,18 +3,18 @@ import composeArgsRight from './_composeArgsRight.js';
import replaceHolders from './_replaceHolders.js';
/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
const PLACEHOLDER = '__lodash_placeholder__';
/** 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_ARY_FLAG = 128,
WRAP_REARG_FLAG = 256;
const WRAP_BIND_FLAG = 1;
const WRAP_BIND_KEY_FLAG = 2;
const WRAP_CURRY_BOUND_FLAG = 4;
const WRAP_CURRY_FLAG = 8;
const WRAP_ARY_FLAG = 128;
const WRAP_REARG_FLAG = 256;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
const nativeMin = Math.min;
/**
* Merges the function metadata of `source` into `data`.
@@ -33,12 +33,13 @@ var nativeMin = Math.min;
* @returns {Array} Returns `data`.
*/
function mergeData(data, source) {
var bitmask = data[1],
srcBitmask = source[1],
newBitmask = bitmask | srcBitmask,
isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
const bitmask = data[1];
const srcBitmask = source[1];
var isCombo =
let newBitmask = bitmask | srcBitmask;
const isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
const isCombo =
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
@@ -54,7 +55,7 @@ function mergeData(data, source) {
newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
}
// Compose partial arguments.
var value = source[3];
let value = source[3];
if (value) {
var partials = data[3];
data[3] = partials ? composeArgs(partials, value, source[4]) : value;

View File

@@ -1,6 +1,6 @@
import WeakMap from './_WeakMap.js';
/** Used to store function metadata. */
var metaMap = WeakMap && new WeakMap;
const metaMap = WeakMap && new WeakMap;
export default metaMap;

View File

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

View File

@@ -1,6 +1,6 @@
import overArg from './_overArg.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
const nativeKeys = overArg(Object.keys, Object);
export default nativeKeys;

View File

@@ -8,9 +8,9 @@
* @returns {Array} Returns the array of property names.
*/
function nativeKeysIn(object) {
var result = [];
const result = [];
if (object != null) {
for (var key in Object(object)) {
for (const key in Object(object)) {
result.push(key);
}
}

View File

@@ -1,19 +1,19 @@
import freeGlobal from './_freeGlobal.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;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
const freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = ((() => {
const nodeUtil = ((() => {
try {
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}

View File

@@ -1,12 +1,12 @@
/** Used for built-in method references. */
var objectProto = Object.prototype;
const objectProto = Object.prototype;
/**
* 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;
/**
* Converts `value` to a string using `Object.prototype.toString`.

View File

@@ -1,7 +1,7 @@
import apply from './_apply.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
const nativeMax = Math.max;
/**
* A specialized version of `baseRest` which transforms the rest array.
@@ -15,16 +15,16 @@ var nativeMax = Math.max;
function overRest(func, start, transform) {
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
const args = arguments;
let index = -1;
const length = nativeMax(args.length - start, 0);
const array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
const otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}

View File

@@ -2,7 +2,7 @@ import copyArray from './_copyArray.js';
import isIndex from './_isIndex.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
const nativeMin = Math.min;
/**
* Reorder `array` according to the specified indexes where the element at
@@ -15,12 +15,12 @@ var nativeMin = Math.min;
* @returns {Array} Returns `array`.
*/
function reorder(array, indexes) {
var arrLength = array.length,
length = nativeMin(indexes.length, arrLength),
oldArray = copyArray(array);
const arrLength = array.length;
let length = nativeMin(indexes.length, arrLength);
const oldArray = copyArray(array);
while (length--) {
var index = indexes[length];
const index = indexes[length];
array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
}
return array;

View File

@@ -1,5 +1,5 @@
/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
const PLACEHOLDER = '__lodash_placeholder__';
/**
* Replaces all `placeholder` elements in `array` with an internal placeholder
@@ -11,13 +11,13 @@ var PLACEHOLDER = '__lodash_placeholder__';
* @returns {Array} Returns the new array of placeholder indexes.
*/
function replaceHolders(array, placeholder) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
let index = -1;
const length = array.length;
let resIndex = 0;
const result = [];
while (++index < length) {
var value = array[index];
const value = array[index];
if (value === placeholder || value === PLACEHOLDER) {
array[index] = PLACEHOLDER;
result[resIndex++] = index;

View File

@@ -1,9 +1,9 @@
import freeGlobal from './_freeGlobal.js';
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
const freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
const root = freeGlobal || freeSelf || Function('return this')();
export default root;

View File

@@ -1,5 +1,5 @@
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
const HASH_UNDEFINED = '__lodash_hash_undefined__';
/**
* Adds `value` to the array cache.

View File

@@ -1,9 +1,9 @@
/** Used to detect hot functions by number of calls within a span of milliseconds. */
var HOT_COUNT = 800,
HOT_SPAN = 16;
const HOT_COUNT = 800;
const HOT_SPAN = 16;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeNow = Date.now;
const nativeNow = Date.now;
/**
* Creates a function that'll short out and invoke `identity` instead
@@ -15,12 +15,12 @@ var nativeNow = Date.now;
* @returns {Function} Returns the new shortable function.
*/
function shortOut(func) {
var count = 0,
lastCalled = 0;
let count = 0;
let lastCalled = 0;
return function(...args) {
var stamp = nativeNow(),
remaining = HOT_SPAN - (stamp - lastCalled);
const stamp = nativeNow();
const remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {

View File

@@ -8,8 +8,8 @@
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
const data = this.__data__;
const result = data['delete'](key);
this.size = data.size;
return result;

View File

@@ -3,7 +3,7 @@ import Map from './_Map.js';
import MapCache from './_MapCache.js';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
const LARGE_ARRAY_SIZE = 200;
/**
* Sets the stack `key` to `value`.
@@ -16,9 +16,9 @@ var LARGE_ARRAY_SIZE = 200;
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
let data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
const pairs = data.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
this.size = ++data.size;

View File

@@ -9,8 +9,8 @@
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
let index = fromIndex - 1;
const length = array.length;
while (++index < length) {
if (array[index] === value) {

View File

@@ -9,7 +9,7 @@
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictLastIndexOf(array, value, fromIndex) {
var index = fromIndex + 1;
let index = fromIndex + 1;
while (index--) {
if (array[index] === value) {
return index;

View File

@@ -1,11 +1,10 @@
import memoizeCapped from './_memoizeCapped.js';
/** Used to match property names within property paths. */
var reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
const reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
const reEscapeChar = /\\(\\)?/g;
/**
* Converts `string` to a property path array.
@@ -14,8 +13,8 @@ var reEscapeChar = /\\(\\)?/g;
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoizeCapped(string => {
var result = [];
const stringToPath = memoizeCapped(string => {
const result = [];
if (reLeadingDot.test(string)) {
result.push('');
}

View File

@@ -1,7 +1,7 @@
import isSymbol from './isSymbol.js';
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
const INFINITY = 1 / 0;
/**
* Converts `value` to a string key if it's not a string or symbol.

View File

@@ -1,8 +1,8 @@
/** Used for built-in method references. */
var funcProto = Function.prototype;
const funcProto = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
const funcToString = funcProto.toString;
/**
* Converts `func` to its source code.

View File

@@ -1,7 +1,7 @@
import basePropertyOf from './_basePropertyOf.js';
/** Used to map HTML entities to characters. */
var htmlUnescapes = {
const htmlUnescapes = {
'&amp;': '&',
'&lt;': '<',
'&gt;': '>',
@@ -16,6 +16,6 @@ var htmlUnescapes = {
* @param {string} chr The matched character to unescape.
* @returns {string} Returns the unescaped character.
*/
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
const unescapeHtmlChar = basePropertyOf(htmlUnescapes);
export default unescapeHtmlChar;

View File

@@ -2,18 +2,18 @@ import arrayEach from './_arrayEach.js';
import arrayIncludes from './_arrayIncludes.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_PARTIAL_FLAG = 32,
WRAP_PARTIAL_RIGHT_FLAG = 64,
WRAP_ARY_FLAG = 128,
WRAP_REARG_FLAG = 256,
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_PARTIAL_FLAG = 32;
const WRAP_PARTIAL_RIGHT_FLAG = 64;
const WRAP_ARY_FLAG = 128;
const WRAP_REARG_FLAG = 256;
const WRAP_FLIP_FLAG = 512;
/** Used to associate wrap methods with their bit flags. */
var wrapFlags = [
const wrapFlags = [
['ary', WRAP_ARY_FLAG],
['bind', WRAP_BIND_FLAG],
['bindKey', WRAP_BIND_KEY_FLAG],
@@ -35,7 +35,7 @@ var wrapFlags = [
*/
function updateWrapDetails(details, bitmask) {
arrayEach(wrapFlags, pair => {
var value = `_.${ pair[0] }`;
const value = `_.${ pair[0] }`;
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
details.push(value);
}

View File

@@ -13,7 +13,7 @@ function wrapperClone(wrapper) {
if (wrapper instanceof LazyWrapper) {
return wrapper.clone();
}
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
const result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
result.__actions__ = copyArray(wrapper.__actions__);
result.__index__ = wrapper.__index__;
result.__values__ = wrapper.__values__;

2
add.js
View File

@@ -15,6 +15,6 @@ import createMathOperation from './_createMathOperation.js';
* _.add(6, 4);
* // => 10
*/
var add = createMathOperation((augend, addend) => augend + addend, 0);
const add = createMathOperation((augend, addend) => augend + addend, 0);
export default add;

View File

@@ -1,7 +1,7 @@
import toInteger from './toInteger.js';
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
const FUNC_ERROR_TEXT = 'Expected a function';
/**
* The opposite of `_.before`; this method creates a function that invokes

2
ary.js
View File

@@ -1,7 +1,7 @@
import createWrap from './_createWrap.js';
/** Used to compose bitmasks for function metadata. */
var WRAP_ARY_FLAG = 128;
const WRAP_ARY_FLAG = 128;
/**
* Creates a function that invokes `func`, with up to `n` arguments,

View File

@@ -33,7 +33,7 @@ import keysIn from './keysIn.js';
* _.assignIn({ 'a': 0 }, new Foo, new Bar);
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
*/
var assignIn = createAssigner((object, source) => {
const assignIn = createAssigner((object, source) => {
copyObject(source, keysIn(source), object);
});

View File

@@ -31,7 +31,7 @@ import keysIn from './keysIn.js';
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var assignInWith = createAssigner((object, source, srcIndex, customizer) => {
const assignInWith = createAssigner((object, source, srcIndex, customizer) => {
copyObject(source, keysIn(source), object, customizer);
});

View File

@@ -30,7 +30,7 @@ import keys from './keys.js';
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var assignWith = createAssigner((object, source, srcIndex, customizer) => {
const assignWith = createAssigner((object, source, srcIndex, customizer) => {
copyObject(source, keys(source), object, customizer);
});

2
at.js
View File

@@ -18,6 +18,6 @@ import flatRest from './_flatRest.js';
* _.at(object, ['a[0].b.c', 'a[1]']);
* // => [3, 4]
*/
var at = flatRest(baseAt);
const at = flatRest(baseAt);
export default at;

View File

@@ -24,7 +24,7 @@ import isError from './isError.js';
* elements = [];
* }
*/
var attempt = baseRest((func, args) => {
const attempt = baseRest((func, args) => {
try {
return apply(func, undefined, args);
} catch (e) {

View File

@@ -1,7 +1,7 @@
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 and arguments
@@ -21,7 +21,7 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* // => Allows adding up to 4 contacts to the list.
*/
function before(n, func) {
var result;
let result;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}

11
bind.js
View File

@@ -4,8 +4,8 @@ import getHolder from './_getHolder.js';
import replaceHolders from './_replaceHolders.js';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_PARTIAL_FLAG = 32;
const WRAP_BIND_FLAG = 1;
const WRAP_PARTIAL_FLAG = 32;
/**
* Creates a function that invokes `func` with the `this` binding of `thisArg`
@@ -42,10 +42,11 @@ var WRAP_BIND_FLAG = 1,
* bound('hi');
* // => 'hi fred!'
*/
var bind = baseRest((func, thisArg, partials) => {
var bitmask = WRAP_BIND_FLAG;
const bind = baseRest((func, thisArg, partials) => {
let holders;
let bitmask = WRAP_BIND_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bind));
holders = replaceHolders(partials, getHolder(bind));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(func, bitmask, thisArg, partials, holders);

View File

@@ -30,7 +30,7 @@ import toKey from './_toKey.js';
* jQuery(element).on('click', view.click);
* // => Logs 'clicked docs' when clicked.
*/
var bindAll = flatRest((object, methodNames) => {
const bindAll = flatRest((object, methodNames) => {
arrayEach(methodNames, key => {
key = toKey(key);
baseAssignValue(object, key, bind(object[key], object));

View File

@@ -4,9 +4,9 @@ import getHolder from './_getHolder.js';
import replaceHolders from './_replaceHolders.js';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_PARTIAL_FLAG = 32;
const WRAP_BIND_FLAG = 1;
const WRAP_BIND_KEY_FLAG = 2;
const WRAP_PARTIAL_FLAG = 32;
/**
* Creates a function that invokes the method at `object[key]` with `partials`
@@ -53,10 +53,11 @@ var WRAP_BIND_FLAG = 1,
* bound('hi');
* // => 'hiya fred!'
*/
var bindKey = baseRest((object, key, partials) => {
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
const bindKey = baseRest((object, key, partials) => {
let holders;
let bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(key, bitmask, object, partials, holders);

View File

@@ -21,7 +21,7 @@ import createCompounder from './_createCompounder.js';
* _.camelCase('__FOO_BAR__');
* // => 'fooBar'
*/
var camelCase = createCompounder((result, word, index) => {
const camelCase = createCompounder((result, word, index) => {
word = word.toLowerCase();
return result + (index ? capitalize(word) : word);
});

View File

@@ -37,7 +37,7 @@ function castArray(...args) {
if (!args.length) {
return [];
}
var value = args[0];
const value = args[0];
return isArray(value) ? value : [value];
}

View File

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

View File

@@ -3,8 +3,8 @@ import isIterateeCall from './_isIterateeCall.js';
import toInteger from './toInteger.js';
/* 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;
/**
* Creates an array of elements split into groups the length of `size`.
@@ -33,13 +33,13 @@ function chunk(array, size, guard) {
} else {
size = nativeMax(toInteger(size), 0);
}
var length = array == null ? 0 : array.length;
const length = array == null ? 0 : array.length;
if (!length || size < 1) {
return [];
}
var index = 0,
resIndex = 0,
result = Array(nativeCeil(length / size));
let index = 0;
let resIndex = 0;
const result = Array(nativeCeil(length / size));
while (index < length) {
result[resIndex++] = baseSlice(array, index, (index += size));

View File

@@ -1,7 +1,7 @@
import baseClone from './_baseClone.js';
/** Used to compose bitmasks for cloning. */
var CLONE_SYMBOLS_FLAG = 4;
const CLONE_SYMBOLS_FLAG = 4;
/**
* Creates a shallow clone of `value`.

View File

@@ -1,8 +1,8 @@
import baseClone from './_baseClone.js';
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_SYMBOLS_FLAG = 4;
const CLONE_DEEP_FLAG = 1;
const CLONE_SYMBOLS_FLAG = 4;
/**
* This method is like `_.clone` except that it recursively clones `value`.

View File

@@ -1,8 +1,8 @@
import baseClone from './_baseClone.js';
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_SYMBOLS_FLAG = 4;
const CLONE_DEEP_FLAG = 1;
const CLONE_SYMBOLS_FLAG = 4;
/**
* This method is like `_.cloneWith` except that it recursively clones `value`.

View File

@@ -1,7 +1,7 @@
import baseClone from './_baseClone.js';
/** Used to compose bitmasks for cloning. */
var CLONE_SYMBOLS_FLAG = 4;
const CLONE_SYMBOLS_FLAG = 4;
/**
* This method is like `_.clone` except that it accepts `customizer` which

View File

@@ -14,13 +14,13 @@
* // => [1, 2, 3]
*/
function compact(array) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
let index = -1;
const length = array == null ? 0 : array.length;
let resIndex = 0;
const result = [];
while (++index < length) {
var value = array[index];
const value = array[index];
if (value) {
result[resIndex++] = value;
}

View File

@@ -26,13 +26,13 @@ import isArray from './isArray.js';
* // => [1]
*/
function concat() {
var length = arguments.length;
const length = arguments.length;
if (!length) {
return [];
}
var args = Array(length - 1),
array = arguments[0],
index = length;
const args = Array(length - 1);
const array = arguments[0];
let index = length;
while (index--) {
args[index - 1] = arguments[index];

10
cond.js
View File

@@ -4,7 +4,7 @@ import baseIteratee from './_baseIteratee.js';
import baseRest from './_baseRest.js';
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
const FUNC_ERROR_TEXT = 'Expected a function';
/**
* Creates a function that iterates over `pairs` and invokes the corresponding
@@ -36,8 +36,8 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* // => 'no match'
*/
function cond(pairs) {
var length = pairs == null ? 0 : pairs.length,
toIteratee = baseIteratee;
const length = pairs == null ? 0 : pairs.length;
const toIteratee = baseIteratee;
pairs = !length ? [] : arrayMap(pairs, pair => {
if (typeof pair[1] != 'function') {
@@ -47,9 +47,9 @@ function cond(pairs) {
});
return baseRest(function(args) {
var index = -1;
let index = -1;
while (++index < length) {
var pair = pairs[index];
const pair = pairs[index];
if (apply(pair[0], this, args)) {
return apply(pair[1], this, args);
}

View File

@@ -2,7 +2,7 @@ import baseClone from './_baseClone.js';
import baseConforms from './_baseConforms.js';
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1;
const CLONE_DEEP_FLAG = 1;
/**
* Creates a function that invokes the predicate properties of `source` with

View File

@@ -2,10 +2,10 @@ import baseAssignValue from './_baseAssignValue.js';
import createAggregator from './_createAggregator.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 object composed of keys generated from the results of running
@@ -29,7 +29,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* _.countBy(['one', 'two', 'three'], 'length');
* // => { '3': 2, '5': 1 }
*/
var countBy = createAggregator((result, value, key) => {
const countBy = createAggregator((result, value, key) => {
if (hasOwnProperty.call(result, key)) {
++result[key];
} else {

View File

@@ -36,7 +36,7 @@ import baseCreate from './_baseCreate.js';
* // => true
*/
function create(prototype, properties) {
var result = baseCreate(prototype);
const result = baseCreate(prototype);
return properties == null ? result : baseAssign(result, properties);
}

View File

@@ -1,7 +1,7 @@
import createWrap from './_createWrap.js';
/** Used to compose bitmasks for function metadata. */
var WRAP_CURRY_FLAG = 8;
const WRAP_CURRY_FLAG = 8;
/**
* Creates a function that accepts arguments of `func` and either invokes
@@ -46,7 +46,7 @@ var WRAP_CURRY_FLAG = 8;
*/
function curry(func, arity, guard) {
arity = guard ? undefined : arity;
var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
const result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curry.placeholder;
return result;
}

View File

@@ -1,7 +1,7 @@
import createWrap from './_createWrap.js';
/** Used to compose bitmasks for function metadata. */
var WRAP_CURRY_RIGHT_FLAG = 16;
const WRAP_CURRY_RIGHT_FLAG = 16;
/**
* This method is like `_.curry` except that arguments are applied to `func`
@@ -43,7 +43,7 @@ var WRAP_CURRY_RIGHT_FLAG = 16;
*/
function curryRight(func, arity, guard) {
arity = guard ? undefined : arity;
var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
const result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curryRight.placeholder;
return result;
}

View File

@@ -3,11 +3,11 @@ import now from './now.js';
import toNumber from './toNumber.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,
nativeMin = Math.min;
const nativeMax = Math.max;
const nativeMin = Math.min;
/**
* Creates a debounced function that delays invoking `func` until after `wait`
@@ -64,16 +64,17 @@ var nativeMax = Math.max,
* jQuery(window).on('popstate', debounced.cancel);
*/
function debounce(func, wait, options) {
var lastArgs,
let lastArgs,
lastThis,
maxWait,
result,
timerId,
lastCallTime,
lastInvokeTime = 0,
leading = false,
maxing = false,
trailing = true;
lastCallTime;
let lastInvokeTime = 0;
let leading = false;
let maxing = false;
let trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
@@ -87,8 +88,8 @@ function debounce(func, wait, options) {
}
function invokeFunc(time) {
var args = lastArgs,
thisArg = lastThis;
const args = lastArgs;
const thisArg = lastThis;
lastArgs = lastThis = undefined;
lastInvokeTime = time;
@@ -106,16 +107,16 @@ function debounce(func, wait, options) {
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime,
result = wait - timeSinceLastCall;
const timeSinceLastCall = time - lastCallTime;
const timeSinceLastInvoke = time - lastInvokeTime;
const result = wait - timeSinceLastCall;
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime;
const timeSinceLastCall = time - lastCallTime;
const timeSinceLastInvoke = time - lastInvokeTime;
// Either this is the first call, activity has stopped and we're at the
// trailing edge, the system time has gone backwards and we're treating
@@ -125,7 +126,7 @@ function debounce(func, wait, options) {
}
function timerExpired() {
var time = now();
const time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
@@ -158,8 +159,8 @@ function debounce(func, wait, options) {
}
function debounced(...args) {
var time = now(),
isInvoking = shouldInvoke(time);
const time = now();
const isInvoking = shouldInvoke(time);
lastArgs = args;
lastThis = this;

View File

@@ -24,7 +24,7 @@ import customDefaultsAssignIn from './_customDefaultsAssignIn.js';
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var defaults = baseRest(args => {
const defaults = baseRest(args => {
args.push(undefined, customDefaultsAssignIn);
return apply(assignInWith, undefined, args);
});

View File

@@ -22,7 +22,7 @@ import mergeWith from './mergeWith.js';
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
* // => { 'a': { 'b': 2, 'c': 3 } }
*/
var defaultsDeep = baseRest(args => {
const defaultsDeep = baseRest(args => {
args.push(undefined, customDefaultsMerge);
return apply(mergeWith, undefined, args);
});

View File

@@ -1,5 +1,4 @@
import baseDelay from './_baseDelay.js';
import baseRest from './_baseRest.js';
/**
* Defers invoking the `func` until the current call stack has cleared. Any
@@ -19,6 +18,8 @@ import baseRest from './_baseRest.js';
* }, 'deferred');
* // => Logs 'deferred' after one millisecond.
*/
var defer = baseRest((func, args) => baseDelay(func, 1, args));
function defer(func, ...args) {
return baseDelay(func, 1, args);
}
export default defer;

View File

@@ -1,5 +1,4 @@
import baseDelay from './_baseDelay.js';
import baseRest from './_baseRest.js';
import toNumber from './toNumber.js';
/**
@@ -21,6 +20,8 @@ import toNumber from './toNumber.js';
* }, 1000, 'later');
* // => Logs 'later' after one second.
*/
var delay = baseRest((func, wait, args) => baseDelay(func, toNumber(wait) || 0, args));
function delay(func, wait, ...args) {
return baseDelay(func, toNumber(wait) || 0, args);
}
export default delay;

View File

@@ -1,6 +1,5 @@
import baseDifference from './_baseDifference.js';
import baseFlatten from './_baseFlatten.js';
import baseRest from './_baseRest.js';
import isArrayLikeObject from './isArrayLikeObject.js';
/**
@@ -24,8 +23,10 @@ import isArrayLikeObject from './isArrayLikeObject.js';
* _.difference([2, 1], [2, 3]);
* // => [1]
*/
var difference = baseRest((array, values) => isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
: []);
function difference(array, ...values) {
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
: [];
}
export default difference;

View File

@@ -1,7 +1,6 @@
import baseDifference from './_baseDifference.js';
import baseFlatten from './_baseFlatten.js';
import baseIteratee from './_baseIteratee.js';
import baseRest from './_baseRest.js';
import isArrayLikeObject from './isArrayLikeObject.js';
import last from './last.js';
@@ -31,14 +30,14 @@ import last from './last.js';
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
* // => [{ 'x': 2 }]
*/
var differenceBy = baseRest((array, values) => {
var iteratee = last(values);
function differenceBy(array, ...values) {
let iteratee = last(values);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee, 2))
: [];
});
}
export default differenceBy;

View File

@@ -1,6 +1,5 @@
import baseDifference from './_baseDifference.js';
import baseFlatten from './_baseFlatten.js';
import baseRest from './_baseRest.js';
import isArrayLikeObject from './isArrayLikeObject.js';
import last from './last.js';
@@ -27,14 +26,14 @@ import last from './last.js';
* _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
* // => [{ 'x': 2, 'y': 1 }]
*/
var differenceWith = baseRest((array, values) => {
var comparator = last(values);
function differenceWith(array, ...values) {
let comparator = last(values);
if (isArrayLikeObject(comparator)) {
comparator = undefined;
}
return isArrayLikeObject(array)
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
: [];
});
}
export default differenceWith;

View File

@@ -15,6 +15,6 @@ import createMathOperation from './_createMathOperation.js';
* _.divide(6, 4);
* // => 1.5
*/
var divide = createMathOperation((dividend, divisor) => dividend / divisor, 1);
const divide = createMathOperation((dividend, divisor) => dividend / divisor, 1);
export default divide;

View File

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

View File

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

View File

@@ -30,12 +30,12 @@ function endsWith(string, target, position) {
string = toString(string);
target = baseToString(target);
var length = string.length;
const length = string.length;
position = position === undefined
? length
: baseClamp(toInteger(position), 0, length);
var end = position;
const end = position;
position -= target.length;
return position >= 0 && string.slice(position, end) == target;
}

View File

@@ -2,8 +2,8 @@ import escapeHtmlChar from './_escapeHtmlChar.js';
import toString from './toString.js';
/** Used to match HTML entities and HTML characters. */
var reUnescapedHtml = /[&<>"']/g,
reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
const reUnescapedHtml = /[&<>"']/g;
const reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
/**
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their

View File

@@ -4,8 +4,8 @@ import toString from './toString.js';
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source);
const reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
const reHasRegExpChar = RegExp(reRegExpChar.source);
/**
* Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",

View File

@@ -46,7 +46,7 @@ import isIterateeCall from './_isIterateeCall.js';
* // => false
*/
function every(collection, predicate, guard) {
var func = isArray(collection) ? arrayEvery : baseEvery;
const func = isArray(collection) ? arrayEvery : baseEvery;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined;
}

View File

@@ -31,7 +31,7 @@ import isIterateeCall from './_isIterateeCall.js';
* // => [4, '*', '*', 10]
*/
function fill(array, value, 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 isArray from './isArray.js';
* // => objects for ['barney']
*/
function filter(collection, predicate) {
var func = isArray(collection) ? arrayFilter : baseFilter;
const func = isArray(collection) ? arrayFilter : baseFilter;
return func(collection, baseIteratee(predicate, 3));
}

View File

@@ -37,6 +37,6 @@ import findIndex from './findIndex.js';
* _.find(users, 'active');
* // => object for 'barney'
*/
var find = createFind(findIndex);
const find = createFind(findIndex);
export default find;

View File

@@ -3,7 +3,7 @@ import baseIteratee from './_baseIteratee.js';
import toInteger from './toInteger.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
const nativeMax = Math.max;
/**
* This method is like `_.find` except that it returns the index of the first
@@ -41,11 +41,11 @@ var nativeMax = Math.max;
* // => 2
*/
function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
const length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
let index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}

View File

@@ -20,6 +20,6 @@ import findLastIndex from './findLastIndex.js';
* });
* // => 3
*/
var findLast = createFind(findLastIndex);
const findLast = createFind(findLastIndex);
export default findLast;

View File

@@ -3,8 +3,8 @@ import baseIteratee from './_baseIteratee.js';
import toInteger from './toInteger.js';
/* 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;
/**
* This method is like `_.findIndex` except that it iterates over elements
@@ -42,11 +42,11 @@ var nativeMax = Math.max,
* // => 0
*/
function findLastIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
const length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = length - 1;
let index = length - 1;
if (fromIndex !== undefined) {
index = toInteger(fromIndex);
index = fromIndex < 0

View File

@@ -2,7 +2,7 @@ import baseFlatten from './_baseFlatten.js';
import map from './map.js';
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
const INFINITY = 1 / 0;
/**
* This method is like `_.flatMap` except that it recursively flattens the

View File

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

View File

@@ -1,7 +1,7 @@
import baseFlatten from './_baseFlatten.js';
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
const INFINITY = 1 / 0;
/**
* Recursively flattens `array`.
@@ -18,7 +18,7 @@ var INFINITY = 1 / 0;
* // => [1, 2, 3, 4, 5]
*/
function flattenDeep(array) {
var length = array == null ? 0 : array.length;
const length = array == null ? 0 : array.length;
return length ? baseFlatten(array, INFINITY) : [];
}

View File

@@ -22,7 +22,7 @@ import toInteger from './toInteger.js';
* // => [1, 2, 3, [4], 5]
*/
function flattenDepth(array, depth) {
var length = array == null ? 0 : array.length;
const length = array == null ? 0 : array.length;
if (!length) {
return [];
}

View File

@@ -1,7 +1,7 @@
import createWrap from './_createWrap.js';
/** Used to compose bitmasks for function metadata. */
var WRAP_FLIP_FLAG = 512;
const WRAP_FLIP_FLAG = 512;
/**
* Creates a function that invokes `func` with arguments reversed.

View File

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

View File

@@ -22,6 +22,6 @@ import createFlow from './_createFlow.js';
* addSquare(1, 2);
* // => 9
*/
var flow = createFlow();
const flow = createFlow();
export default flow;

View File

@@ -21,6 +21,6 @@ import createFlow from './_createFlow.js';
* addSquare(1, 2);
* // => 9
*/
var flowRight = createFlow(true);
const flowRight = createFlow(true);
export default flowRight;

View File

@@ -34,7 +34,7 @@ import isArray from './isArray.js';
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forEach(collection, iteratee) {
var func = isArray(collection) ? arrayEach : baseEach;
const func = isArray(collection) ? arrayEach : baseEach;
return func(collection, castFunction(iteratee));
}

View File

@@ -24,7 +24,7 @@ import isArray from './isArray.js';
* // => Logs `2` then `1`.
*/
function forEachRight(collection, iteratee) {
var func = isArray(collection) ? arrayEachRight : baseEachRight;
const func = isArray(collection) ? arrayEachRight : baseEachRight;
return func(collection, castFunction(iteratee));
}

View File

@@ -14,12 +14,12 @@
* // => { 'a': 1, 'b': 2 }
*/
function fromPairs(pairs) {
var index = -1,
length = pairs == null ? 0 : pairs.length,
result = {};
let index = -1;
const length = pairs == null ? 0 : pairs.length;
const result = {};
while (++index < length) {
var pair = pairs[index];
const pair = pairs[index];
result[pair[0]] = pair[1];
}
return result;

2
get.js
View File

@@ -26,7 +26,7 @@ import baseGet from './_baseGet.js';
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
const result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}

View File

@@ -2,10 +2,10 @@ import baseAssignValue from './_baseAssignValue.js';
import createAggregator from './_createAggregator.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 object composed of keys generated from the results of running
@@ -30,7 +30,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* _.groupBy(['one', 'two', 'three'], 'length');
* // => { '3': ['one', 'two'], '5': ['three'] }
*/
var groupBy = createAggregator((result, value, key) => {
const groupBy = createAggregator((result, value, key) => {
if (hasOwnProperty.call(result, key)) {
result[key].push(value);
} else {

2
gt.js
View File

@@ -24,6 +24,6 @@ import createRelationalOperation from './_createRelationalOperation.js';
* _.gt(1, 3);
* // => false
*/
var gt = createRelationalOperation(baseGt);
const gt = createRelationalOperation(baseGt);
export default gt;

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