Remove semicolons.

This commit is contained in:
John-David Dalton
2017-02-04 23:50:10 -08:00
parent f3a8e55e70
commit 6cb3460fce
452 changed files with 4261 additions and 4261 deletions

View File

@@ -1,5 +1,5 @@
/** Used to stand-in for `undefined` hash values. */
const HASH_UNDEFINED = '__lodash_hash_undefined__';
const HASH_UNDEFINED = '__lodash_hash_undefined__'
class Hash {
@@ -11,13 +11,13 @@ class Hash {
* @param {Array} [entries] The key-value pairs to cache.
*/
constructor(entries) {
let index = -1;
const length = entries == null ? 0 : entries.length;
let index = -1
const length = entries == null ? 0 : entries.length
this.clear();
this.clear()
while (++index < length) {
const entry = entries[index];
this.set(entry[0], entry[1]);
const entry = entries[index]
this.set(entry[0], entry[1])
}
}
@@ -27,8 +27,8 @@ class Hash {
* @memberOf Hash
*/
clear() {
this.__data__ = Object.create(null);
this.size = 0;
this.__data__ = Object.create(null)
this.size = 0
}
/**
@@ -40,9 +40,9 @@ class Hash {
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
delete(key) {
const result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
const result = this.has(key) && delete this.__data__[key]
this.size -= result ? 1 : 0
return result
}
/**
@@ -53,9 +53,9 @@ class Hash {
* @returns {*} Returns the entry value.
*/
get(key) {
const data = this.__data__;
const result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
const data = this.__data__
const result = data[key]
return result === HASH_UNDEFINED ? undefined : result
}
/**
@@ -66,8 +66,8 @@ class Hash {
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
has(key) {
const data = this.__data__;
return data[key] !== undefined;
const data = this.__data__
return data[key] !== undefined
}
/**
@@ -79,11 +79,11 @@ class Hash {
* @returns {Object} Returns the hash instance.
*/
set(key, value) {
const data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = value === undefined ? HASH_UNDEFINED : value;
return this;
const data = this.__data__
this.size += this.has(key) ? 0 : 1
data[key] = value === undefined ? HASH_UNDEFINED : value
return this
}
}
export default Hash;
export default Hash

View File

@@ -1,7 +1,7 @@
import assocIndexOf from './assocIndexOf.js';
import assocIndexOf from './assocIndexOf.js'
/** Built-in value references. */
const splice = Array.prototype.splice;
const splice = Array.prototype.splice
class ListCache {
@@ -13,13 +13,13 @@ class ListCache {
* @param {Array} [entries] The key-value pairs to cache.
*/
constructor(entries) {
let index = -1;
const length = entries == null ? 0 : entries.length;
let index = -1
const length = entries == null ? 0 : entries.length
this.clear();
this.clear()
while (++index < length) {
const entry = entries[index];
this.set(entry[0], entry[1]);
const entry = entries[index]
this.set(entry[0], entry[1])
}
}
@@ -29,8 +29,8 @@ class ListCache {
* @memberOf ListCache
*/
clear() {
this.__data__ = [];
this.size = 0;
this.__data__ = []
this.size = 0
}
/**
@@ -41,20 +41,20 @@ class ListCache {
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
delete(key) {
const data = this.__data__;
const index = assocIndexOf(data, key);
const data = this.__data__
const index = assocIndexOf(data, key)
if (index < 0) {
return false;
return false
}
const lastIndex = data.length - 1;
const lastIndex = data.length - 1
if (index == lastIndex) {
data.pop();
data.pop()
} else {
splice.call(data, index, 1);
splice.call(data, index, 1)
}
--this.size;
return true;
--this.size
return true
}
/**
@@ -65,9 +65,9 @@ class ListCache {
* @returns {*} Returns the entry value.
*/
get(key) {
const data = this.__data__;
const index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
const data = this.__data__
const index = assocIndexOf(data, key)
return index < 0 ? undefined : data[index][1]
}
/**
@@ -78,7 +78,7 @@ class ListCache {
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
has(key) {
return assocIndexOf(this.__data__, key) > -1;
return assocIndexOf(this.__data__, key) > -1
}
/**
@@ -90,17 +90,17 @@ class ListCache {
* @returns {Object} Returns the list cache instance.
*/
set(key, value) {
const data = this.__data__;
const index = assocIndexOf(data, key);
const data = this.__data__
const index = assocIndexOf(data, key)
if (index < 0) {
++this.size;
data.push([key, value]);
++this.size
data.push([key, value])
} else {
data[index][1] = value;
data[index][1] = value
}
return this;
return this
}
}
export default ListCache;
export default ListCache

View File

@@ -1,6 +1,6 @@
import Hash from './Hash.js';
import ListCache from './ListCache.js';
import Hash from './Hash.js'
import ListCache from './ListCache.js'
/**
* Gets the data for `map`.
@@ -11,10 +11,10 @@ import ListCache from './ListCache.js';
* @returns {*} Returns the map data.
*/
function getMapData({ __data__ }, key) {
const data = __data__;
const data = __data__
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
: data.map
}
/**
@@ -25,10 +25,10 @@ function getMapData({ __data__ }, key) {
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
const type = typeof value;
const type = typeof value
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
: (value === null)
}
class MapCache {
@@ -41,13 +41,13 @@ class MapCache {
* @param {Array} [entries] The key-value pairs to cache.
*/
constructor(entries) {
let index = -1;
const length = entries == null ? 0 : entries.length;
let index = -1
const length = entries == null ? 0 : entries.length
this.clear();
this.clear()
while (++index < length) {
const entry = entries[index];
this.set(entry[0], entry[1]);
const entry = entries[index]
this.set(entry[0], entry[1])
}
}
@@ -57,12 +57,12 @@ class MapCache {
* @memberOf MapCache
*/
clear() {
this.size = 0;
this.size = 0
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
}
/**
@@ -73,9 +73,9 @@ class MapCache {
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
delete(key) {
const result = getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
const result = getMapData(this, key)['delete'](key)
this.size -= result ? 1 : 0
return result
}
/**
@@ -86,7 +86,7 @@ class MapCache {
* @returns {*} Returns the entry value.
*/
get(key) {
return getMapData(this, key).get(key);
return getMapData(this, key).get(key)
}
/**
@@ -97,7 +97,7 @@ class MapCache {
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
has(key) {
return getMapData(this, key).has(key);
return getMapData(this, key).has(key)
}
/**
@@ -109,13 +109,13 @@ class MapCache {
* @returns {Object} Returns the map cache instance.
*/
set(key, value) {
const data = getMapData(this, key);
const size = data.size;
const data = getMapData(this, key)
const size = data.size
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
data.set(key, value)
this.size += data.size == size ? 0 : 1
return this
}
}
export default MapCache;
export default MapCache

View File

@@ -1,7 +1,7 @@
import MapCache from './MapCache.js';
import MapCache from './MapCache.js'
/** Used to stand-in for `undefined` hash values. */
const HASH_UNDEFINED = '__lodash_hash_undefined__';
const HASH_UNDEFINED = '__lodash_hash_undefined__'
class SetCache {
@@ -13,12 +13,12 @@ class SetCache {
* @param {Array} [values] The values to cache.
*/
constructor(values) {
let index = -1;
const length = values == null ? 0 : values.length;
let index = -1
const length = values == null ? 0 : values.length
this.__data__ = new MapCache;
this.__data__ = new MapCache
while (++index < length) {
this.add(values[index]);
this.add(values[index])
}
}
@@ -31,8 +31,8 @@ class SetCache {
* @returns {Object} Returns the cache instance.
*/
add(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
this.__data__.set(value, HASH_UNDEFINED)
return this
}
/**
@@ -43,10 +43,10 @@ class SetCache {
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
has(value) {
return this.__data__.has(value);
return this.__data__.has(value)
}
}
SetCache.prototype.push = SetCache.prototype.add;
SetCache.prototype.push = SetCache.prototype.add
export default SetCache;
export default SetCache

View File

@@ -1,8 +1,8 @@
import ListCache from './ListCache.js';
import MapCache from './MapCache.js';
import ListCache from './ListCache.js'
import MapCache from './MapCache.js'
/** Used as the size to enable large array optimizations. */
const LARGE_ARRAY_SIZE = 200;
const LARGE_ARRAY_SIZE = 200
class Stack {
@@ -14,8 +14,8 @@ class Stack {
* @param {Array} [entries] The key-value pairs to cache.
*/
constructor(entries) {
const data = this.__data__ = new ListCache(entries);
this.size = data.size;
const data = this.__data__ = new ListCache(entries)
this.size = data.size
}
/**
@@ -24,8 +24,8 @@ class Stack {
* @memberOf Stack
*/
clear() {
this.__data__ = new ListCache;
this.size = 0;
this.__data__ = new ListCache
this.size = 0
}
/**
@@ -36,11 +36,11 @@ class Stack {
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
delete(key) {
const data = this.__data__;
const result = data['delete'](key);
const data = this.__data__
const result = data['delete'](key)
this.size = data.size;
return result;
this.size = data.size
return result
}
/**
@@ -51,7 +51,7 @@ class Stack {
* @returns {*} Returns the entry value.
*/
get(key) {
return this.__data__.get(key);
return this.__data__.get(key)
}
/**
@@ -62,7 +62,7 @@ class Stack {
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
has(key) {
return this.__data__.has(key);
return this.__data__.has(key)
}
/**
@@ -74,20 +74,20 @@ class Stack {
* @returns {Object} Returns the stack cache instance.
*/
set(key, value) {
let data = this.__data__;
let data = this.__data__
if (data instanceof ListCache) {
const pairs = data.__data__;
const pairs = data.__data__
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
pairs.push([key, value])
this.size = ++data.size
return this
}
data = this.__data__ = new MapCache(pairs);
data = this.__data__ = new MapCache(pairs)
}
data.set(key, value);
this.size = data.size;
return this;
data.set(key, value)
this.size = data.size
return this
}
}
export default Stack;
export default Stack

View File

@@ -8,8 +8,8 @@
*/
function addMapEntry(map, pair) {
// Don't return `map.set` because it's not chainable in IE 11.
map.set(pair[0], pair[1]);
return map;
map.set(pair[0], pair[1])
return map
}
export default addMapEntry;
export default addMapEntry

View File

@@ -8,8 +8,8 @@
*/
function addSetEntry(set, value) {
// Don't return `set.add` because it's not chainable in IE 11.
set.add(value);
return set;
set.add(value)
return set
}
export default addSetEntry;
export default addSetEntry

View File

@@ -10,12 +10,12 @@
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
case 0: return func.call(thisArg)
case 1: return func.call(thisArg, args[0])
case 2: return func.call(thisArg, args[0], args[1])
case 3: return func.call(thisArg, args[0], args[1], args[2])
}
return func.apply(thisArg, args);
return func.apply(thisArg, args)
}
export default apply;
export default apply

View File

@@ -7,15 +7,15 @@
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
let index = -1;
const 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) {
break;
break
}
}
return array;
return array
}
export default arrayEach;
export default arrayEach

View File

@@ -7,14 +7,14 @@
* @returns {Array} Returns `array`.
*/
function arrayEachRight(array, iteratee) {
let length = array == null ? 0 : array.length;
let length = array == null ? 0 : array.length
while (length--) {
if (iteratee(array[length], length, array) === false) {
break;
break
}
}
return array;
return array
}
export default arrayEachRight;
export default arrayEachRight

View File

@@ -8,15 +8,15 @@
* else `false`.
*/
function arrayEvery(array, predicate) {
let index = -1;
const 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)) {
return false;
return false
}
}
return true;
return true
}
export default arrayEvery;
export default arrayEvery

View File

@@ -7,18 +7,18 @@
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
let index = -1;
let resIndex = 0;
const length = array == null ? 0 : array.length;
const result = [];
let index = -1
let resIndex = 0
const length = array == null ? 0 : array.length
const result = []
while (++index < length) {
const value = array[index];
const value = array[index]
if (predicate(value, index, array)) {
result[resIndex++] = value;
result[resIndex++] = value
}
}
return result;
return result
}
export default arrayFilter;
export default arrayFilter

View File

@@ -1,4 +1,4 @@
import baseIndexOf from './baseIndexOf.js';
import baseIndexOf from './baseIndexOf.js'
/**
* A specialized version of `includes` for arrays without support for
@@ -10,8 +10,8 @@ import baseIndexOf from './baseIndexOf.js';
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
const length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
const length = array == null ? 0 : array.length
return !!length && baseIndexOf(array, value, 0) > -1
}
export default arrayIncludes;
export default arrayIncludes

View File

@@ -8,15 +8,15 @@
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
let index = -1;
const length = array == null ? 0 : array.length;
let index = -1
const length = array == null ? 0 : array.length
while (++index < length) {
if (comparator(value, array[index])) {
return true;
return true
}
}
return false;
return false
}
export default arrayIncludesWith;
export default arrayIncludesWith

View File

@@ -1,11 +1,11 @@
import baseTimes from './baseTimes.js';
import isArguments from '../isArguments.js';
import isBuffer from '../isBuffer.js';
import isIndex from './isIndex.js';
import isTypedArray from '../isTypedArray.js';
import baseTimes from './baseTimes.js'
import isArguments from '../isArguments.js'
import isBuffer from '../isBuffer.js'
import isIndex from './isIndex.js'
import isTypedArray from '../isTypedArray.js'
/** Used to check objects for own properties. */
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwnProperty = Object.prototype.hasOwnProperty
/**
* Creates an array of the enumerable property names of the array-like `value`.
@@ -16,13 +16,13 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
const isArr = Array.isArray(value);
const isArg = !isArr && isArguments(value);
const isBuff = !isArr && !isArg && isBuffer(value);
const isType = !isArr && !isArg && !isBuff && isTypedArray(value);
const skipIndexes = isArr || isArg || isBuff || isType;
const result = skipIndexes ? baseTimes(value.length, String) : [];
const length = result.length;
const isArr = Array.isArray(value)
const isArg = !isArr && isArguments(value)
const isBuff = !isArr && !isArg && isBuffer(value)
const isType = !isArr && !isArg && !isBuff && isTypedArray(value)
const skipIndexes = isArr || isArg || isBuff || isType
const result = skipIndexes ? baseTimes(value.length, String) : []
const length = result.length
for (const key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
@@ -35,10 +35,10 @@ function arrayLikeKeys(value, inherited) {
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || // Skip index properties.
isIndex(key, length))
))) {
result.push(key);
result.push(key)
}
}
return result;
return result
}
export default arrayLikeKeys;
export default arrayLikeKeys

View File

@@ -7,14 +7,14 @@
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
let index = -1;
const length = array == null ? 0 : array.length;
const 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);
result[index] = iteratee(array[index], index, array)
}
return result;
return result
}
export default arrayMap;
export default arrayMap

View File

@@ -7,14 +7,14 @@
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
let index = -1;
const length = values.length;
const offset = array.length;
let index = -1
const length = values.length
const offset = array.length
while (++index < length) {
array[offset + index] = values[index];
array[offset + index] = values[index]
}
return array;
return array
}
export default arrayPush;
export default arrayPush

View File

@@ -10,16 +10,16 @@
* @returns {*} Returns the accumulated value.
*/
function arrayReduce(array, iteratee, accumulator, initAccum) {
let index = -1;
const length = array == null ? 0 : array.length;
let index = -1
const length = array == null ? 0 : array.length
if (initAccum && length) {
accumulator = array[++index];
accumulator = array[++index]
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
accumulator = iteratee(accumulator, array[index], index, array)
}
return accumulator;
return accumulator
}
export default arrayReduce;
export default arrayReduce

View File

@@ -10,14 +10,14 @@
* @returns {*} Returns the accumulated value.
*/
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
let length = array == null ? 0 : array.length;
let length = array == null ? 0 : array.length
if (initAccum && length) {
accumulator = array[--length];
accumulator = array[--length]
}
while (length--) {
accumulator = iteratee(accumulator, array[length], length, array);
accumulator = iteratee(accumulator, array[length], length, array)
}
return accumulator;
return accumulator
}
export default arrayReduceRight;
export default arrayReduceRight

View File

@@ -1,4 +1,4 @@
import baseRandom from './baseRandom.js';
import baseRandom from './baseRandom.js'
/**
* A specialized version of `sample` for arrays.
@@ -8,8 +8,8 @@ import baseRandom from './baseRandom.js';
* @returns {*} Returns the random element.
*/
function arraySample(array) {
const length = array.length;
return length ? array[baseRandom(0, length - 1)] : undefined;
const length = array.length
return length ? array[baseRandom(0, length - 1)] : undefined
}
export default arraySample;
export default arraySample

View File

@@ -1,6 +1,6 @@
import baseClamp from './baseClamp.js';
import copyArray from './copyArray.js';
import shuffleSelf from './shuffleSelf.js';
import baseClamp from './baseClamp.js'
import copyArray from './copyArray.js'
import shuffleSelf from './shuffleSelf.js'
/**
* A specialized version of `sampleSize` for arrays.
@@ -11,7 +11,7 @@ import shuffleSelf from './shuffleSelf.js';
* @returns {Array} Returns the random elements.
*/
function arraySampleSize(array, n) {
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length))
}
export default arraySampleSize;
export default arraySampleSize

View File

@@ -1,5 +1,5 @@
import copyArray from './copyArray.js';
import shuffleSelf from './shuffleSelf.js';
import copyArray from './copyArray.js'
import shuffleSelf from './shuffleSelf.js'
/**
* A specialized version of `shuffle` for arrays.
@@ -9,7 +9,7 @@ import shuffleSelf from './shuffleSelf.js';
* @returns {Array} Returns the new shuffled array.
*/
function arrayShuffle(array) {
return shuffleSelf(copyArray(array));
return shuffleSelf(copyArray(array))
}
export default arrayShuffle;
export default arrayShuffle

View File

@@ -8,15 +8,15 @@
* else `false`.
*/
function arraySome(array, predicate) {
let index = -1;
const 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)) {
return true;
return true
}
}
return false;
return false
}
export default arraySome;
export default arraySome

View File

@@ -6,7 +6,7 @@
* @returns {number} Returns the string size.
*/
function asciiSize({ length }) {
return length;
return length
}
export default asciiSize;
export default asciiSize

View File

@@ -6,7 +6,7 @@
* @returns {Array} Returns the converted array.
*/
function asciiToArray(string) {
return string.split('');
return string.split('')
}
export default asciiToArray;
export default asciiToArray

View File

@@ -1,5 +1,5 @@
/** Used to match words composed of alphanumeric characters. */
const 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.
@@ -9,7 +9,7 @@ const reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
* @returns {Array} Returns the words of `string`.
*/
function asciiWords(string) {
return string.match(reAsciiWord) || [];
return string.match(reAsciiWord) || []
}
export default asciiWords;
export default asciiWords

View File

@@ -1,5 +1,5 @@
import baseAssignValue from './baseAssignValue.js';
import eq from '../eq.js';
import baseAssignValue from './baseAssignValue.js'
import eq from '../eq.js'
/**
* This function is like `assignValue` except that it doesn't assign
@@ -13,8 +13,8 @@ import eq from '../eq.js';
function assignMergeValue(object, key, value) {
if ((value !== undefined && !eq(object[key], value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
baseAssignValue(object, key, value)
}
}
export default assignMergeValue;
export default assignMergeValue

View File

@@ -1,8 +1,8 @@
import baseAssignValue from './baseAssignValue.js';
import eq from '../eq.js';
import baseAssignValue from './baseAssignValue.js'
import eq from '../eq.js'
/** Used to check objects for own properties. */
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwnProperty = Object.prototype.hasOwnProperty
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
@@ -15,11 +15,11 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
const objValue = object[key];
const objValue = object[key]
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
baseAssignValue(object, key, value)
}
}
export default assignValue;
export default assignValue

View File

@@ -1,4 +1,4 @@
import eq from '../eq.js';
import eq from '../eq.js'
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
@@ -9,13 +9,13 @@ import eq from '../eq.js';
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
let length = array.length;
let length = array.length
while (length--) {
if (eq(array[length][0], key)) {
return length;
return length
}
}
return -1;
return -1
}
export default assocIndexOf;
export default assocIndexOf

View File

@@ -1,5 +1,5 @@
import copyObject from './copyObject.js';
import keys from '../keys.js';
import copyObject from './copyObject.js'
import keys from '../keys.js'
/**
* The base implementation of `assign` without support for multiple sources
@@ -11,7 +11,7 @@ import keys from '../keys.js';
* @returns {Object} Returns `object`.
*/
function baseAssign(object, source) {
return object && copyObject(source, keys(source), object);
return object && copyObject(source, keys(source), object)
}
export default baseAssign;
export default baseAssign

View File

@@ -1,5 +1,5 @@
import copyObject from './copyObject.js';
import keysIn from '../keysIn.js';
import copyObject from './copyObject.js'
import keysIn from '../keysIn.js'
/**
* The base implementation of `assignIn` without support for multiple sources
@@ -11,7 +11,7 @@ import keysIn from '../keysIn.js';
* @returns {Object} Returns `object`.
*/
function baseAssignIn(object, source) {
return object && copyObject(source, keysIn(source), object);
return object && copyObject(source, keysIn(source), object)
}
export default baseAssignIn;
export default baseAssignIn

View File

@@ -14,10 +14,10 @@ function baseAssignValue(object, key, value) {
'enumerable': true,
'value': value,
'writable': true
});
})
} else {
object[key] = value;
object[key] = value
}
}
export default baseAssignValue;
export default baseAssignValue

View File

@@ -1,4 +1,4 @@
import get from '../get.js';
import get from '../get.js'
/**
* The base implementation of `at` without support for individual paths.
@@ -9,15 +9,15 @@ import get from '../get.js';
* @returns {Array} Returns the picked elements.
*/
function baseAt(object, paths) {
let index = -1;
const length = paths.length;
const result = Array(length);
const 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]);
result[index] = skip ? undefined : get(object, paths[index])
}
return result;
return result
}
export default baseAt;
export default baseAt

View File

@@ -9,10 +9,10 @@
*/
function baseClamp(number, lower, upper) {
if (number === number) {
number = number <= upper ? number : upper;
number = number >= lower ? number : lower;
number = number <= upper ? number : upper
number = number >= lower ? number : lower
}
return number;
return number
}
export default baseClamp;
export default baseClamp

View File

@@ -1,67 +1,67 @@
import Stack from './Stack.js';
import arrayEach from './arrayEach.js';
import assignValue from './assignValue.js';
import baseAssign from './baseAssign.js';
import baseAssignIn from './baseAssignIn.js';
import baseCreate from './baseCreate.js';
import cloneBuffer from './cloneBuffer.js';
import copyArray from './copyArray.js';
import cloneArrayBuffer from './cloneArrayBuffer.js';
import cloneDataView from './cloneDataView.js';
import cloneMap from './cloneMap.js';
import cloneRegExp from './cloneRegExp.js';
import cloneSet from './cloneSet.js';
import cloneSymbol from './cloneSymbol.js';
import cloneTypedArray from './cloneTypedArray.js';
import copySymbols from './copySymbols.js';
import copySymbolsIn from './copySymbolsIn.js';
import getAllKeys from './getAllKeys.js';
import getAllKeysIn from './getAllKeysIn.js';
import getTag from './getTag.js';
import initCloneArray from './initCloneArray.js';
import initCloneByTag from './initCloneByTag.js';
import initCloneObject from './initCloneObject.js';
import isBuffer from '../isBuffer.js';
import isObject from '../isObject.js';
import isPrototype from './isPrototype.js';
import keys from '../keys.js';
import Stack from './Stack.js'
import arrayEach from './arrayEach.js'
import assignValue from './assignValue.js'
import baseAssign from './baseAssign.js'
import baseAssignIn from './baseAssignIn.js'
import baseCreate from './baseCreate.js'
import cloneBuffer from './cloneBuffer.js'
import copyArray from './copyArray.js'
import cloneArrayBuffer from './cloneArrayBuffer.js'
import cloneDataView from './cloneDataView.js'
import cloneMap from './cloneMap.js'
import cloneRegExp from './cloneRegExp.js'
import cloneSet from './cloneSet.js'
import cloneSymbol from './cloneSymbol.js'
import cloneTypedArray from './cloneTypedArray.js'
import copySymbols from './copySymbols.js'
import copySymbolsIn from './copySymbolsIn.js'
import getAllKeys from './getAllKeys.js'
import getAllKeysIn from './getAllKeysIn.js'
import getTag from './getTag.js'
import initCloneArray from './initCloneArray.js'
import initCloneByTag from './initCloneByTag.js'
import initCloneObject from './initCloneObject.js'
import isBuffer from '../isBuffer.js'
import isObject from '../isObject.js'
import isPrototype from './isPrototype.js'
import keys from '../keys.js'
/** Used to compose bitmasks for cloning. */
const CLONE_DEEP_FLAG = 1;
const CLONE_FLAT_FLAG = 2;
const CLONE_SYMBOLS_FLAG = 4;
const CLONE_DEEP_FLAG = 1
const CLONE_FLAT_FLAG = 2
const CLONE_SYMBOLS_FLAG = 4
/** `Object#toString` result references. */
const argsTag = '[object Arguments]';
const arrayTag = '[object Array]';
const boolTag = '[object Boolean]';
const dateTag = '[object Date]';
const errorTag = '[object Error]';
const funcTag = '[object Function]';
const genTag = '[object GeneratorFunction]';
const mapTag = '[object Map]';
const numberTag = '[object Number]';
const objectTag = '[object Object]';
const regexpTag = '[object RegExp]';
const setTag = '[object Set]';
const stringTag = '[object String]';
const symbolTag = '[object Symbol]';
const weakMapTag = '[object WeakMap]';
const argsTag = '[object Arguments]'
const arrayTag = '[object Array]'
const boolTag = '[object Boolean]'
const dateTag = '[object Date]'
const errorTag = '[object Error]'
const funcTag = '[object Function]'
const genTag = '[object GeneratorFunction]'
const mapTag = '[object Map]'
const numberTag = '[object Number]'
const objectTag = '[object Object]'
const regexpTag = '[object RegExp]'
const setTag = '[object Set]'
const stringTag = '[object String]'
const symbolTag = '[object Symbol]'
const weakMapTag = '[object WeakMap]'
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]';
const arrayBufferTag = '[object ArrayBuffer]'
const dataViewTag = '[object DataView]'
const float32Tag = '[object Float32Array]'
const float64Tag = '[object Float64Array]'
const int8Tag = '[object Int8Array]'
const int16Tag = '[object Int16Array]'
const int32Tag = '[object Int32Array]'
const uint8Tag = '[object Uint8Array]'
const uint8ClampedTag = '[object Uint8ClampedArray]'
const uint16Tag = '[object Uint16Array]'
const uint32Tag = '[object Uint32Array]'
/** Used to identify `toStringTag` values supported by `clone`. */
const cloneableTags = {};
const cloneableTags = {}
cloneableTags[argsTag] = cloneableTags[arrayTag] =
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
cloneableTags[boolTag] = cloneableTags[dateTag] =
@@ -72,12 +72,12 @@ cloneableTags[numberTag] = cloneableTags[objectTag] =
cloneableTags[regexpTag] = cloneableTags[setTag] =
cloneableTags[stringTag] = cloneableTags[symbolTag] =
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true
cloneableTags[errorTag] = cloneableTags[funcTag] =
cloneableTags[weakMapTag] = false;
cloneableTags[weakMapTag] = false
/** Used to check objects for own properties. */
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwnProperty = Object.prototype.hasOwnProperty
/**
* Initializes an object clone.
@@ -89,7 +89,7 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
function initCloneObject(object) {
return (typeof object.constructor == 'function' && !isPrototype(object))
? baseCreate(Object.getPrototypeOf(object))
: {};
: {}
}
/**
@@ -106,38 +106,38 @@ function initCloneObject(object) {
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, cloneFunc, isDeep) {
const Ctor = object.constructor;
const Ctor = object.constructor
switch (tag) {
case arrayBufferTag:
return cloneArrayBuffer(object);
return cloneArrayBuffer(object)
case boolTag:
case dateTag:
return new Ctor(+object);
return new Ctor(+object)
case dataViewTag:
return cloneDataView(object, isDeep);
return cloneDataView(object, isDeep)
case float32Tag: case float64Tag:
case int8Tag: case int16Tag: case int32Tag:
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
return cloneTypedArray(object, isDeep);
return cloneTypedArray(object, isDeep)
case mapTag:
return cloneMap(object, isDeep, cloneFunc);
return cloneMap(object, isDeep, cloneFunc)
case numberTag:
case stringTag:
return new Ctor(object);
return new Ctor(object)
case regexpTag:
return cloneRegExp(object);
return cloneRegExp(object)
case setTag:
return cloneSet(object, isDeep, cloneFunc);
return cloneSet(object, isDeep, cloneFunc)
case symbolTag:
return cloneSymbol(object);
return cloneSymbol(object)
}
}
@@ -149,15 +149,15 @@ function initCloneByTag(object, tag, cloneFunc, isDeep) {
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
const length = array.length;
const result = array.constructor(length);
const length = array.length
const result = array.constructor(length)
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
result.index = array.index
result.input = array.input
}
return result;
return result
}
/**
@@ -177,69 +177,69 @@ function initCloneArray(array) {
* @returns {*} Returns the cloned value.
*/
function baseClone(value, bitmask, customizer, key, object, stack) {
let result;
const isDeep = bitmask & CLONE_DEEP_FLAG;
const isFlat = bitmask & CLONE_FLAT_FLAG;
const isFull = bitmask & CLONE_SYMBOLS_FLAG;
let result
const isDeep = bitmask & CLONE_DEEP_FLAG
const isFlat = bitmask & CLONE_FLAT_FLAG
const isFull = bitmask & CLONE_SYMBOLS_FLAG
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
result = object ? customizer(value, key, object, stack) : customizer(value)
}
if (result !== undefined) {
return result;
return result
}
if (!isObject(value)) {
return value;
return value
}
const isArr = Array.isArray(value);
const isArr = Array.isArray(value)
if (isArr) {
result = initCloneArray(value);
result = initCloneArray(value)
if (!isDeep) {
return copyArray(value, result);
return copyArray(value, result)
}
} else {
const tag = getTag(value);
const isFunc = tag == funcTag || tag == genTag;
const tag = getTag(value)
const isFunc = tag == funcTag || tag == genTag
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
return cloneBuffer(value, isDeep)
}
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
result = (isFlat || isFunc) ? {} : initCloneObject(value);
result = (isFlat || isFunc) ? {} : initCloneObject(value)
if (!isDeep) {
return isFlat
? copySymbolsIn(value, baseAssignIn(result, value))
: copySymbols(value, baseAssign(result, value));
: copySymbols(value, baseAssign(result, value))
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
return object ? value : {}
}
result = initCloneByTag(value, tag, baseClone, isDeep);
result = initCloneByTag(value, tag, baseClone, isDeep)
}
}
// Check for circular references and return its corresponding clone.
stack || (stack = new Stack);
const stacked = stack.get(value);
stack || (stack = new Stack)
const stacked = stack.get(value)
if (stacked) {
return stacked;
return stacked
}
stack.set(value, result);
stack.set(value, result)
const keysFunc = isFull
? (isFlat ? getAllKeysIn : getAllKeys)
: (isFlat ? keysIn : keys);
: (isFlat ? keysIn : keys)
const props = isArr ? undefined : keysFunc(value);
const props = isArr ? undefined : keysFunc(value)
arrayEach(props || value, (subValue, key) => {
if (props) {
key = subValue;
subValue = value[key];
key = subValue
subValue = value[key]
}
// Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
return result;
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack))
})
return result
}
export default baseClone;
export default baseClone

View File

@@ -1,5 +1,5 @@
import baseConformsTo from './baseConformsTo.js';
import keys from '../keys.js';
import baseConformsTo from './baseConformsTo.js'
import keys from '../keys.js'
/**
* The base implementation of `conforms` which doesn't clone `source`.
@@ -9,8 +9,8 @@ import keys from '../keys.js';
* @returns {Function} Returns the new spec function.
*/
function baseConforms(source) {
const props = keys(source);
return object => baseConformsTo(object, source, props);
const props = keys(source)
return object => baseConformsTo(object, source, props)
}
export default baseConforms;
export default baseConforms

View File

@@ -7,21 +7,21 @@
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
*/
function baseConformsTo(object, source, props) {
let length = props.length;
let length = props.length
if (object == null) {
return !length;
return !length
}
object = Object(object);
object = Object(object)
while (length--) {
const key = props[length];
const predicate = source[key];
const 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;
return false
}
}
return true;
return true
}
export default baseConformsTo;
export default baseConformsTo

View File

@@ -1,4 +1,4 @@
import isObject from '../isObject.js';
import isObject from '../isObject.js'
/**
* The base implementation of `create` without support for assigning
@@ -9,7 +9,7 @@ import isObject from '../isObject.js';
* @returns {Object} Returns the new object.
*/
function baseCreate(proto) {
return isObject(proto) ? Object.create(proto) : {};
return isObject(proto) ? Object.create(proto) : {}
}
export default baseCreate;
export default baseCreate

View File

@@ -1,11 +1,11 @@
import SetCache from './SetCache.js';
import arrayIncludes from './arrayIncludes.js';
import arrayIncludesWith from './arrayIncludesWith.js';
import arrayMap from './arrayMap.js';
import cacheHas from './cacheHas.js';
import SetCache from './SetCache.js'
import arrayIncludes from './arrayIncludes.js'
import arrayIncludesWith from './arrayIncludesWith.js'
import arrayMap from './arrayMap.js'
import cacheHas from './cacheHas.js'
/** Used as the size to enable large array optimizations. */
const LARGE_ARRAY_SIZE = 200;
const LARGE_ARRAY_SIZE = 200
/**
* The base implementation of methods like `difference` without support
@@ -19,48 +19,48 @@ const LARGE_ARRAY_SIZE = 200;
* @returns {Array} Returns the new array of filtered values.
*/
function baseDifference(array, values, iteratee, comparator) {
let index = -1;
let includes = arrayIncludes;
let isCommon = true;
const length = array.length;
const result = [];
const valuesLength = values.length;
let index = -1
let includes = arrayIncludes
let isCommon = true
const length = array.length
const result = []
const valuesLength = values.length
if (!length) {
return result;
return result
}
if (iteratee) {
values = arrayMap(values, value => iteratee(value));
values = arrayMap(values, value => iteratee(value))
}
if (comparator) {
includes = arrayIncludesWith;
isCommon = false;
includes = arrayIncludesWith
isCommon = false
}
else if (values.length >= LARGE_ARRAY_SIZE) {
includes = cacheHas;
isCommon = false;
values = new SetCache(values);
includes = cacheHas
isCommon = false
values = new SetCache(values)
}
outer:
while (++index < length) {
let value = array[index];
const computed = iteratee == null ? value : iteratee(value);
let value = array[index]
const computed = iteratee == null ? value : iteratee(value)
value = (comparator || value !== 0) ? value : 0;
value = (comparator || value !== 0) ? value : 0
if (isCommon && computed === computed) {
let valuesIndex = valuesLength;
let valuesIndex = valuesLength
while (valuesIndex--) {
if (values[valuesIndex] === computed) {
continue outer;
continue outer
}
}
result.push(value);
result.push(value)
}
else if (!includes(values, computed, comparator)) {
result.push(value);
result.push(value)
}
}
return result;
return result
}
export default baseDifference;
export default baseDifference

View File

@@ -1,5 +1,5 @@
import baseForOwn from './baseForOwn.js';
import createBaseEach from './createBaseEach.js';
import baseForOwn from './baseForOwn.js'
import createBaseEach from './createBaseEach.js'
/**
* The base implementation of `forEach`.
@@ -9,6 +9,6 @@ import createBaseEach from './createBaseEach.js';
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
const baseEach = createBaseEach(baseForOwn);
const baseEach = createBaseEach(baseForOwn)
export default baseEach;
export default baseEach

View File

@@ -1,5 +1,5 @@
import baseForOwnRight from './baseForOwnRight.js';
import createBaseEach from './createBaseEach.js';
import baseForOwnRight from './baseForOwnRight.js'
import createBaseEach from './createBaseEach.js'
/**
* The base implementation of `forEachRight`.
@@ -9,6 +9,6 @@ import createBaseEach from './createBaseEach.js';
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object} Returns `collection`.
*/
const baseEachRight = createBaseEach(baseForOwnRight, true);
const baseEachRight = createBaseEach(baseForOwnRight, true)
export default baseEachRight;
export default baseEachRight

View File

@@ -1,4 +1,4 @@
import baseEach from './baseEach.js';
import baseEach from './baseEach.js'
/**
* The base implementation of `every`.
@@ -10,12 +10,12 @@ import baseEach from './baseEach.js';
* else `false`
*/
function baseEvery(collection, predicate) {
let result = true;
let result = true
baseEach(collection, (value, index, collection) => {
result = !!predicate(value, index, collection);
return result;
});
return result;
result = !!predicate(value, index, collection)
return result
})
return result
}
export default baseEvery;
export default baseEvery

View File

@@ -1,5 +1,5 @@
import toInteger from '../toInteger.js';
import toLength from '../toLength.js';
import toInteger from '../toInteger.js'
import toLength from '../toLength.js'
/**
* The base implementation of `fill` without an iteratee call guard.
@@ -12,21 +12,21 @@ import toLength from '../toLength.js';
* @returns {Array} Returns `array`.
*/
function baseFill(array, value, start, end) {
const length = array.length;
const length = array.length
start = toInteger(start);
start = toInteger(start)
if (start < 0) {
start = -start > length ? 0 : (length + start);
start = -start > length ? 0 : (length + start)
}
end = (end === undefined || end > length) ? length : toInteger(end);
end = (end === undefined || end > length) ? length : toInteger(end)
if (end < 0) {
end += length;
end += length
}
end = start > end ? 0 : toLength(end);
end = start > end ? 0 : toLength(end)
while (start < end) {
array[start++] = value;
array[start++] = value
}
return array;
return array
}
export default baseFill;
export default baseFill

View File

@@ -1,4 +1,4 @@
import baseEach from './baseEach.js';
import baseEach from './baseEach.js'
/**
* The base implementation of `filter`.
@@ -9,13 +9,13 @@ import baseEach from './baseEach.js';
* @returns {Array} Returns the new filtered array.
*/
function baseFilter(collection, predicate) {
const result = [];
const result = []
baseEach(collection, (value, index, collection) => {
if (predicate(value, index, collection)) {
result.push(value);
result.push(value)
}
});
return result;
})
return result
}
export default baseFilter;
export default baseFilter

View File

@@ -9,15 +9,15 @@
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromIndex, fromRight) {
const length = array.length;
let 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)) {
return index;
return index
}
}
return -1;
return -1
}
export default baseFindIndex;
export default baseFindIndex

View File

@@ -9,14 +9,14 @@
* @returns {*} Returns the found element or its key, else `undefined`.
*/
function baseFindKey(collection, predicate, eachFunc) {
let result;
let result
eachFunc(collection, (value, key, collection) => {
if (predicate(value, key, collection)) {
result = key;
return false;
result = key
return false
}
});
return result;
})
return result
}
export default baseFindKey;
export default baseFindKey

View File

@@ -1,5 +1,5 @@
import arrayPush from './arrayPush.js';
import isFlattenable from './isFlattenable.js';
import arrayPush from './arrayPush.js'
import isFlattenable from './isFlattenable.js'
/**
* The base implementation of `flatten` with support for restricting flattening.
@@ -13,26 +13,26 @@ import isFlattenable from './isFlattenable.js';
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
let index = -1;
const length = array.length;
let index = -1
const length = array.length
predicate || (predicate = isFlattenable);
result || (result = []);
predicate || (predicate = isFlattenable)
result || (result = [])
while (++index < length) {
const value = array[index];
const value = array[index]
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
baseFlatten(value, depth - 1, predicate, isStrict, result)
} else {
arrayPush(result, value);
arrayPush(result, value)
}
} else if (!isStrict) {
result[result.length] = value;
result[result.length] = value
}
}
return result;
return result
}
export default baseFlatten;
export default baseFlatten

View File

@@ -1,4 +1,4 @@
import createBaseFor from './createBaseFor.js';
import createBaseFor from './createBaseFor.js'
/**
* The base implementation of `baseForOwn` which iterates over `object`
@@ -11,6 +11,6 @@ import createBaseFor from './createBaseFor.js';
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
const baseFor = createBaseFor();
const baseFor = createBaseFor()
export default baseFor;
export default baseFor

View File

@@ -1,5 +1,5 @@
import baseFor from './baseFor.js';
import keys from '../keys.js';
import baseFor from './baseFor.js'
import keys from '../keys.js'
/**
* The base implementation of `forOwn`.
@@ -10,7 +10,7 @@ import keys from '../keys.js';
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return object && baseFor(object, iteratee, keys);
return object && baseFor(object, iteratee, keys)
}
export default baseForOwn;
export default baseForOwn

View File

@@ -1,5 +1,5 @@
import baseForRight from './baseForRight.js';
import keys from '../keys.js';
import baseForRight from './baseForRight.js'
import keys from '../keys.js'
/**
* The base implementation of `forOwnRight`.
@@ -10,7 +10,7 @@ import keys from '../keys.js';
* @returns {Object} Returns `object`.
*/
function baseForOwnRight(object, iteratee) {
return object && baseForRight(object, iteratee, keys);
return object && baseForRight(object, iteratee, keys)
}
export default baseForOwnRight;
export default baseForOwnRight

View File

@@ -1,4 +1,4 @@
import createBaseFor from './createBaseFor.js';
import createBaseFor from './createBaseFor.js'
/**
* This function is like `baseFor` except that it iterates over properties
@@ -10,6 +10,6 @@ import createBaseFor from './createBaseFor.js';
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
const baseForRight = createBaseFor(true);
const baseForRight = createBaseFor(true)
export default baseForRight;
export default baseForRight

View File

@@ -1,5 +1,5 @@
import arrayFilter from './arrayFilter.js';
import isFunction from '../isFunction.js';
import arrayFilter from './arrayFilter.js'
import isFunction from '../isFunction.js'
/**
* The base implementation of `functions` which creates an array of
@@ -11,7 +11,7 @@ import isFunction from '../isFunction.js';
* @returns {Array} Returns the function names.
*/
function baseFunctions(object, props) {
return arrayFilter(props, key => isFunction(object[key]));
return arrayFilter(props, key => isFunction(object[key]))
}
export default baseFunctions;
export default baseFunctions

View File

@@ -1,5 +1,5 @@
import castPath from './castPath.js';
import toKey from './toKey.js';
import castPath from './castPath.js'
import toKey from './toKey.js'
/**
* The base implementation of `get` without support for default values.
@@ -10,15 +10,15 @@ import toKey from './toKey.js';
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = castPath(path, object);
path = castPath(path, object)
let index = 0;
const length = path.length;
let index = 0
const length = path.length
while (object != null && index < length) {
object = object[toKey(path[index++])];
object = object[toKey(path[index++])]
}
return (index && index == length) ? object : undefined;
return (index && index == length) ? object : undefined
}
export default baseGet;
export default baseGet

View File

@@ -1,12 +1,12 @@
import getRawTag from './getRawTag.js';
import objectToString from './objectToString.js';
import getRawTag from './getRawTag.js'
import objectToString from './objectToString.js'
/** `Object#toString` result references. */
const nullTag = '[object Null]';
const undefinedTag = '[object Undefined]';
const nullTag = '[object Null]'
const undefinedTag = '[object Undefined]'
/** Built-in value references. */
const symToStringTag = Symbol ? Symbol.toStringTag : undefined;
const symToStringTag = Symbol ? Symbol.toStringTag : undefined
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
@@ -17,11 +17,11 @@ const symToStringTag = Symbol ? Symbol.toStringTag : undefined;
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
return value === undefined ? undefinedTag : nullTag
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
: objectToString(value)
}
export default baseGetTag;
export default baseGetTag

View File

@@ -1,5 +1,5 @@
/** Used to check objects for own properties. */
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwnProperty = Object.prototype.hasOwnProperty
/**
* The base implementation of `has` without support for deep paths.
@@ -10,7 +10,7 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHas(object, key) {
return object != null && hasOwnProperty.call(object, key);
return object != null && hasOwnProperty.call(object, key)
}
export default baseHas;
export default baseHas

View File

@@ -7,7 +7,7 @@
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHasIn(object, key) {
return object != null && key in Object(object);
return object != null && key in Object(object)
}
export default baseHasIn;
export default baseHasIn

View File

@@ -1,6 +1,6 @@
/* Built-in method references for those with the same name as other `lodash` methods. */
const nativeMax = Math.max;
const nativeMin = Math.min;
const nativeMax = Math.max
const nativeMin = Math.min
/**
* The base implementation of `inRange` which doesn't coerce arguments.
@@ -12,7 +12,7 @@ const nativeMin = Math.min;
* @returns {boolean} Returns `true` if `number` is in the range, else `false`.
*/
function baseInRange(number, start, end) {
return number >= nativeMin(start, end) && number < nativeMax(start, end);
return number >= nativeMin(start, end) && number < nativeMax(start, end)
}
export default baseInRange;
export default baseInRange

View File

@@ -1,6 +1,6 @@
import baseFindIndex from './baseFindIndex.js';
import baseIsNaN from './baseIsNaN.js';
import strictIndexOf from './strictIndexOf.js';
import baseFindIndex from './baseFindIndex.js'
import baseIsNaN from './baseIsNaN.js'
import strictIndexOf from './strictIndexOf.js'
/**
* The base implementation of `indexOf` without `fromIndex` bounds checks.
@@ -14,7 +14,7 @@ import strictIndexOf from './strictIndexOf.js';
function baseIndexOf(array, value, fromIndex) {
return value === value
? strictIndexOf(array, value, fromIndex)
: baseFindIndex(array, baseIsNaN, fromIndex);
: baseFindIndex(array, baseIsNaN, fromIndex)
}
export default baseIndexOf;
export default baseIndexOf

View File

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

View File

@@ -1,11 +1,11 @@
import SetCache from './SetCache.js';
import arrayIncludes from './arrayIncludes.js';
import arrayIncludesWith from './arrayIncludesWith.js';
import arrayMap from './arrayMap.js';
import cacheHas from './cacheHas.js';
import SetCache from './SetCache.js'
import arrayIncludes from './arrayIncludes.js'
import arrayIncludesWith from './arrayIncludesWith.js'
import arrayMap from './arrayMap.js'
import cacheHas from './cacheHas.js'
/* Built-in method references for those with the same name as other `lodash` methods. */
const nativeMin = Math.min;
const nativeMin = Math.min
/**
* The base implementation of methods like `intersection` that accepts an
@@ -18,58 +18,58 @@ const nativeMin = Math.min;
* @returns {Array} Returns the new array of shared values.
*/
function baseIntersection(arrays, iteratee, comparator) {
const includes = comparator ? arrayIncludesWith : arrayIncludes;
const length = arrays[0].length;
const othLength = arrays.length;
const caches = Array(othLength);
const result = [];
const includes = comparator ? arrayIncludesWith : arrayIncludes
const length = arrays[0].length
const othLength = arrays.length
const caches = Array(othLength)
const result = []
let array;
let maxLength = Infinity;
let othIndex = othLength;
let array
let maxLength = Infinity
let othIndex = othLength
while (othIndex--) {
array = arrays[othIndex];
array = arrays[othIndex]
if (othIndex && iteratee) {
array = arrayMap(array, valye => iteratee(value));
array = arrayMap(array, valye => iteratee(value))
}
maxLength = nativeMin(array.length, maxLength);
maxLength = nativeMin(array.length, maxLength)
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
? new SetCache(othIndex && array)
: undefined;
: undefined
}
array = arrays[0];
array = arrays[0]
let index = -1;
const seen = caches[0];
let index = -1
const seen = caches[0]
outer:
while (++index < length && result.length < maxLength) {
let value = array[index];
const computed = iteratee ? iteratee(value) : value;
let value = array[index]
const computed = iteratee ? iteratee(value) : value
value = (comparator || value !== 0) ? value : 0;
value = (comparator || value !== 0) ? value : 0
if (!(seen
? cacheHas(seen, computed)
: includes(result, computed, comparator)
)) {
othIndex = othLength;
othIndex = othLength
while (--othIndex) {
const cache = caches[othIndex];
const cache = caches[othIndex]
if (!(cache
? cacheHas(cache, computed)
: includes(arrays[othIndex], computed, comparator))
) {
continue outer;
continue outer
}
}
if (seen) {
seen.push(computed);
seen.push(computed)
}
result.push(value);
result.push(value)
}
}
return result;
return result
}
export default baseIntersection;
export default baseIntersection

View File

@@ -1,5 +1,5 @@
import baseIsEqualDeep from './baseIsEqualDeep.js';
import isObjectLike from '../isObjectLike.js';
import baseIsEqualDeep from './baseIsEqualDeep.js'
import isObjectLike from '../isObjectLike.js'
/**
* The base implementation of `isEqual` which supports partial comparisons
@@ -17,12 +17,12 @@ import isObjectLike from '../isObjectLike.js';
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
return true
}
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
return value !== value && other !== other;
return value !== value && other !== other
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack)
}
export default baseIsEqual;
export default baseIsEqual

View File

@@ -1,21 +1,21 @@
import Stack from './Stack.js';
import equalArrays from './equalArrays.js';
import equalByTag from './equalByTag.js';
import equalObjects from './equalObjects.js';
import getTag from './getTag.js';
import isBuffer from '../isBuffer.js';
import isTypedArray from '../isTypedArray.js';
import Stack from './Stack.js'
import equalArrays from './equalArrays.js'
import equalByTag from './equalByTag.js'
import equalObjects from './equalObjects.js'
import getTag from './getTag.js'
import isBuffer from '../isBuffer.js'
import isTypedArray from '../isTypedArray.js'
/** Used to compose bitmasks for value comparisons. */
const COMPARE_PARTIAL_FLAG = 1;
const COMPARE_PARTIAL_FLAG = 1
/** `Object#toString` result references. */
const argsTag = '[object Arguments]';
const arrayTag = '[object Array]';
const objectTag = '[object Object]';
const argsTag = '[object Arguments]'
const arrayTag = '[object Array]'
const objectTag = '[object Object]'
/** Used to check objects for own properties. */
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwnProperty = Object.prototype.hasOwnProperty
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
@@ -32,48 +32,48 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
let objIsArr = Array.isArray(object);
const othIsArr = Array.isArray(other);
let objTag = objIsArr ? arrayTag : getTag(object);
let othTag = othIsArr ? arrayTag : getTag(other);
let objIsArr = Array.isArray(object)
const othIsArr = Array.isArray(other)
let objTag = objIsArr ? arrayTag : getTag(object)
let othTag = othIsArr ? arrayTag : getTag(other)
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
objTag = objTag == argsTag ? objectTag : objTag
othTag = othTag == argsTag ? objectTag : othTag
let objIsObj = objTag == objectTag;
const othIsObj = othTag == objectTag;
const isSameTag = objTag == othTag;
let objIsObj = objTag == objectTag
const othIsObj = othTag == objectTag
const isSameTag = objTag == othTag
if (isSameTag && isBuffer(object)) {
if (!isBuffer(other)) {
return false;
return false
}
objIsArr = true;
objIsObj = false;
objIsArr = true
objIsObj = false
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
stack || (stack = new Stack)
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack)
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
const objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__');
const othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
const objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__')
const othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__')
if (objIsWrapped || othIsWrapped) {
const objUnwrapped = objIsWrapped ? object.value() : object;
const othUnwrapped = othIsWrapped ? other.value() : other;
const objUnwrapped = objIsWrapped ? object.value() : object
const othUnwrapped = othIsWrapped ? other.value() : other
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
stack || (stack = new Stack)
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack)
}
}
if (!isSameTag) {
return false;
return false
}
stack || (stack = new Stack);
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
stack || (stack = new Stack)
return equalObjects(object, other, bitmask, customizer, equalFunc, stack)
}
export default baseIsEqualDeep;
export default baseIsEqualDeep

View File

@@ -1,9 +1,9 @@
import Stack from './Stack.js';
import baseIsEqual from './baseIsEqual.js';
import Stack from './Stack.js'
import baseIsEqual from './baseIsEqual.js'
/** Used to compose bitmasks for value comparisons. */
const COMPARE_PARTIAL_FLAG = 1;
const COMPARE_UNORDERED_FLAG = 2;
const COMPARE_PARTIAL_FLAG = 1
const COMPARE_UNORDERED_FLAG = 2
/**
* The base implementation of `isMatch`.
@@ -16,49 +16,49 @@ const COMPARE_UNORDERED_FLAG = 2;
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, source, matchData, customizer) {
let index = matchData.length;
const length = index;
const noCustomizer = !customizer;
let index = matchData.length
const length = index
const noCustomizer = !customizer
if (object == null) {
return !length;
return !length
}
let data;
let result;
object = Object(object);
let data
let result
object = Object(object)
while (index--) {
data = matchData[index];
data = matchData[index]
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
return false
}
}
while (++index < length) {
data = matchData[index];
const key = data[0];
const objValue = object[key];
const srcValue = data[1];
data = matchData[index]
const key = data[0]
const objValue = object[key]
const srcValue = data[1]
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
return false
}
} else {
const stack = new Stack;
const stack = new Stack
if (customizer) {
result = customizer(objValue, srcValue, key, object, source, stack);
result = customizer(objValue, srcValue, key, object, source, stack)
}
if (!(result === undefined
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
: result
)) {
return false;
return false
}
}
}
return true;
return true
}
export default baseIsMatch;
export default baseIsMatch

View File

@@ -6,7 +6,7 @@
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
*/
function baseIsNaN(value) {
return value !== value;
return value !== value
}
export default baseIsNaN;
export default baseIsNaN

View File

@@ -1,8 +1,8 @@
import isPrototype from './isPrototype.js';
import nativeKeys from './nativeKeys.js';
import isPrototype from './isPrototype.js'
import nativeKeys from './nativeKeys.js'
/** Used to check objects for own properties. */
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwnProperty = Object.prototype.hasOwnProperty
/**
* The base implementation of `keys` which doesn't treat sparse arrays as dense.
@@ -13,15 +13,15 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
return nativeKeys(object)
}
const result = [];
const result = []
for (const key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
result.push(key)
}
}
return result;
return result
}
export default baseKeys;
export default baseKeys

View File

@@ -1,9 +1,9 @@
import isObject from '../isObject.js';
import isPrototype from './isPrototype.js';
import nativeKeysIn from './nativeKeysIn.js';
import isObject from '../isObject.js'
import isPrototype from './isPrototype.js'
import nativeKeysIn from './nativeKeysIn.js'
/** Used to check objects for own properties. */
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwnProperty = Object.prototype.hasOwnProperty
/**
* The base implementation of `keysIn` which doesn't treat sparse arrays as dense.
@@ -14,17 +14,17 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
*/
function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
return nativeKeysIn(object)
}
const isProto = isPrototype(object);
const result = [];
const isProto = isPrototype(object)
const result = []
for (const key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
result.push(key)
}
}
return result;
return result
}
export default baseKeysIn;
export default baseKeysIn

View File

@@ -1,5 +1,5 @@
import baseEach from './baseEach.js';
import isArrayLike from '../isArrayLike.js';
import baseEach from './baseEach.js'
import isArrayLike from '../isArrayLike.js'
/**
* The base implementation of `map`.
@@ -10,13 +10,13 @@ import isArrayLike from '../isArrayLike.js';
* @returns {Array} Returns the new mapped array.
*/
function baseMap(collection, iteratee) {
let index = -1;
const result = isArrayLike(collection) ? Array(collection.length) : [];
let index = -1
const result = isArrayLike(collection) ? Array(collection.length) : []
baseEach(collection, (value, key, collection) => {
result[++index] = iteratee(value, key, collection);
});
return result;
result[++index] = iteratee(value, key, collection)
})
return result
}
export default baseMap;
export default baseMap

View File

@@ -1,6 +1,6 @@
import baseIsMatch from './baseIsMatch.js';
import getMatchData from './getMatchData.js';
import matchesStrictComparable from './matchesStrictComparable.js';
import baseIsMatch from './baseIsMatch.js'
import getMatchData from './getMatchData.js'
import matchesStrictComparable from './matchesStrictComparable.js'
/**
* The base implementation of `matches` which doesn't clone `source`.
@@ -10,11 +10,11 @@ import matchesStrictComparable from './matchesStrictComparable.js';
* @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
const matchData = getMatchData(source);
const matchData = getMatchData(source)
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
return matchesStrictComparable(matchData[0][0], matchData[0][1])
}
return object => object === source || baseIsMatch(object, source, matchData);
return object => object === source || baseIsMatch(object, source, matchData)
}
export default baseMatches;
export default baseMatches

View File

@@ -1,14 +1,14 @@
import baseIsEqual from './baseIsEqual.js';
import get from '../get.js';
import hasIn from '../hasIn.js';
import isKey from './isKey.js';
import isStrictComparable from './isStrictComparable.js';
import matchesStrictComparable from './matchesStrictComparable.js';
import toKey from './toKey.js';
import baseIsEqual from './baseIsEqual.js'
import get from '../get.js'
import hasIn from '../hasIn.js'
import isKey from './isKey.js'
import isStrictComparable from './isStrictComparable.js'
import matchesStrictComparable from './matchesStrictComparable.js'
import toKey from './toKey.js'
/** Used to compose bitmasks for value comparisons. */
const COMPARE_PARTIAL_FLAG = 1;
const COMPARE_UNORDERED_FLAG = 2;
const COMPARE_PARTIAL_FLAG = 1
const COMPARE_UNORDERED_FLAG = 2
/**
* The base implementation of `matchesProperty` which doesn't clone `srcValue`.
@@ -20,14 +20,14 @@ const COMPARE_UNORDERED_FLAG = 2;
*/
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
return matchesStrictComparable(toKey(path), srcValue)
}
return object => {
const 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);
};
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG)
}
}
export default baseMatchesProperty;
export default baseMatchesProperty

View File

@@ -1,9 +1,9 @@
import Stack from './Stack.js';
import assignMergeValue from './assignMergeValue.js';
import baseFor from './baseFor.js';
import baseMergeDeep from './baseMergeDeep.js';
import isObject from '../isObject.js';
import keysIn from '../keysIn.js';
import Stack from './Stack.js'
import assignMergeValue from './assignMergeValue.js'
import baseFor from './baseFor.js'
import baseMergeDeep from './baseMergeDeep.js'
import isObject from '../isObject.js'
import keysIn from '../keysIn.js'
/**
* The base implementation of `merge` without support for multiple sources.
@@ -18,24 +18,24 @@ import keysIn from '../keysIn.js';
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
return
}
baseFor(source, (srcValue, key) => {
if (isObject(srcValue)) {
stack || (stack = new Stack);
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
stack || (stack = new Stack)
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack)
}
else {
const newValue = customizer
? customizer(object[key], srcValue, `${ key }`, object, source, stack)
: undefined;
: undefined
if (newValue === undefined) {
newValue = srcValue;
newValue = srcValue
}
assignMergeValue(object, key, newValue);
assignMergeValue(object, key, newValue)
}
}, keysIn);
}, keysIn)
}
export default baseMerge;
export default baseMerge

View File

@@ -1,16 +1,16 @@
import assignMergeValue from './assignMergeValue.js';
import cloneBuffer from './cloneBuffer.js';
import cloneTypedArray from './cloneTypedArray.js';
import copyArray from './copyArray.js';
import initCloneObject from './initCloneObject.js';
import isArguments from '../isArguments.js';
import isArrayLikeObject from '../isArrayLikeObject.js';
import isBuffer from '../isBuffer.js';
import isFunction from '../isFunction.js';
import isObject from '../isObject.js';
import isPlainObject from '../isPlainObject.js';
import isTypedArray from '../isTypedArray.js';
import toPlainObject from '../toPlainObject.js';
import assignMergeValue from './assignMergeValue.js'
import cloneBuffer from './cloneBuffer.js'
import cloneTypedArray from './cloneTypedArray.js'
import copyArray from './copyArray.js'
import initCloneObject from './initCloneObject.js'
import isArguments from '../isArguments.js'
import isArrayLikeObject from '../isArrayLikeObject.js'
import isBuffer from '../isBuffer.js'
import isFunction from '../isFunction.js'
import isObject from '../isObject.js'
import isPlainObject from '../isPlainObject.js'
import isTypedArray from '../isTypedArray.js'
import toPlainObject from '../toPlainObject.js'
/**
* A specialized version of `baseMerge` for arrays and objects which performs
@@ -28,65 +28,65 @@ import toPlainObject from '../toPlainObject.js';
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
const objValue = object[key];
const srcValue = source[key];
const stacked = stack.get(srcValue);
const objValue = object[key]
const srcValue = source[key]
const stacked = stack.get(srcValue)
if (stacked) {
assignMergeValue(object, key, stacked);
return;
assignMergeValue(object, key, stacked)
return
}
let newValue = customizer
? customizer(objValue, srcValue, `${ key }`, object, source, stack)
: undefined;
: undefined
let isCommon = newValue === undefined;
let isCommon = newValue === undefined
if (isCommon) {
const isArr = Array.isArray(srcValue);
const isBuff = !isArr && isBuffer(srcValue);
const isTyped = !isArr && !isBuff && isTypedArray(srcValue);
const isArr = Array.isArray(srcValue)
const isBuff = !isArr && isBuffer(srcValue)
const isTyped = !isArr && !isBuff && isTypedArray(srcValue)
newValue = srcValue;
newValue = srcValue
if (isArr || isBuff || isTyped) {
if (Array.isArray(objValue)) {
newValue = objValue;
newValue = objValue
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
newValue = copyArray(objValue)
}
else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
isCommon = false
newValue = cloneBuffer(srcValue, true)
}
else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
isCommon = false
newValue = cloneTypedArray(srcValue, true)
}
else {
newValue = [];
newValue = []
}
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = objValue;
newValue = objValue
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
newValue = toPlainObject(objValue)
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
newValue = initCloneObject(srcValue);
newValue = initCloneObject(srcValue)
}
}
else {
isCommon = false;
isCommon = false
}
}
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack['delete'](srcValue);
stack.set(srcValue, newValue)
mergeFunc(newValue, srcValue, srcIndex, customizer, stack)
stack['delete'](srcValue)
}
assignMergeValue(object, key, newValue);
assignMergeValue(object, key, newValue)
}
export default baseMergeDeep;
export default baseMergeDeep

View File

@@ -1,4 +1,4 @@
import isIndex from './isIndex.js';
import isIndex from './isIndex.js'
/**
* The base implementation of `nth` which doesn't coerce arguments.
@@ -9,12 +9,12 @@ import isIndex from './isIndex.js';
* @returns {*} Returns the nth element of `array`.
*/
function baseNth(array, n) {
const length = array.length;
const length = array.length
if (!length) {
return;
return
}
n += n < 0 ? length : 0;
return isIndex(n, length) ? array[n] : undefined;
n += n < 0 ? length : 0
return isIndex(n, length) ? array[n] : undefined
}
export default baseNth;
export default baseNth

View File

@@ -1,8 +1,8 @@
import arrayMap from './arrayMap.js';
import baseMap from './baseMap.js';
import baseSortBy from './baseSortBy.js';
import compareMultiple from './compareMultiple.js';
import identity from '../identity.js';
import arrayMap from './arrayMap.js'
import baseMap from './baseMap.js'
import baseSortBy from './baseSortBy.js'
import compareMultiple from './compareMultiple.js'
import identity from '../identity.js'
/**
* The base implementation of `orderBy` without param guards.
@@ -14,15 +14,15 @@ import identity from '../identity.js';
* @returns {Array} Returns the new sorted array.
*/
function baseOrderBy(collection, iteratees, orders) {
let index = -1;
iteratees = iteratees.length ? iteratees : [identity];
let index = -1
iteratees = iteratees.length ? iteratees : [identity]
const result = baseMap(collection, (value, key, collection) => {
const criteria = arrayMap(iteratees, iteratee => iteratee(value));
return { 'criteria': criteria, 'index': ++index, 'value': value };
});
const criteria = arrayMap(iteratees, iteratee => iteratee(value))
return { 'criteria': criteria, 'index': ++index, 'value': value }
})
return baseSortBy(result, (object, other) => compareMultiple(object, other, orders));
return baseSortBy(result, (object, other) => compareMultiple(object, other, orders))
}
export default baseOrderBy;
export default baseOrderBy

View File

@@ -1,5 +1,5 @@
import basePickBy from './basePickBy.js';
import hasIn from '../hasIn.js';
import basePickBy from './basePickBy.js'
import hasIn from '../hasIn.js'
/**
* The base implementation of `pick` without support for individual
@@ -11,7 +11,7 @@ import hasIn from '../hasIn.js';
* @returns {Object} Returns the new object.
*/
function basePick(object, paths) {
return basePickBy(object, paths, (value, path) => hasIn(object, path));
return basePickBy(object, paths, (value, path) => hasIn(object, path))
}
export default basePick;
export default basePick

View File

@@ -1,6 +1,6 @@
import baseGet from './baseGet.js';
import baseSet from './baseSet.js';
import castPath from './castPath.js';
import baseGet from './baseGet.js'
import baseSet from './baseSet.js'
import castPath from './castPath.js'
/**
* The base implementation of `pickBy`.
@@ -12,18 +12,18 @@ import castPath from './castPath.js';
* @returns {Object} Returns the new object.
*/
function basePickBy(object, paths, predicate) {
let index = -1;
const length = paths.length;
const result = {};
let index = -1
const length = paths.length
const result = {}
while (++index < length) {
const path = paths[index];
const value = baseGet(object, path);
const path = paths[index]
const value = baseGet(object, path)
if (predicate(value, path)) {
baseSet(result, castPath(path, object), value);
baseSet(result, castPath(path, object), value)
}
}
return result;
return result
}
export default basePickBy;
export default basePickBy

View File

@@ -6,7 +6,7 @@
* @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return object => object == null ? undefined : object[key];
return object => object == null ? undefined : object[key]
}
export default baseProperty;
export default baseProperty

View File

@@ -1,4 +1,4 @@
import baseGet from './baseGet.js';
import baseGet from './baseGet.js'
/**
* A specialized version of `baseProperty` which supports deep paths.
@@ -8,7 +8,7 @@ import baseGet from './baseGet.js';
* @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return object => baseGet(object, path);
return object => baseGet(object, path)
}
export default basePropertyDeep;
export default basePropertyDeep

View File

@@ -6,7 +6,7 @@
* @returns {Function} Returns the new accessor function.
*/
function basePropertyOf(object) {
return key => object == null ? undefined : object[key];
return key => object == null ? undefined : object[key]
}
export default basePropertyOf;
export default basePropertyOf

View File

@@ -1,10 +1,10 @@
import arrayMap from './arrayMap.js';
import baseIndexOf from './baseIndexOf.js';
import baseIndexOfWith from './baseIndexOfWith.js';
import copyArray from './copyArray.js';
import arrayMap from './arrayMap.js'
import baseIndexOf from './baseIndexOf.js'
import baseIndexOfWith from './baseIndexOfWith.js'
import copyArray from './copyArray.js'
/** Built-in value references. */
const splice = Array.prototype.splice;
const splice = Array.prototype.splice
/**
* The base implementation of `pullAllBy`.
@@ -17,31 +17,31 @@ const splice = Array.prototype.splice;
* @returns {Array} Returns `array`.
*/
function basePullAll(array, values, iteratee, comparator) {
const indexOf = comparator ? baseIndexOfWith : baseIndexOf;
const length = values.length;
const indexOf = comparator ? baseIndexOfWith : baseIndexOf
const length = values.length
let index = -1;
let seen = array;
let index = -1
let seen = array
if (array === values) {
values = copyArray(values);
values = copyArray(values)
}
if (iteratee) {
seen = arrayMap(array, value => iteratee(value));
seen = arrayMap(array, value => iteratee(value))
}
while (++index < length) {
let fromIndex = 0;
const value = values[index];
const computed = iteratee ? iteratee(value) : value;
let fromIndex = 0
const value = values[index]
const computed = iteratee ? iteratee(value) : value
while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
if (seen !== array) {
splice.call(seen, fromIndex, 1);
splice.call(seen, fromIndex, 1)
}
splice.call(array, fromIndex, 1);
splice.call(array, fromIndex, 1)
}
}
return array;
return array
}
export default basePullAll;
export default basePullAll

View File

@@ -1,8 +1,8 @@
import baseUnset from './baseUnset.js';
import isIndex from './isIndex.js';
import baseUnset from './baseUnset.js'
import isIndex from './isIndex.js'
/** Built-in value references. */
const splice = Array.prototype.splice;
const splice = Array.prototype.splice
/**
* The base implementation of `pullAt` without support for individual
@@ -14,22 +14,22 @@ const splice = Array.prototype.splice;
* @returns {Array} Returns `array`.
*/
function basePullAt(array, indexes) {
let length = array ? indexes.length : 0;
const lastIndex = length - 1;
let length = array ? indexes.length : 0
const lastIndex = length - 1
while (length--) {
let previous;
const index = indexes[length];
let previous
const index = indexes[length]
if (length == lastIndex || index !== previous) {
previous = index;
previous = index
if (isIndex(index)) {
splice.call(array, index, 1);
splice.call(array, index, 1)
} else {
baseUnset(array, index);
baseUnset(array, index)
}
}
}
return array;
return array
}
export default basePullAt;
export default basePullAt

View File

@@ -8,7 +8,7 @@
* @returns {number} Returns the random number.
*/
function baseRandom(lower, upper) {
return lower + Math.floor(Math.random() * (upper - lower + 1));
return lower + Math.floor(Math.random() * (upper - lower + 1))
}
export default baseRandom;
export default baseRandom

View File

@@ -1,6 +1,6 @@
/* Built-in method references for those with the same name as other `lodash` methods. */
const nativeCeil = Math.ceil;
const nativeMax = Math.max;
const nativeCeil = Math.ceil
const nativeMax = Math.max
/**
* The base implementation of `range` and `rangeRight` which doesn't
@@ -14,15 +14,15 @@ const nativeMax = Math.max;
* @returns {Array} Returns the range of numbers.
*/
function baseRange(start, end, step, fromRight) {
let index = -1;
let length = nativeMax(nativeCeil((end - start) / (step || 1)), 0);
const result = Array(length);
let index = -1
let length = nativeMax(nativeCeil((end - start) / (step || 1)), 0)
const result = Array(length)
while (length--) {
result[fromRight ? length : ++index] = start;
start += step;
result[fromRight ? length : ++index] = start
start += step
}
return result;
return result
}
export default baseRange;
export default baseRange

View File

@@ -15,9 +15,9 @@ function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
eachFunc(collection, (value, index, collection) => {
accumulator = initAccum
? (initAccum = false, value)
: iteratee(accumulator, value, index, collection);
});
return accumulator;
: iteratee(accumulator, value, index, collection)
})
return accumulator
}
export default baseReduce;
export default baseReduce

View File

@@ -1,8 +1,8 @@
/** Used as references for various `Number` constants. */
const MAX_SAFE_INTEGER = 9007199254740991;
const MAX_SAFE_INTEGER = 9007199254740991
/* Built-in method references for those with the same name as other `lodash` methods. */
const nativeFloor = Math.floor;
const nativeFloor = Math.floor
/**
* The base implementation of `repeat` which doesn't coerce arguments.
@@ -13,23 +13,23 @@ const nativeFloor = Math.floor;
* @returns {string} Returns the repeated string.
*/
function baseRepeat(string, n) {
let result = '';
let result = ''
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
return result;
return result
}
// Leverage the exponentiation by squaring algorithm for a faster repeat.
// See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
do {
if (n % 2) {
result += string;
result += string
}
n = nativeFloor(n / 2);
n = nativeFloor(n / 2)
if (n) {
string += string;
string += string
}
} while (n);
} while (n)
return result;
return result
}
export default baseRepeat;
export default baseRepeat

View File

@@ -1,5 +1,5 @@
import arraySample from './arraySample.js';
import values from '../values.js';
import arraySample from './arraySample.js'
import values from '../values.js'
/**
* The base implementation of `sample`.
@@ -9,7 +9,7 @@ import values from '../values.js';
* @returns {*} Returns the random element.
*/
function baseSample(collection) {
return arraySample(values(collection));
return arraySample(values(collection))
}
export default baseSample;
export default baseSample

View File

@@ -1,6 +1,6 @@
import baseClamp from './baseClamp.js';
import shuffleSelf from './shuffleSelf.js';
import values from '../values.js';
import baseClamp from './baseClamp.js'
import shuffleSelf from './shuffleSelf.js'
import values from '../values.js'
/**
* The base implementation of `sampleSize` without param guards.
@@ -11,8 +11,8 @@ import values from '../values.js';
* @returns {Array} Returns the random elements.
*/
function baseSampleSize(collection, n) {
const array = values(collection);
return shuffleSelf(array, baseClamp(n, 0, array.length));
const array = values(collection)
return shuffleSelf(array, baseClamp(n, 0, array.length))
}
export default baseSampleSize;
export default baseSampleSize

View File

@@ -1,8 +1,8 @@
import assignValue from './assignValue.js';
import castPath from './castPath.js';
import isIndex from './isIndex.js';
import isObject from '../isObject.js';
import toKey from './toKey.js';
import assignValue from './assignValue.js'
import castPath from './castPath.js'
import isIndex from './isIndex.js'
import isObject from '../isObject.js'
import toKey from './toKey.js'
/**
* The base implementation of `set`.
@@ -16,33 +16,33 @@ import toKey from './toKey.js';
*/
function baseSet(object, path, value, customizer) {
if (!isObject(object)) {
return object;
return object
}
path = castPath(path, object);
path = castPath(path, object)
const length = path.length;
const lastIndex = length - 1;
const length = path.length
const lastIndex = length - 1
let index = -1;
let nested = object;
let index = -1
let nested = object
while (nested != null && ++index < length) {
const key = toKey(path[index]);
let newValue = value;
const key = toKey(path[index])
let newValue = value
if (index != lastIndex) {
const objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined;
const objValue = nested[key]
newValue = customizer ? customizer(objValue, key, nested) : undefined
if (newValue === undefined) {
newValue = isObject(objValue)
? objValue
: (isIndex(path[index + 1]) ? [] : {});
: (isIndex(path[index + 1]) ? [] : {})
}
}
assignValue(nested, key, newValue);
nested = nested[key];
assignValue(nested, key, newValue)
nested = nested[key]
}
return object;
return object
}
export default baseSet;
export default baseSet

View File

@@ -1,5 +1,5 @@
import constant from '../constant.js';
import identity from '../identity.js';
import constant from '../constant.js'
import identity from '../identity.js'
/**
* The base implementation of `setToString` without support for hot loop shorting.
@@ -15,7 +15,7 @@ function baseSetToString(func, string){
'enumerable': false,
'value': constant(string),
'writable': true
});
})
}
export default baseSetToString;
export default baseSetToString

View File

@@ -1,5 +1,5 @@
import shuffleSelf from './shuffleSelf.js';
import values from '../values.js';
import shuffleSelf from './shuffleSelf.js'
import values from '../values.js'
/**
* The base implementation of `shuffle`.
@@ -9,7 +9,7 @@ import values from '../values.js';
* @returns {Array} Returns the new shuffled array.
*/
function baseShuffle(collection) {
return shuffleSelf(values(collection));
return shuffleSelf(values(collection))
}
export default baseShuffle;
export default baseShuffle

View File

@@ -9,23 +9,23 @@
*/
function baseSlice(array, start, end) {
let index = -1,
length = array.length;
length = array.length
if (start < 0) {
start = -start > length ? 0 : (length + start);
start = -start > length ? 0 : (length + start)
}
end = end > length ? length : end;
end = end > length ? length : end
if (end < 0) {
end += length;
end += length
}
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
length = start > end ? 0 : ((end - start) >>> 0)
start >>>= 0
const result = Array(length);
const result = Array(length)
while (++index < length) {
result[index] = array[index + start];
result[index] = array[index + start]
}
return result;
return result
}
export default baseSlice;
export default baseSlice

View File

@@ -1,4 +1,4 @@
import baseEach from './baseEach.js';
import baseEach from './baseEach.js'
/**
* The base implementation of `some`.
@@ -10,13 +10,13 @@ import baseEach from './baseEach.js';
* else `false`.
*/
function baseSome(collection, predicate) {
let result;
let result
baseEach(collection, (value, index, collection) => {
result = predicate(value, index, collection);
return !result;
});
return !!result;
result = predicate(value, index, collection)
return !result
})
return !!result
}
export default baseSome;
export default baseSome

View File

@@ -9,13 +9,13 @@
* @returns {Array} Returns `array`.
*/
function baseSortBy(array, comparer) {
let length = array.length;
let length = array.length
array.sort(comparer);
array.sort(comparer)
while (length--) {
array[length] = array[length].value;
array[length] = array[length].value
}
return array;
return array
}
export default baseSortBy;
export default baseSortBy

View File

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

View File

@@ -1,16 +1,16 @@
import isSymbol from '../isSymbol.js';
import isSymbol from '../isSymbol.js'
/** Used as references for the maximum length and index of an array. */
const MAX_ARRAY_LENGTH = 4294967295;
const MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1;
const MAX_ARRAY_LENGTH = 4294967295
const MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1
/* Built-in method references for those with the same name as other `lodash` methods. */
const nativeFloor = Math.floor, nativeMin = Math.min;
const nativeFloor = Math.floor, nativeMin = Math.min
/**
* The base implementation of `sortedIndexBy` and `sortedLastIndexBy`
* which invokes `iteratee` for `value` and each element of `array` to compute
* their sort ranking. The iteratee is invoked with one argument; (value).
* their sort ranking. The iteratee is invoked with one argument (value).
*
* @private
* @param {Array} array The sorted array to inspect.
@@ -21,44 +21,44 @@ const nativeFloor = Math.floor, nativeMin = Math.min;
* into `array`.
*/
function baseSortedIndexBy(array, value, iteratee, retHighest) {
value = iteratee(value);
value = iteratee(value)
let low = 0;
let high = array == null ? 0 : array.length;
const valIsNaN = value !== value;
const valIsNull = value === null;
const valIsSymbol = isSymbol(value);
const valIsUndefined = value === undefined;
let low = 0
let high = array == null ? 0 : array.length
const valIsNaN = value !== value
const valIsNull = value === null
const valIsSymbol = isSymbol(value)
const valIsUndefined = value === undefined
while (low < high) {
let setLow;
const mid = nativeFloor((low + high) / 2);
const computed = iteratee(array[mid]);
const othIsDefined = computed !== undefined;
const othIsNull = computed === null;
const othIsReflexive = computed === computed;
const othIsSymbol = isSymbol(computed);
let setLow
const mid = nativeFloor((low + high) / 2)
const computed = iteratee(array[mid])
const othIsDefined = computed !== undefined
const othIsNull = computed === null
const othIsReflexive = computed === computed
const othIsSymbol = isSymbol(computed)
if (valIsNaN) {
setLow = retHighest || othIsReflexive;
setLow = retHighest || othIsReflexive
} else if (valIsUndefined) {
setLow = othIsReflexive && (retHighest || othIsDefined);
setLow = othIsReflexive && (retHighest || othIsDefined)
} else if (valIsNull) {
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull)
} else if (valIsSymbol) {
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol)
} else if (othIsNull || othIsSymbol) {
setLow = false;
setLow = false
} else {
setLow = retHighest ? (computed <= value) : (computed < value);
setLow = retHighest ? (computed <= value) : (computed < value)
}
if (setLow) {
low = mid + 1;
low = mid + 1
} else {
high = mid;
high = mid
}
}
return nativeMin(high, MAX_ARRAY_INDEX);
return nativeMin(high, MAX_ARRAY_INDEX)
}
export default baseSortedIndexBy;
export default baseSortedIndexBy

View File

@@ -1,4 +1,4 @@
import eq from '../eq.js';
import eq from '../eq.js'
/**
* The base implementation of `sortedUniq` and `sortedUniqBy`.
@@ -9,21 +9,21 @@ import eq from '../eq.js';
* @returns {Array} Returns the new duplicate free array.
*/
function baseSortedUniq(array, iteratee) {
let seen;
let index = -1;
let resIndex = 0;
let seen
let index = -1
let resIndex = 0
const length = array.length;
const result = [];
const length = array.length
const result = []
while (++index < length) {
const value = array[index], computed = iteratee ? iteratee(value) : value;
const value = array[index], computed = iteratee ? iteratee(value) : value
if (!index || !eq(computed, seen)) {
seen = computed;
result[resIndex++] = value === 0 ? 0 : value;
seen = computed
result[resIndex++] = value === 0 ? 0 : value
}
}
return result;
return result
}
export default baseSortedUniq;
export default baseSortedUniq

View File

@@ -7,17 +7,17 @@
* @returns {number} Returns the sum.
*/
function baseSum(array, iteratee) {
let result;
let index = -1;
const length = array.length;
let result
let index = -1
const length = array.length
while (++index < length) {
const current = iteratee(array[index]);
const current = iteratee(array[index])
if (current !== undefined) {
result = result === undefined ? current : (result + current);
result = result === undefined ? current : (result + current)
}
}
return result;
return result
}
export default baseSum;
export default baseSum

View File

@@ -7,13 +7,13 @@
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
let index = -1;
const result = Array(n);
let index = -1
const result = Array(n)
while (++index < n) {
result[index] = iteratee(index);
result[index] = iteratee(index)
}
return result;
return result
}
export default baseTimes;
export default baseTimes

View File

@@ -1,7 +1,7 @@
import isSymbol from '../isSymbol.js';
import isSymbol from '../isSymbol.js'
/** Used as references for various `Number` constants. */
const NAN = 0 / 0;
const NAN = 0 / 0
/**
* The base implementation of `toNumber` which doesn't ensure correct
@@ -13,12 +13,12 @@ const NAN = 0 / 0;
*/
function baseToNumber(value) {
if (typeof value == 'number') {
return value;
return value
}
if (isSymbol(value)) {
return NAN;
return NAN
}
return +value;
return +value
}
export default baseToNumber;
export default baseToNumber

View File

@@ -1,12 +1,12 @@
import arrayMap from './arrayMap.js';
import isSymbol from '../isSymbol.js';
import arrayMap from './arrayMap.js'
import isSymbol from '../isSymbol.js'
/** Used as references for various `Number` constants. */
const INFINITY = 1 / 0;
const INFINITY = 1 / 0
/** Used to convert symbols to primitives and strings. */
const symbolProto = Symbol ? Symbol.prototype : undefined;
const symbolToString = symbolProto ? symbolProto.toString : undefined;
const symbolProto = Symbol ? Symbol.prototype : undefined
const symbolToString = symbolProto ? symbolProto.toString : undefined
/**
* The base implementation of `toString` which doesn't convert nullish
@@ -19,17 +19,17 @@ const symbolToString = symbolProto ? symbolProto.toString : undefined;
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
return value
}
if (Array.isArray(value)) {
// Recursively convert values (susceptible to call stack limits).
return `${ arrayMap(value, baseToString) }`;
return `${ arrayMap(value, baseToString) }`
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
return symbolToString ? symbolToString.call(value) : ''
}
const result = `${ value }`;
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
const result = `${ value }`
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result
}
export default baseToString;
export default baseToString

View File

@@ -1,12 +1,12 @@
import SetCache from './SetCache.js';
import arrayIncludes from './arrayIncludes.js';
import arrayIncludesWith from './arrayIncludesWith.js';
import cacheHas from './cacheHas.js';
import createSet from './createSet.js';
import setToArray from './setToArray.js';
import SetCache from './SetCache.js'
import arrayIncludes from './arrayIncludes.js'
import arrayIncludesWith from './arrayIncludesWith.js'
import cacheHas from './cacheHas.js'
import createSet from './createSet.js'
import setToArray from './setToArray.js'
/** Used as the size to enable large array optimizations. */
const LARGE_ARRAY_SIZE = 200;
const LARGE_ARRAY_SIZE = 200
/**
* The base implementation of `uniqBy`.
@@ -18,56 +18,56 @@ const LARGE_ARRAY_SIZE = 200;
* @returns {Array} Returns the new duplicate free array.
*/
function baseUniq(array, iteratee, comparator) {
let index = -1;
let includes = arrayIncludes;
let isCommon = true;
let index = -1
let includes = arrayIncludes
let isCommon = true
const length = array.length;
const result = [];
let seen = result;
const length = array.length
const result = []
let seen = result
if (comparator) {
isCommon = false;
includes = arrayIncludesWith;
isCommon = false
includes = arrayIncludesWith
}
else if (length >= LARGE_ARRAY_SIZE) {
const set = iteratee ? null : createSet(array);
const set = iteratee ? null : createSet(array)
if (set) {
return setToArray(set);
return setToArray(set)
}
isCommon = false;
includes = cacheHas;
seen = new SetCache;
isCommon = false
includes = cacheHas
seen = new SetCache
}
else {
seen = iteratee ? [] : result;
seen = iteratee ? [] : result
}
outer:
while (++index < length) {
let value = array[index];
const computed = iteratee ? iteratee(value) : value;
let value = array[index]
const computed = iteratee ? iteratee(value) : value
value = (comparator || value !== 0) ? value : 0;
value = (comparator || value !== 0) ? value : 0
if (isCommon && computed === computed) {
let seenIndex = seen.length;
let seenIndex = seen.length
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
continue outer
}
}
if (iteratee) {
seen.push(computed);
seen.push(computed)
}
result.push(value);
result.push(value)
}
else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
seen.push(computed)
}
result.push(value);
result.push(value)
}
}
return result;
return result
}
export default baseUniq;
export default baseUniq

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