| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| var arrayMap = require('./_arrayMap'), | ||
| baseIteratee = require('./_baseIteratee'), | ||
| baseMap = require('./_baseMap'), | ||
| baseSortBy = require('./_baseSortBy'), | ||
| baseUnary = require('./_baseUnary'), | ||
| compareMultiple = require('./_compareMultiple'), | ||
| identity = require('./identity'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.orderBy` without param guards. | ||
| * | ||
| * @private | ||
| * @param {Array|Object} collection The collection to iterate over. | ||
| * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. | ||
| * @param {string[]} orders The sort orders of `iteratees`. | ||
| * @returns {Array} Returns the new sorted array. | ||
| */ | ||
| function baseOrderBy(collection, iteratees, orders) { | ||
| var index = -1; | ||
| iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee)); | ||
|
|
||
| var result = baseMap(collection, function(value, key, collection) { | ||
| var criteria = arrayMap(iteratees, function(iteratee) { | ||
| return iteratee(value); | ||
| }); | ||
| return { 'criteria': criteria, 'index': ++index, 'value': value }; | ||
| }); | ||
|
|
||
| return baseSortBy(result, function(object, other) { | ||
| return compareMultiple(object, other, orders); | ||
| }); | ||
| } | ||
|
|
||
| module.exports = baseOrderBy; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| var basePickBy = require('./_basePickBy'), | ||
| hasIn = require('./hasIn'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.pick` without support for individual | ||
| * property identifiers. | ||
| * | ||
| * @private | ||
| * @param {Object} object The source object. | ||
| * @param {string[]} paths The property paths to pick. | ||
| * @returns {Object} Returns the new object. | ||
| */ | ||
| function basePick(object, paths) { | ||
| return basePickBy(object, paths, function(value, path) { | ||
| return hasIn(object, path); | ||
| }); | ||
| } | ||
|
|
||
| module.exports = basePick; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| var baseGet = require('./_baseGet'), | ||
| baseSet = require('./_baseSet'), | ||
| castPath = require('./_castPath'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.pickBy` without support for iteratee shorthands. | ||
| * | ||
| * @private | ||
| * @param {Object} object The source object. | ||
| * @param {string[]} paths The property paths to pick. | ||
| * @param {Function} predicate The function invoked per property. | ||
| * @returns {Object} Returns the new object. | ||
| */ | ||
| function basePickBy(object, paths, predicate) { | ||
| var index = -1, | ||
| length = paths.length, | ||
| result = {}; | ||
|
|
||
| while (++index < length) { | ||
| var path = paths[index], | ||
| value = baseGet(object, path); | ||
|
|
||
| if (predicate(value, path)) { | ||
| baseSet(result, castPath(path, object), value); | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = basePickBy; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /** | ||
| * The base implementation of `_.property` without support for deep paths. | ||
| * | ||
| * @private | ||
| * @param {string} key The key of the property to get. | ||
| * @returns {Function} Returns the new accessor function. | ||
| */ | ||
| function baseProperty(key) { | ||
| return function(object) { | ||
| return object == null ? undefined : object[key]; | ||
| }; | ||
| } | ||
|
|
||
| module.exports = baseProperty; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| var baseGet = require('./_baseGet'); | ||
|
|
||
| /** | ||
| * A specialized version of `baseProperty` which supports deep paths. | ||
| * | ||
| * @private | ||
| * @param {Array|string} path The path of the property to get. | ||
| * @returns {Function} Returns the new accessor function. | ||
| */ | ||
| function basePropertyDeep(path) { | ||
| return function(object) { | ||
| return baseGet(object, path); | ||
| }; | ||
| } | ||
|
|
||
| module.exports = basePropertyDeep; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /** | ||
| * The base implementation of `_.propertyOf` without support for deep paths. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to query. | ||
| * @returns {Function} Returns the new accessor function. | ||
| */ | ||
| function basePropertyOf(object) { | ||
| return function(key) { | ||
| return object == null ? undefined : object[key]; | ||
| }; | ||
| } | ||
|
|
||
| module.exports = basePropertyOf; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| var arrayMap = require('./_arrayMap'), | ||
| baseIndexOf = require('./_baseIndexOf'), | ||
| baseIndexOfWith = require('./_baseIndexOfWith'), | ||
| baseUnary = require('./_baseUnary'), | ||
| copyArray = require('./_copyArray'); | ||
|
|
||
| /** Used for built-in method references. */ | ||
| var arrayProto = Array.prototype; | ||
|
|
||
| /** Built-in value references. */ | ||
| var splice = arrayProto.splice; | ||
|
|
||
| /** | ||
| * The base implementation of `_.pullAllBy` without support for iteratee | ||
| * shorthands. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to modify. | ||
| * @param {Array} values The values to remove. | ||
| * @param {Function} [iteratee] The iteratee invoked per element. | ||
| * @param {Function} [comparator] The comparator invoked per element. | ||
| * @returns {Array} Returns `array`. | ||
| */ | ||
| function basePullAll(array, values, iteratee, comparator) { | ||
| var indexOf = comparator ? baseIndexOfWith : baseIndexOf, | ||
| index = -1, | ||
| length = values.length, | ||
| seen = array; | ||
|
|
||
| if (array === values) { | ||
| values = copyArray(values); | ||
| } | ||
| if (iteratee) { | ||
| seen = arrayMap(array, baseUnary(iteratee)); | ||
| } | ||
| while (++index < length) { | ||
| var fromIndex = 0, | ||
| value = values[index], | ||
| computed = iteratee ? iteratee(value) : value; | ||
|
|
||
| while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { | ||
| if (seen !== array) { | ||
| splice.call(seen, fromIndex, 1); | ||
| } | ||
| splice.call(array, fromIndex, 1); | ||
| } | ||
| } | ||
| return array; | ||
| } | ||
|
|
||
| module.exports = basePullAll; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| var baseUnset = require('./_baseUnset'), | ||
| isIndex = require('./_isIndex'); | ||
|
|
||
| /** Used for built-in method references. */ | ||
| var arrayProto = Array.prototype; | ||
|
|
||
| /** Built-in value references. */ | ||
| var splice = arrayProto.splice; | ||
|
|
||
| /** | ||
| * The base implementation of `_.pullAt` without support for individual | ||
| * indexes or capturing the removed elements. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to modify. | ||
| * @param {number[]} indexes The indexes of elements to remove. | ||
| * @returns {Array} Returns `array`. | ||
| */ | ||
| function basePullAt(array, indexes) { | ||
| var length = array ? indexes.length : 0, | ||
| lastIndex = length - 1; | ||
|
|
||
| while (length--) { | ||
| var index = indexes[length]; | ||
| if (length == lastIndex || index !== previous) { | ||
| var previous = index; | ||
| if (isIndex(index)) { | ||
| splice.call(array, index, 1); | ||
| } else { | ||
| baseUnset(array, index); | ||
| } | ||
| } | ||
| } | ||
| return array; | ||
| } | ||
|
|
||
| module.exports = basePullAt; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* Built-in method references for those with the same name as other `lodash` methods. */ | ||
| var nativeFloor = Math.floor, | ||
| nativeRandom = Math.random; | ||
|
|
||
| /** | ||
| * The base implementation of `_.random` without support for returning | ||
| * floating-point numbers. | ||
| * | ||
| * @private | ||
| * @param {number} lower The lower bound. | ||
| * @param {number} upper The upper bound. | ||
| * @returns {number} Returns the random number. | ||
| */ | ||
| function baseRandom(lower, upper) { | ||
| return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); | ||
| } | ||
|
|
||
| module.exports = baseRandom; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* Built-in method references for those with the same name as other `lodash` methods. */ | ||
| var nativeCeil = Math.ceil, | ||
| nativeMax = Math.max; | ||
|
|
||
| /** | ||
| * The base implementation of `_.range` and `_.rangeRight` which doesn't | ||
| * coerce arguments. | ||
| * | ||
| * @private | ||
| * @param {number} start The start of the range. | ||
| * @param {number} end The end of the range. | ||
| * @param {number} step The value to increment or decrement by. | ||
| * @param {boolean} [fromRight] Specify iterating from right to left. | ||
| * @returns {Array} Returns the range of numbers. | ||
| */ | ||
| function baseRange(start, end, step, fromRight) { | ||
| var index = -1, | ||
| length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), | ||
| result = Array(length); | ||
|
|
||
| while (length--) { | ||
| result[fromRight ? length : ++index] = start; | ||
| start += step; | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = baseRange; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /** | ||
| * The base implementation of `_.reduce` and `_.reduceRight`, without support | ||
| * for iteratee shorthands, which iterates over `collection` using `eachFunc`. | ||
| * | ||
| * @private | ||
| * @param {Array|Object} collection The collection to iterate over. | ||
| * @param {Function} iteratee The function invoked per iteration. | ||
| * @param {*} accumulator The initial value. | ||
| * @param {boolean} initAccum Specify using the first or last element of | ||
| * `collection` as the initial value. | ||
| * @param {Function} eachFunc The function to iterate over `collection`. | ||
| * @returns {*} Returns the accumulated value. | ||
| */ | ||
| function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { | ||
| eachFunc(collection, function(value, index, collection) { | ||
| accumulator = initAccum | ||
| ? (initAccum = false, value) | ||
| : iteratee(accumulator, value, index, collection); | ||
| }); | ||
| return accumulator; | ||
| } | ||
|
|
||
| module.exports = baseReduce; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /** Used as references for various `Number` constants. */ | ||
| var MAX_SAFE_INTEGER = 9007199254740991; | ||
|
|
||
| /* Built-in method references for those with the same name as other `lodash` methods. */ | ||
| var nativeFloor = Math.floor; | ||
|
|
||
| /** | ||
| * The base implementation of `_.repeat` which doesn't coerce arguments. | ||
| * | ||
| * @private | ||
| * @param {string} string The string to repeat. | ||
| * @param {number} n The number of times to repeat the string. | ||
| * @returns {string} Returns the repeated string. | ||
| */ | ||
| function baseRepeat(string, n) { | ||
| var result = ''; | ||
| if (!string || n < 1 || n > MAX_SAFE_INTEGER) { | ||
| 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; | ||
| } | ||
| n = nativeFloor(n / 2); | ||
| if (n) { | ||
| string += string; | ||
| } | ||
| } while (n); | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| module.exports = baseRepeat; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| var identity = require('./identity'), | ||
| overRest = require('./_overRest'), | ||
| setToString = require('./_setToString'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.rest` which doesn't validate or coerce arguments. | ||
| * | ||
| * @private | ||
| * @param {Function} func The function to apply a rest parameter to. | ||
| * @param {number} [start=func.length-1] The start position of the rest parameter. | ||
| * @returns {Function} Returns the new function. | ||
| */ | ||
| function baseRest(func, start) { | ||
| return setToString(overRest(func, start, identity), func + ''); | ||
| } | ||
|
|
||
| module.exports = baseRest; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| var arraySample = require('./_arraySample'), | ||
| values = require('./values'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.sample`. | ||
| * | ||
| * @private | ||
| * @param {Array|Object} collection The collection to sample. | ||
| * @returns {*} Returns the random element. | ||
| */ | ||
| function baseSample(collection) { | ||
| return arraySample(values(collection)); | ||
| } | ||
|
|
||
| module.exports = baseSample; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| var baseClamp = require('./_baseClamp'), | ||
| shuffleSelf = require('./_shuffleSelf'), | ||
| values = require('./values'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.sampleSize` without param guards. | ||
| * | ||
| * @private | ||
| * @param {Array|Object} collection The collection to sample. | ||
| * @param {number} n The number of elements to sample. | ||
| * @returns {Array} Returns the random elements. | ||
| */ | ||
| function baseSampleSize(collection, n) { | ||
| var array = values(collection); | ||
| return shuffleSelf(array, baseClamp(n, 0, array.length)); | ||
| } | ||
|
|
||
| module.exports = baseSampleSize; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| var assignValue = require('./_assignValue'), | ||
| castPath = require('./_castPath'), | ||
| isIndex = require('./_isIndex'), | ||
| isObject = require('./isObject'), | ||
| toKey = require('./_toKey'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.set`. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to modify. | ||
| * @param {Array|string} path The path of the property to set. | ||
| * @param {*} value The value to set. | ||
| * @param {Function} [customizer] The function to customize path creation. | ||
| * @returns {Object} Returns `object`. | ||
| */ | ||
| function baseSet(object, path, value, customizer) { | ||
| if (!isObject(object)) { | ||
| return object; | ||
| } | ||
| path = castPath(path, object); | ||
|
|
||
| var index = -1, | ||
| length = path.length, | ||
| lastIndex = length - 1, | ||
| nested = object; | ||
|
|
||
| while (nested != null && ++index < length) { | ||
| var key = toKey(path[index]), | ||
| newValue = value; | ||
|
|
||
| if (index != lastIndex) { | ||
| var objValue = nested[key]; | ||
| newValue = customizer ? customizer(objValue, key, nested) : undefined; | ||
| if (newValue === undefined) { | ||
| newValue = isObject(objValue) | ||
| ? objValue | ||
| : (isIndex(path[index + 1]) ? [] : {}); | ||
| } | ||
| } | ||
| assignValue(nested, key, newValue); | ||
| nested = nested[key]; | ||
| } | ||
| return object; | ||
| } | ||
|
|
||
| module.exports = baseSet; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| var identity = require('./identity'), | ||
| metaMap = require('./_metaMap'); | ||
|
|
||
| /** | ||
| * The base implementation of `setData` without support for hot loop shorting. | ||
| * | ||
| * @private | ||
| * @param {Function} func The function to associate metadata with. | ||
| * @param {*} data The metadata. | ||
| * @returns {Function} Returns `func`. | ||
| */ | ||
| var baseSetData = !metaMap ? identity : function(func, data) { | ||
| metaMap.set(func, data); | ||
| return func; | ||
| }; | ||
|
|
||
| module.exports = baseSetData; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| var constant = require('./constant'), | ||
| defineProperty = require('./_defineProperty'), | ||
| identity = require('./identity'); | ||
|
|
||
| /** | ||
| * The base implementation of `setToString` without support for hot loop shorting. | ||
| * | ||
| * @private | ||
| * @param {Function} func The function to modify. | ||
| * @param {Function} string The `toString` result. | ||
| * @returns {Function} Returns `func`. | ||
| */ | ||
| var baseSetToString = !defineProperty ? identity : function(func, string) { | ||
| return defineProperty(func, 'toString', { | ||
| 'configurable': true, | ||
| 'enumerable': false, | ||
| 'value': constant(string), | ||
| 'writable': true | ||
| }); | ||
| }; | ||
|
|
||
| module.exports = baseSetToString; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| var shuffleSelf = require('./_shuffleSelf'), | ||
| values = require('./values'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.shuffle`. | ||
| * | ||
| * @private | ||
| * @param {Array|Object} collection The collection to shuffle. | ||
| * @returns {Array} Returns the new shuffled array. | ||
| */ | ||
| function baseShuffle(collection) { | ||
| return shuffleSelf(values(collection)); | ||
| } | ||
|
|
||
| module.exports = baseShuffle; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /** | ||
| * The base implementation of `_.slice` without an iteratee call guard. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to slice. | ||
| * @param {number} [start=0] The start position. | ||
| * @param {number} [end=array.length] The end position. | ||
| * @returns {Array} Returns the slice of `array`. | ||
| */ | ||
| function baseSlice(array, start, end) { | ||
| var index = -1, | ||
| length = array.length; | ||
|
|
||
| if (start < 0) { | ||
| start = -start > length ? 0 : (length + start); | ||
| } | ||
| end = end > length ? length : end; | ||
| if (end < 0) { | ||
| end += length; | ||
| } | ||
| length = start > end ? 0 : ((end - start) >>> 0); | ||
| start >>>= 0; | ||
|
|
||
| var result = Array(length); | ||
| while (++index < length) { | ||
| result[index] = array[index + start]; | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = baseSlice; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| var baseEach = require('./_baseEach'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.some` without support for iteratee shorthands. | ||
| * | ||
| * @private | ||
| * @param {Array|Object} collection The collection to iterate over. | ||
| * @param {Function} predicate The function invoked per iteration. | ||
| * @returns {boolean} Returns `true` if any element passes the predicate check, | ||
| * else `false`. | ||
| */ | ||
| function baseSome(collection, predicate) { | ||
| var result; | ||
|
|
||
| baseEach(collection, function(value, index, collection) { | ||
| result = predicate(value, index, collection); | ||
| return !result; | ||
| }); | ||
| return !!result; | ||
| } | ||
|
|
||
| module.exports = baseSome; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /** | ||
| * The base implementation of `_.sortBy` which uses `comparer` to define the | ||
| * sort order of `array` and replaces criteria objects with their corresponding | ||
| * values. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to sort. | ||
| * @param {Function} comparer The function to define sort order. | ||
| * @returns {Array} Returns `array`. | ||
| */ | ||
| function baseSortBy(array, comparer) { | ||
| var length = array.length; | ||
|
|
||
| array.sort(comparer); | ||
| while (length--) { | ||
| array[length] = array[length].value; | ||
| } | ||
| return array; | ||
| } | ||
|
|
||
| module.exports = baseSortBy; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| var baseSortedIndexBy = require('./_baseSortedIndexBy'), | ||
| identity = require('./identity'), | ||
| isSymbol = require('./isSymbol'); | ||
|
|
||
| /** Used as references for the maximum length and index of an array. */ | ||
| var MAX_ARRAY_LENGTH = 4294967295, | ||
| HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; | ||
|
|
||
| /** | ||
| * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which | ||
| * performs a binary search of `array` to determine the index at which `value` | ||
| * should be inserted into `array` in order to maintain its sort order. | ||
| * | ||
| * @private | ||
| * @param {Array} array The sorted array to inspect. | ||
| * @param {*} value The value to evaluate. | ||
| * @param {boolean} [retHighest] Specify returning the highest qualified index. | ||
| * @returns {number} Returns the index at which `value` should be inserted | ||
| * into `array`. | ||
| */ | ||
| function baseSortedIndex(array, value, retHighest) { | ||
| var low = 0, | ||
| high = array == null ? low : array.length; | ||
|
|
||
| if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { | ||
| while (low < high) { | ||
| var mid = (low + high) >>> 1, | ||
| computed = array[mid]; | ||
|
|
||
| if (computed !== null && !isSymbol(computed) && | ||
| (retHighest ? (computed <= value) : (computed < value))) { | ||
| low = mid + 1; | ||
| } else { | ||
| high = mid; | ||
| } | ||
| } | ||
| return high; | ||
| } | ||
| return baseSortedIndexBy(array, value, identity, retHighest); | ||
| } | ||
|
|
||
| module.exports = baseSortedIndex; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| var isSymbol = require('./isSymbol'); | ||
|
|
||
| /** Used as references for the maximum length and index of an array. */ | ||
| var MAX_ARRAY_LENGTH = 4294967295, | ||
| MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; | ||
|
|
||
| /* Built-in method references for those with the same name as other `lodash` methods. */ | ||
| var nativeFloor = Math.floor, | ||
| nativeMin = Math.min; | ||
|
|
||
| /** | ||
| * 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). | ||
| * | ||
| * @private | ||
| * @param {Array} array The sorted array to inspect. | ||
| * @param {*} value The value to evaluate. | ||
| * @param {Function} iteratee The iteratee invoked per element. | ||
| * @param {boolean} [retHighest] Specify returning the highest qualified index. | ||
| * @returns {number} Returns the index at which `value` should be inserted | ||
| * into `array`. | ||
| */ | ||
| function baseSortedIndexBy(array, value, iteratee, retHighest) { | ||
| value = iteratee(value); | ||
|
|
||
| var low = 0, | ||
| high = array == null ? 0 : array.length, | ||
| valIsNaN = value !== value, | ||
| valIsNull = value === null, | ||
| valIsSymbol = isSymbol(value), | ||
| valIsUndefined = value === undefined; | ||
|
|
||
| while (low < high) { | ||
| var mid = nativeFloor((low + high) / 2), | ||
| computed = iteratee(array[mid]), | ||
| othIsDefined = computed !== undefined, | ||
| othIsNull = computed === null, | ||
| othIsReflexive = computed === computed, | ||
| othIsSymbol = isSymbol(computed); | ||
|
|
||
| if (valIsNaN) { | ||
| var setLow = retHighest || othIsReflexive; | ||
| } else if (valIsUndefined) { | ||
| setLow = othIsReflexive && (retHighest || othIsDefined); | ||
| } else if (valIsNull) { | ||
| setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); | ||
| } else if (valIsSymbol) { | ||
| setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); | ||
| } else if (othIsNull || othIsSymbol) { | ||
| setLow = false; | ||
| } else { | ||
| setLow = retHighest ? (computed <= value) : (computed < value); | ||
| } | ||
| if (setLow) { | ||
| low = mid + 1; | ||
| } else { | ||
| high = mid; | ||
| } | ||
| } | ||
| return nativeMin(high, MAX_ARRAY_INDEX); | ||
| } | ||
|
|
||
| module.exports = baseSortedIndexBy; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| var eq = require('./eq'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without | ||
| * support for iteratee shorthands. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to inspect. | ||
| * @param {Function} [iteratee] The iteratee invoked per element. | ||
| * @returns {Array} Returns the new duplicate free array. | ||
| */ | ||
| function baseSortedUniq(array, iteratee) { | ||
| var index = -1, | ||
| length = array.length, | ||
| resIndex = 0, | ||
| result = []; | ||
|
|
||
| while (++index < length) { | ||
| var value = array[index], | ||
| computed = iteratee ? iteratee(value) : value; | ||
|
|
||
| if (!index || !eq(computed, seen)) { | ||
| var seen = computed; | ||
| result[resIndex++] = value === 0 ? 0 : value; | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = baseSortedUniq; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /** | ||
| * The base implementation of `_.sum` and `_.sumBy` without support for | ||
| * iteratee shorthands. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to iterate over. | ||
| * @param {Function} iteratee The function invoked per iteration. | ||
| * @returns {number} Returns the sum. | ||
| */ | ||
| function baseSum(array, iteratee) { | ||
| var result, | ||
| index = -1, | ||
| length = array.length; | ||
|
|
||
| while (++index < length) { | ||
| var current = iteratee(array[index]); | ||
| if (current !== undefined) { | ||
| result = result === undefined ? current : (result + current); | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = baseSum; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * The base implementation of `_.times` without support for iteratee shorthands | ||
| * or max array length checks. | ||
| * | ||
| * @private | ||
| * @param {number} n The number of times to invoke `iteratee`. | ||
| * @param {Function} iteratee The function invoked per iteration. | ||
| * @returns {Array} Returns the array of results. | ||
| */ | ||
| function baseTimes(n, iteratee) { | ||
| var index = -1, | ||
| result = Array(n); | ||
|
|
||
| while (++index < n) { | ||
| result[index] = iteratee(index); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = baseTimes; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| var isSymbol = require('./isSymbol'); | ||
|
|
||
| /** Used as references for various `Number` constants. */ | ||
| var NAN = 0 / 0; | ||
|
|
||
| /** | ||
| * The base implementation of `_.toNumber` which doesn't ensure correct | ||
| * conversions of binary, hexadecimal, or octal string values. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to process. | ||
| * @returns {number} Returns the number. | ||
| */ | ||
| function baseToNumber(value) { | ||
| if (typeof value == 'number') { | ||
| return value; | ||
| } | ||
| if (isSymbol(value)) { | ||
| return NAN; | ||
| } | ||
| return +value; | ||
| } | ||
|
|
||
| module.exports = baseToNumber; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| var arrayMap = require('./_arrayMap'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array | ||
| * of key-value pairs for `object` corresponding to the property names of `props`. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to query. | ||
| * @param {Array} props The property names to get values for. | ||
| * @returns {Object} Returns the key-value pairs. | ||
| */ | ||
| function baseToPairs(object, props) { | ||
| return arrayMap(props, function(key) { | ||
| return [key, object[key]]; | ||
| }); | ||
| } | ||
|
|
||
| module.exports = baseToPairs; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| var Symbol = require('./_Symbol'), | ||
| arrayMap = require('./_arrayMap'), | ||
| isArray = require('./isArray'), | ||
| isSymbol = require('./isSymbol'); | ||
|
|
||
| /** Used as references for various `Number` constants. */ | ||
| var INFINITY = 1 / 0; | ||
|
|
||
| /** Used to convert symbols to primitives and strings. */ | ||
| var symbolProto = Symbol ? Symbol.prototype : undefined, | ||
| symbolToString = symbolProto ? symbolProto.toString : undefined; | ||
|
|
||
| /** | ||
| * The base implementation of `_.toString` which doesn't convert nullish | ||
| * values to empty strings. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to process. | ||
| * @returns {string} Returns the string. | ||
| */ | ||
| function baseToString(value) { | ||
| // Exit early for strings to avoid a performance hit in some environments. | ||
| if (typeof value == 'string') { | ||
| return value; | ||
| } | ||
| if (isArray(value)) { | ||
| // Recursively convert values (susceptible to call stack limits). | ||
| return arrayMap(value, baseToString) + ''; | ||
| } | ||
| if (isSymbol(value)) { | ||
| return symbolToString ? symbolToString.call(value) : ''; | ||
| } | ||
| var result = (value + ''); | ||
| return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; | ||
| } | ||
|
|
||
| module.exports = baseToString; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /** | ||
| * The base implementation of `_.unary` without support for storing metadata. | ||
| * | ||
| * @private | ||
| * @param {Function} func The function to cap arguments for. | ||
| * @returns {Function} Returns the new capped function. | ||
| */ | ||
| function baseUnary(func) { | ||
| return function(value) { | ||
| return func(value); | ||
| }; | ||
| } | ||
|
|
||
| module.exports = baseUnary; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| var SetCache = require('./_SetCache'), | ||
| arrayIncludes = require('./_arrayIncludes'), | ||
| arrayIncludesWith = require('./_arrayIncludesWith'), | ||
| cacheHas = require('./_cacheHas'), | ||
| createSet = require('./_createSet'), | ||
| setToArray = require('./_setToArray'); | ||
|
|
||
| /** Used as the size to enable large array optimizations. */ | ||
| var LARGE_ARRAY_SIZE = 200; | ||
|
|
||
| /** | ||
| * The base implementation of `_.uniqBy` without support for iteratee shorthands. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to inspect. | ||
| * @param {Function} [iteratee] The iteratee invoked per element. | ||
| * @param {Function} [comparator] The comparator invoked per element. | ||
| * @returns {Array} Returns the new duplicate free array. | ||
| */ | ||
| function baseUniq(array, iteratee, comparator) { | ||
| var index = -1, | ||
| includes = arrayIncludes, | ||
| length = array.length, | ||
| isCommon = true, | ||
| result = [], | ||
| seen = result; | ||
|
|
||
| if (comparator) { | ||
| isCommon = false; | ||
| includes = arrayIncludesWith; | ||
| } | ||
| else if (length >= LARGE_ARRAY_SIZE) { | ||
| var set = iteratee ? null : createSet(array); | ||
| if (set) { | ||
| return setToArray(set); | ||
| } | ||
| isCommon = false; | ||
| includes = cacheHas; | ||
| seen = new SetCache; | ||
| } | ||
| else { | ||
| seen = iteratee ? [] : result; | ||
| } | ||
| outer: | ||
| while (++index < length) { | ||
| var value = array[index], | ||
| computed = iteratee ? iteratee(value) : value; | ||
|
|
||
| value = (comparator || value !== 0) ? value : 0; | ||
| if (isCommon && computed === computed) { | ||
| var seenIndex = seen.length; | ||
| while (seenIndex--) { | ||
| if (seen[seenIndex] === computed) { | ||
| continue outer; | ||
| } | ||
| } | ||
| if (iteratee) { | ||
| seen.push(computed); | ||
| } | ||
| result.push(value); | ||
| } | ||
| else if (!includes(seen, computed, comparator)) { | ||
| if (seen !== result) { | ||
| seen.push(computed); | ||
| } | ||
| result.push(value); | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = baseUniq; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| var castPath = require('./_castPath'), | ||
| last = require('./last'), | ||
| parent = require('./_parent'), | ||
| toKey = require('./_toKey'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.unset`. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to modify. | ||
| * @param {Array|string} path The property path to unset. | ||
| * @returns {boolean} Returns `true` if the property is deleted, else `false`. | ||
| */ | ||
| function baseUnset(object, path) { | ||
| path = castPath(path, object); | ||
| object = parent(object, path); | ||
| return object == null || delete object[toKey(last(path))]; | ||
| } | ||
|
|
||
| module.exports = baseUnset; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| var baseGet = require('./_baseGet'), | ||
| baseSet = require('./_baseSet'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.update`. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to modify. | ||
| * @param {Array|string} path The path of the property to update. | ||
| * @param {Function} updater The function to produce the updated value. | ||
| * @param {Function} [customizer] The function to customize path creation. | ||
| * @returns {Object} Returns `object`. | ||
| */ | ||
| function baseUpdate(object, path, updater, customizer) { | ||
| return baseSet(object, path, updater(baseGet(object, path)), customizer); | ||
| } | ||
|
|
||
| module.exports = baseUpdate; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| var arrayMap = require('./_arrayMap'); | ||
|
|
||
| /** | ||
| * The base implementation of `_.values` and `_.valuesIn` which creates an | ||
| * array of `object` property values corresponding to the property names | ||
| * of `props`. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to query. | ||
| * @param {Array} props The property names to get values for. | ||
| * @returns {Object} Returns the array of property values. | ||
| */ | ||
| function baseValues(object, props) { | ||
| return arrayMap(props, function(key) { | ||
| return object[key]; | ||
| }); | ||
| } | ||
|
|
||
| module.exports = baseValues; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| var baseSlice = require('./_baseSlice'); | ||
|
|
||
| /** | ||
| * The base implementation of methods like `_.dropWhile` and `_.takeWhile` | ||
| * without support for iteratee shorthands. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to query. | ||
| * @param {Function} predicate The function invoked per iteration. | ||
| * @param {boolean} [isDrop] Specify dropping elements instead of taking them. | ||
| * @param {boolean} [fromRight] Specify iterating from right to left. | ||
| * @returns {Array} Returns the slice of `array`. | ||
| */ | ||
| function baseWhile(array, predicate, isDrop, fromRight) { | ||
| var length = array.length, | ||
| index = fromRight ? length : -1; | ||
|
|
||
| while ((fromRight ? index-- : ++index < length) && | ||
| predicate(array[index], index, array)) {} | ||
|
|
||
| return isDrop | ||
| ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) | ||
| : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); | ||
| } | ||
|
|
||
| module.exports = baseWhile; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| var LazyWrapper = require('./_LazyWrapper'), | ||
| arrayPush = require('./_arrayPush'), | ||
| arrayReduce = require('./_arrayReduce'); | ||
|
|
||
| /** | ||
| * The base implementation of `wrapperValue` which returns the result of | ||
| * performing a sequence of actions on the unwrapped `value`, where each | ||
| * successive action is supplied the return value of the previous. | ||
| * | ||
| * @private | ||
| * @param {*} value The unwrapped value. | ||
| * @param {Array} actions Actions to perform to resolve the unwrapped value. | ||
| * @returns {*} Returns the resolved value. | ||
| */ | ||
| function baseWrapperValue(value, actions) { | ||
| var result = value; | ||
| if (result instanceof LazyWrapper) { | ||
| result = result.value(); | ||
| } | ||
| return arrayReduce(actions, function(result, action) { | ||
| return action.func.apply(action.thisArg, arrayPush([result], action.args)); | ||
| }, result); | ||
| } | ||
|
|
||
| module.exports = baseWrapperValue; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| var baseDifference = require('./_baseDifference'), | ||
| baseFlatten = require('./_baseFlatten'), | ||
| baseUniq = require('./_baseUniq'); | ||
|
|
||
| /** | ||
| * The base implementation of methods like `_.xor`, without support for | ||
| * iteratee shorthands, that accepts an array of arrays to inspect. | ||
| * | ||
| * @private | ||
| * @param {Array} arrays The arrays to inspect. | ||
| * @param {Function} [iteratee] The iteratee invoked per element. | ||
| * @param {Function} [comparator] The comparator invoked per element. | ||
| * @returns {Array} Returns the new array of values. | ||
| */ | ||
| function baseXor(arrays, iteratee, comparator) { | ||
| var length = arrays.length; | ||
| if (length < 2) { | ||
| return length ? baseUniq(arrays[0]) : []; | ||
| } | ||
| var index = -1, | ||
| result = Array(length); | ||
|
|
||
| while (++index < length) { | ||
| var array = arrays[index], | ||
| othIndex = -1; | ||
|
|
||
| while (++othIndex < length) { | ||
| if (othIndex != index) { | ||
| result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); | ||
| } | ||
| } | ||
| } | ||
| return baseUniq(baseFlatten(result, 1), iteratee, comparator); | ||
| } | ||
|
|
||
| module.exports = baseXor; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /** | ||
| * This base implementation of `_.zipObject` which assigns values using `assignFunc`. | ||
| * | ||
| * @private | ||
| * @param {Array} props The property identifiers. | ||
| * @param {Array} values The property values. | ||
| * @param {Function} assignFunc The function to assign values. | ||
| * @returns {Object} Returns the new object. | ||
| */ | ||
| function baseZipObject(props, values, assignFunc) { | ||
| var index = -1, | ||
| length = props.length, | ||
| valsLength = values.length, | ||
| result = {}; | ||
|
|
||
| while (++index < length) { | ||
| var value = index < valsLength ? values[index] : undefined; | ||
| assignFunc(result, props[index], value); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = baseZipObject; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /** | ||
| * Checks if a `cache` value for `key` exists. | ||
| * | ||
| * @private | ||
| * @param {Object} cache The cache to query. | ||
| * @param {string} key The key of the entry to check. | ||
| * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. | ||
| */ | ||
| function cacheHas(cache, key) { | ||
| return cache.has(key); | ||
| } | ||
|
|
||
| module.exports = cacheHas; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| var isArrayLikeObject = require('./isArrayLikeObject'); | ||
|
|
||
| /** | ||
| * Casts `value` to an empty array if it's not an array like object. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to inspect. | ||
| * @returns {Array|Object} Returns the cast array-like object. | ||
| */ | ||
| function castArrayLikeObject(value) { | ||
| return isArrayLikeObject(value) ? value : []; | ||
| } | ||
|
|
||
| module.exports = castArrayLikeObject; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| var identity = require('./identity'); | ||
|
|
||
| /** | ||
| * Casts `value` to `identity` if it's not a function. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to inspect. | ||
| * @returns {Function} Returns cast function. | ||
| */ | ||
| function castFunction(value) { | ||
| return typeof value == 'function' ? value : identity; | ||
| } | ||
|
|
||
| module.exports = castFunction; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| var isArray = require('./isArray'), | ||
| isKey = require('./_isKey'), | ||
| stringToPath = require('./_stringToPath'), | ||
| toString = require('./toString'); | ||
|
|
||
| /** | ||
| * Casts `value` to a path array if it's not one. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to inspect. | ||
| * @param {Object} [object] The object to query keys on. | ||
| * @returns {Array} Returns the cast property path array. | ||
| */ | ||
| function castPath(value, object) { | ||
| if (isArray(value)) { | ||
| return value; | ||
| } | ||
| return isKey(value, object) ? [value] : stringToPath(toString(value)); | ||
| } | ||
|
|
||
| module.exports = castPath; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| var baseRest = require('./_baseRest'); | ||
|
|
||
| /** | ||
| * A `baseRest` alias which can be replaced with `identity` by module | ||
| * replacement plugins. | ||
| * | ||
| * @private | ||
| * @type {Function} | ||
| * @param {Function} func The function to apply a rest parameter to. | ||
| * @returns {Function} Returns the new function. | ||
| */ | ||
| var castRest = baseRest; | ||
|
|
||
| module.exports = castRest; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| var baseSlice = require('./_baseSlice'); | ||
|
|
||
| /** | ||
| * Casts `array` to a slice if it's needed. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to inspect. | ||
| * @param {number} start The start position. | ||
| * @param {number} [end=array.length] The end position. | ||
| * @returns {Array} Returns the cast slice. | ||
| */ | ||
| function castSlice(array, start, end) { | ||
| var length = array.length; | ||
| end = end === undefined ? length : end; | ||
| return (!start && end >= length) ? array : baseSlice(array, start, end); | ||
| } | ||
|
|
||
| module.exports = castSlice; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| var baseIndexOf = require('./_baseIndexOf'); | ||
|
|
||
| /** | ||
| * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol | ||
| * that is not found in the character symbols. | ||
| * | ||
| * @private | ||
| * @param {Array} strSymbols The string symbols to inspect. | ||
| * @param {Array} chrSymbols The character symbols to find. | ||
| * @returns {number} Returns the index of the last unmatched string symbol. | ||
| */ | ||
| function charsEndIndex(strSymbols, chrSymbols) { | ||
| var index = strSymbols.length; | ||
|
|
||
| while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} | ||
| return index; | ||
| } | ||
|
|
||
| module.exports = charsEndIndex; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| var baseIndexOf = require('./_baseIndexOf'); | ||
|
|
||
| /** | ||
| * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol | ||
| * that is not found in the character symbols. | ||
| * | ||
| * @private | ||
| * @param {Array} strSymbols The string symbols to inspect. | ||
| * @param {Array} chrSymbols The character symbols to find. | ||
| * @returns {number} Returns the index of the first unmatched string symbol. | ||
| */ | ||
| function charsStartIndex(strSymbols, chrSymbols) { | ||
| var index = -1, | ||
| length = strSymbols.length; | ||
|
|
||
| while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} | ||
| return index; | ||
| } | ||
|
|
||
| module.exports = charsStartIndex; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| var Uint8Array = require('./_Uint8Array'); | ||
|
|
||
| /** | ||
| * Creates a clone of `arrayBuffer`. | ||
| * | ||
| * @private | ||
| * @param {ArrayBuffer} arrayBuffer The array buffer to clone. | ||
| * @returns {ArrayBuffer} Returns the cloned array buffer. | ||
| */ | ||
| function cloneArrayBuffer(arrayBuffer) { | ||
| var result = new arrayBuffer.constructor(arrayBuffer.byteLength); | ||
| new Uint8Array(result).set(new Uint8Array(arrayBuffer)); | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = cloneArrayBuffer; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| var root = require('./_root'); | ||
|
|
||
| /** Detect free variable `exports`. */ | ||
| var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; | ||
|
|
||
| /** Detect free variable `module`. */ | ||
| var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; | ||
|
|
||
| /** Detect the popular CommonJS extension `module.exports`. */ | ||
| var moduleExports = freeModule && freeModule.exports === freeExports; | ||
|
|
||
| /** Built-in value references. */ | ||
| var Buffer = moduleExports ? root.Buffer : undefined, | ||
| allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined; | ||
|
|
||
| /** | ||
| * Creates a clone of `buffer`. | ||
| * | ||
| * @private | ||
| * @param {Buffer} buffer The buffer to clone. | ||
| * @param {boolean} [isDeep] Specify a deep clone. | ||
| * @returns {Buffer} Returns the cloned buffer. | ||
| */ | ||
| function cloneBuffer(buffer, isDeep) { | ||
| if (isDeep) { | ||
| return buffer.slice(); | ||
| } | ||
| var length = buffer.length, | ||
| result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); | ||
|
|
||
| buffer.copy(result); | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = cloneBuffer; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| var cloneArrayBuffer = require('./_cloneArrayBuffer'); | ||
|
|
||
| /** | ||
| * Creates a clone of `dataView`. | ||
| * | ||
| * @private | ||
| * @param {Object} dataView The data view to clone. | ||
| * @param {boolean} [isDeep] Specify a deep clone. | ||
| * @returns {Object} Returns the cloned data view. | ||
| */ | ||
| function cloneDataView(dataView, isDeep) { | ||
| var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; | ||
| return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); | ||
| } | ||
|
|
||
| module.exports = cloneDataView; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /** Used to match `RegExp` flags from their coerced string values. */ | ||
| var reFlags = /\w*$/; | ||
|
|
||
| /** | ||
| * Creates a clone of `regexp`. | ||
| * | ||
| * @private | ||
| * @param {Object} regexp The regexp to clone. | ||
| * @returns {Object} Returns the cloned regexp. | ||
| */ | ||
| function cloneRegExp(regexp) { | ||
| var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); | ||
| result.lastIndex = regexp.lastIndex; | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = cloneRegExp; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| var Symbol = require('./_Symbol'); | ||
|
|
||
| /** Used to convert symbols to primitives and strings. */ | ||
| var symbolProto = Symbol ? Symbol.prototype : undefined, | ||
| symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; | ||
|
|
||
| /** | ||
| * Creates a clone of the `symbol` object. | ||
| * | ||
| * @private | ||
| * @param {Object} symbol The symbol object to clone. | ||
| * @returns {Object} Returns the cloned symbol object. | ||
| */ | ||
| function cloneSymbol(symbol) { | ||
| return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; | ||
| } | ||
|
|
||
| module.exports = cloneSymbol; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| var cloneArrayBuffer = require('./_cloneArrayBuffer'); | ||
|
|
||
| /** | ||
| * Creates a clone of `typedArray`. | ||
| * | ||
| * @private | ||
| * @param {Object} typedArray The typed array to clone. | ||
| * @param {boolean} [isDeep] Specify a deep clone. | ||
| * @returns {Object} Returns the cloned typed array. | ||
| */ | ||
| function cloneTypedArray(typedArray, isDeep) { | ||
| var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; | ||
| return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); | ||
| } | ||
|
|
||
| module.exports = cloneTypedArray; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| var isSymbol = require('./isSymbol'); | ||
|
|
||
| /** | ||
| * Compares values to sort them in ascending order. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to compare. | ||
| * @param {*} other The other value to compare. | ||
| * @returns {number} Returns the sort order indicator for `value`. | ||
| */ | ||
| function compareAscending(value, other) { | ||
| if (value !== other) { | ||
| var valIsDefined = value !== undefined, | ||
| valIsNull = value === null, | ||
| valIsReflexive = value === value, | ||
| valIsSymbol = isSymbol(value); | ||
|
|
||
| var othIsDefined = other !== undefined, | ||
| othIsNull = other === null, | ||
| othIsReflexive = other === other, | ||
| othIsSymbol = isSymbol(other); | ||
|
|
||
| if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) || | ||
| (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) || | ||
| (valIsNull && othIsDefined && othIsReflexive) || | ||
| (!valIsDefined && othIsReflexive) || | ||
| !valIsReflexive) { | ||
| return 1; | ||
| } | ||
| if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) || | ||
| (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) || | ||
| (othIsNull && valIsDefined && valIsReflexive) || | ||
| (!othIsDefined && valIsReflexive) || | ||
| !othIsReflexive) { | ||
| return -1; | ||
| } | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| module.exports = compareAscending; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| var compareAscending = require('./_compareAscending'); | ||
|
|
||
| /** | ||
| * Used by `_.orderBy` to compare multiple properties of a value to another | ||
| * and stable sort them. | ||
| * | ||
| * If `orders` is unspecified, all values are sorted in ascending order. Otherwise, | ||
| * specify an order of "desc" for descending or "asc" for ascending sort order | ||
| * of corresponding values. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to compare. | ||
| * @param {Object} other The other object to compare. | ||
| * @param {boolean[]|string[]} orders The order to sort by for each property. | ||
| * @returns {number} Returns the sort order indicator for `object`. | ||
| */ | ||
| function compareMultiple(object, other, orders) { | ||
| var index = -1, | ||
| objCriteria = object.criteria, | ||
| othCriteria = other.criteria, | ||
| length = objCriteria.length, | ||
| ordersLength = orders.length; | ||
|
|
||
| while (++index < length) { | ||
| var result = compareAscending(objCriteria[index], othCriteria[index]); | ||
| if (result) { | ||
| if (index >= ordersLength) { | ||
| return result; | ||
| } | ||
| var order = orders[index]; | ||
| return result * (order == 'desc' ? -1 : 1); | ||
| } | ||
| } | ||
| // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications | ||
| // that causes it, under certain circumstances, to provide the same value for | ||
| // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 | ||
| // for more details. | ||
| // | ||
| // This also ensures a stable sort in V8 and other engines. | ||
| // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details. | ||
| return object.index - other.index; | ||
| } | ||
|
|
||
| module.exports = compareMultiple; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* Built-in method references for those with the same name as other `lodash` methods. */ | ||
| var nativeMax = Math.max; | ||
|
|
||
| /** | ||
| * Creates an array that is the composition of partially applied arguments, | ||
| * placeholders, and provided arguments into a single array of arguments. | ||
| * | ||
| * @private | ||
| * @param {Array} args The provided arguments. | ||
| * @param {Array} partials The arguments to prepend to those provided. | ||
| * @param {Array} holders The `partials` placeholder indexes. | ||
| * @params {boolean} [isCurried] Specify composing for a curried function. | ||
| * @returns {Array} Returns the new array of composed arguments. | ||
| */ | ||
| function composeArgs(args, partials, holders, isCurried) { | ||
| var argsIndex = -1, | ||
| argsLength = args.length, | ||
| holdersLength = holders.length, | ||
| leftIndex = -1, | ||
| leftLength = partials.length, | ||
| rangeLength = nativeMax(argsLength - holdersLength, 0), | ||
| result = Array(leftLength + rangeLength), | ||
| isUncurried = !isCurried; | ||
|
|
||
| while (++leftIndex < leftLength) { | ||
| result[leftIndex] = partials[leftIndex]; | ||
| } | ||
| while (++argsIndex < holdersLength) { | ||
| if (isUncurried || argsIndex < argsLength) { | ||
| result[holders[argsIndex]] = args[argsIndex]; | ||
| } | ||
| } | ||
| while (rangeLength--) { | ||
| result[leftIndex++] = args[argsIndex++]; | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = composeArgs; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* Built-in method references for those with the same name as other `lodash` methods. */ | ||
| var nativeMax = Math.max; | ||
|
|
||
| /** | ||
| * This function is like `composeArgs` except that the arguments composition | ||
| * is tailored for `_.partialRight`. | ||
| * | ||
| * @private | ||
| * @param {Array} args The provided arguments. | ||
| * @param {Array} partials The arguments to append to those provided. | ||
| * @param {Array} holders The `partials` placeholder indexes. | ||
| * @params {boolean} [isCurried] Specify composing for a curried function. | ||
| * @returns {Array} Returns the new array of composed arguments. | ||
| */ | ||
| function composeArgsRight(args, partials, holders, isCurried) { | ||
| var argsIndex = -1, | ||
| argsLength = args.length, | ||
| holdersIndex = -1, | ||
| holdersLength = holders.length, | ||
| rightIndex = -1, | ||
| rightLength = partials.length, | ||
| rangeLength = nativeMax(argsLength - holdersLength, 0), | ||
| result = Array(rangeLength + rightLength), | ||
| isUncurried = !isCurried; | ||
|
|
||
| while (++argsIndex < rangeLength) { | ||
| result[argsIndex] = args[argsIndex]; | ||
| } | ||
| var offset = argsIndex; | ||
| while (++rightIndex < rightLength) { | ||
| result[offset + rightIndex] = partials[rightIndex]; | ||
| } | ||
| while (++holdersIndex < holdersLength) { | ||
| if (isUncurried || argsIndex < argsLength) { | ||
| result[offset + holders[holdersIndex]] = args[argsIndex++]; | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = composeArgsRight; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * Copies the values of `source` to `array`. | ||
| * | ||
| * @private | ||
| * @param {Array} source The array to copy values from. | ||
| * @param {Array} [array=[]] The array to copy values to. | ||
| * @returns {Array} Returns `array`. | ||
| */ | ||
| function copyArray(source, array) { | ||
| var index = -1, | ||
| length = source.length; | ||
|
|
||
| array || (array = Array(length)); | ||
| while (++index < length) { | ||
| array[index] = source[index]; | ||
| } | ||
| return array; | ||
| } | ||
|
|
||
| module.exports = copyArray; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| var assignValue = require('./_assignValue'), | ||
| baseAssignValue = require('./_baseAssignValue'); | ||
|
|
||
| /** | ||
| * Copies properties of `source` to `object`. | ||
| * | ||
| * @private | ||
| * @param {Object} source The object to copy properties from. | ||
| * @param {Array} props The property identifiers to copy. | ||
| * @param {Object} [object={}] The object to copy properties to. | ||
| * @param {Function} [customizer] The function to customize copied values. | ||
| * @returns {Object} Returns `object`. | ||
| */ | ||
| function copyObject(source, props, object, customizer) { | ||
| var isNew = !object; | ||
| object || (object = {}); | ||
|
|
||
| var index = -1, | ||
| length = props.length; | ||
|
|
||
| while (++index < length) { | ||
| var key = props[index]; | ||
|
|
||
| var newValue = customizer | ||
| ? customizer(object[key], source[key], key, object, source) | ||
| : undefined; | ||
|
|
||
| if (newValue === undefined) { | ||
| newValue = source[key]; | ||
| } | ||
| if (isNew) { | ||
| baseAssignValue(object, key, newValue); | ||
| } else { | ||
| assignValue(object, key, newValue); | ||
| } | ||
| } | ||
| return object; | ||
| } | ||
|
|
||
| module.exports = copyObject; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| var copyObject = require('./_copyObject'), | ||
| getSymbols = require('./_getSymbols'); | ||
|
|
||
| /** | ||
| * Copies own symbols of `source` to `object`. | ||
| * | ||
| * @private | ||
| * @param {Object} source The object to copy symbols from. | ||
| * @param {Object} [object={}] The object to copy symbols to. | ||
| * @returns {Object} Returns `object`. | ||
| */ | ||
| function copySymbols(source, object) { | ||
| return copyObject(source, getSymbols(source), object); | ||
| } | ||
|
|
||
| module.exports = copySymbols; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| var copyObject = require('./_copyObject'), | ||
| getSymbolsIn = require('./_getSymbolsIn'); | ||
|
|
||
| /** | ||
| * Copies own and inherited symbols of `source` to `object`. | ||
| * | ||
| * @private | ||
| * @param {Object} source The object to copy symbols from. | ||
| * @param {Object} [object={}] The object to copy symbols to. | ||
| * @returns {Object} Returns `object`. | ||
| */ | ||
| function copySymbolsIn(source, object) { | ||
| return copyObject(source, getSymbolsIn(source), object); | ||
| } | ||
|
|
||
| module.exports = copySymbolsIn; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| var root = require('./_root'); | ||
|
|
||
| /** Used to detect overreaching core-js shims. */ | ||
| var coreJsData = root['__core-js_shared__']; | ||
|
|
||
| module.exports = coreJsData; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /** | ||
| * Gets the number of `placeholder` occurrences in `array`. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to inspect. | ||
| * @param {*} placeholder The placeholder to search for. | ||
| * @returns {number} Returns the placeholder count. | ||
| */ | ||
| function countHolders(array, placeholder) { | ||
| var length = array.length, | ||
| result = 0; | ||
|
|
||
| while (length--) { | ||
| if (array[length] === placeholder) { | ||
| ++result; | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = countHolders; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| var arrayAggregator = require('./_arrayAggregator'), | ||
| baseAggregator = require('./_baseAggregator'), | ||
| baseIteratee = require('./_baseIteratee'), | ||
| isArray = require('./isArray'); | ||
|
|
||
| /** | ||
| * Creates a function like `_.groupBy`. | ||
| * | ||
| * @private | ||
| * @param {Function} setter The function to set accumulator values. | ||
| * @param {Function} [initializer] The accumulator object initializer. | ||
| * @returns {Function} Returns the new aggregator function. | ||
| */ | ||
| function createAggregator(setter, initializer) { | ||
| return function(collection, iteratee) { | ||
| var func = isArray(collection) ? arrayAggregator : baseAggregator, | ||
| accumulator = initializer ? initializer() : {}; | ||
|
|
||
| return func(collection, setter, baseIteratee(iteratee, 2), accumulator); | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createAggregator; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| var baseRest = require('./_baseRest'), | ||
| isIterateeCall = require('./_isIterateeCall'); | ||
|
|
||
| /** | ||
| * Creates a function like `_.assign`. | ||
| * | ||
| * @private | ||
| * @param {Function} assigner The function to assign values. | ||
| * @returns {Function} Returns the new assigner function. | ||
| */ | ||
| function createAssigner(assigner) { | ||
| return baseRest(function(object, sources) { | ||
| var index = -1, | ||
| length = sources.length, | ||
| customizer = length > 1 ? sources[length - 1] : undefined, | ||
| guard = length > 2 ? sources[2] : undefined; | ||
|
|
||
| customizer = (assigner.length > 3 && typeof customizer == 'function') | ||
| ? (length--, customizer) | ||
| : undefined; | ||
|
|
||
| if (guard && isIterateeCall(sources[0], sources[1], guard)) { | ||
| customizer = length < 3 ? undefined : customizer; | ||
| length = 1; | ||
| } | ||
| object = Object(object); | ||
| while (++index < length) { | ||
| var source = sources[index]; | ||
| if (source) { | ||
| assigner(object, source, index, customizer); | ||
| } | ||
| } | ||
| return object; | ||
| }); | ||
| } | ||
|
|
||
| module.exports = createAssigner; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| var isArrayLike = require('./isArrayLike'); | ||
|
|
||
| /** | ||
| * Creates a `baseEach` or `baseEachRight` function. | ||
| * | ||
| * @private | ||
| * @param {Function} eachFunc The function to iterate over a collection. | ||
| * @param {boolean} [fromRight] Specify iterating from right to left. | ||
| * @returns {Function} Returns the new base function. | ||
| */ | ||
| function createBaseEach(eachFunc, fromRight) { | ||
| return function(collection, iteratee) { | ||
| if (collection == null) { | ||
| return collection; | ||
| } | ||
| if (!isArrayLike(collection)) { | ||
| return eachFunc(collection, iteratee); | ||
| } | ||
| var length = collection.length, | ||
| index = fromRight ? length : -1, | ||
| iterable = Object(collection); | ||
|
|
||
| while ((fromRight ? index-- : ++index < length)) { | ||
| if (iteratee(iterable[index], index, iterable) === false) { | ||
| break; | ||
| } | ||
| } | ||
| return collection; | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createBaseEach; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * Creates a base function for methods like `_.forIn` and `_.forOwn`. | ||
| * | ||
| * @private | ||
| * @param {boolean} [fromRight] Specify iterating from right to left. | ||
| * @returns {Function} Returns the new base function. | ||
| */ | ||
| function createBaseFor(fromRight) { | ||
| return function(object, iteratee, keysFunc) { | ||
| var index = -1, | ||
| iterable = Object(object), | ||
| props = keysFunc(object), | ||
| length = props.length; | ||
|
|
||
| while (length--) { | ||
| var key = props[fromRight ? length : ++index]; | ||
| if (iteratee(iterable[key], key, iterable) === false) { | ||
| break; | ||
| } | ||
| } | ||
| return object; | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createBaseFor; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| var createCtor = require('./_createCtor'), | ||
| root = require('./_root'); | ||
|
|
||
| /** Used to compose bitmasks for function metadata. */ | ||
| var WRAP_BIND_FLAG = 1; | ||
|
|
||
| /** | ||
| * Creates a function that wraps `func` to invoke it with the optional `this` | ||
| * binding of `thisArg`. | ||
| * | ||
| * @private | ||
| * @param {Function} func The function to wrap. | ||
| * @param {number} bitmask The bitmask flags. See `createWrap` for more details. | ||
| * @param {*} [thisArg] The `this` binding of `func`. | ||
| * @returns {Function} Returns the new wrapped function. | ||
| */ | ||
| function createBind(func, bitmask, thisArg) { | ||
| var isBind = bitmask & WRAP_BIND_FLAG, | ||
| Ctor = createCtor(func); | ||
|
|
||
| function wrapper() { | ||
| var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; | ||
| return fn.apply(isBind ? thisArg : this, arguments); | ||
| } | ||
| return wrapper; | ||
| } | ||
|
|
||
| module.exports = createBind; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| var castSlice = require('./_castSlice'), | ||
| hasUnicode = require('./_hasUnicode'), | ||
| stringToArray = require('./_stringToArray'), | ||
| toString = require('./toString'); | ||
|
|
||
| /** | ||
| * Creates a function like `_.lowerFirst`. | ||
| * | ||
| * @private | ||
| * @param {string} methodName The name of the `String` case method to use. | ||
| * @returns {Function} Returns the new case function. | ||
| */ | ||
| function createCaseFirst(methodName) { | ||
| return function(string) { | ||
| string = toString(string); | ||
|
|
||
| var strSymbols = hasUnicode(string) | ||
| ? stringToArray(string) | ||
| : undefined; | ||
|
|
||
| var chr = strSymbols | ||
| ? strSymbols[0] | ||
| : string.charAt(0); | ||
|
|
||
| var trailing = strSymbols | ||
| ? castSlice(strSymbols, 1).join('') | ||
| : string.slice(1); | ||
|
|
||
| return chr[methodName]() + trailing; | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createCaseFirst; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| var arrayReduce = require('./_arrayReduce'), | ||
| deburr = require('./deburr'), | ||
| words = require('./words'); | ||
|
|
||
| /** Used to compose unicode capture groups. */ | ||
| var rsApos = "['\u2019]"; | ||
|
|
||
| /** Used to match apostrophes. */ | ||
| var reApos = RegExp(rsApos, 'g'); | ||
|
|
||
| /** | ||
| * Creates a function like `_.camelCase`. | ||
| * | ||
| * @private | ||
| * @param {Function} callback The function to combine each word. | ||
| * @returns {Function} Returns the new compounder function. | ||
| */ | ||
| function createCompounder(callback) { | ||
| return function(string) { | ||
| return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createCompounder; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| var baseCreate = require('./_baseCreate'), | ||
| isObject = require('./isObject'); | ||
|
|
||
| /** | ||
| * Creates a function that produces an instance of `Ctor` regardless of | ||
| * whether it was invoked as part of a `new` expression or by `call` or `apply`. | ||
| * | ||
| * @private | ||
| * @param {Function} Ctor The constructor to wrap. | ||
| * @returns {Function} Returns the new wrapped function. | ||
| */ | ||
| function createCtor(Ctor) { | ||
| return function() { | ||
| // Use a `switch` statement to work with class constructors. See | ||
| // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist | ||
| // for more details. | ||
| var args = arguments; | ||
| switch (args.length) { | ||
| case 0: return new Ctor; | ||
| case 1: return new Ctor(args[0]); | ||
| case 2: return new Ctor(args[0], args[1]); | ||
| case 3: return new Ctor(args[0], args[1], args[2]); | ||
| case 4: return new Ctor(args[0], args[1], args[2], args[3]); | ||
| case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); | ||
| case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); | ||
| case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); | ||
| } | ||
| var thisBinding = baseCreate(Ctor.prototype), | ||
| result = Ctor.apply(thisBinding, args); | ||
|
|
||
| // Mimic the constructor's `return` behavior. | ||
| // See https://es5.github.io/#x13.2.2 for more details. | ||
| return isObject(result) ? result : thisBinding; | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createCtor; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| var apply = require('./_apply'), | ||
| createCtor = require('./_createCtor'), | ||
| createHybrid = require('./_createHybrid'), | ||
| createRecurry = require('./_createRecurry'), | ||
| getHolder = require('./_getHolder'), | ||
| replaceHolders = require('./_replaceHolders'), | ||
| root = require('./_root'); | ||
|
|
||
| /** | ||
| * Creates a function that wraps `func` to enable currying. | ||
| * | ||
| * @private | ||
| * @param {Function} func The function to wrap. | ||
| * @param {number} bitmask The bitmask flags. See `createWrap` for more details. | ||
| * @param {number} arity The arity of `func`. | ||
| * @returns {Function} Returns the new wrapped function. | ||
| */ | ||
| function createCurry(func, bitmask, arity) { | ||
| var Ctor = createCtor(func); | ||
|
|
||
| function wrapper() { | ||
| var length = arguments.length, | ||
| args = Array(length), | ||
| index = length, | ||
| placeholder = getHolder(wrapper); | ||
|
|
||
| while (index--) { | ||
| args[index] = arguments[index]; | ||
| } | ||
| var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) | ||
| ? [] | ||
| : replaceHolders(args, placeholder); | ||
|
|
||
| length -= holders.length; | ||
| if (length < arity) { | ||
| return createRecurry( | ||
| func, bitmask, createHybrid, wrapper.placeholder, undefined, | ||
| args, holders, undefined, undefined, arity - length); | ||
| } | ||
| var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; | ||
| return apply(fn, this, args); | ||
| } | ||
| return wrapper; | ||
| } | ||
|
|
||
| module.exports = createCurry; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| var baseIteratee = require('./_baseIteratee'), | ||
| isArrayLike = require('./isArrayLike'), | ||
| keys = require('./keys'); | ||
|
|
||
| /** | ||
| * Creates a `_.find` or `_.findLast` function. | ||
| * | ||
| * @private | ||
| * @param {Function} findIndexFunc The function to find the collection index. | ||
| * @returns {Function} Returns the new find function. | ||
| */ | ||
| function createFind(findIndexFunc) { | ||
| return function(collection, predicate, fromIndex) { | ||
| var iterable = Object(collection); | ||
| if (!isArrayLike(collection)) { | ||
| var iteratee = baseIteratee(predicate, 3); | ||
| collection = keys(collection); | ||
| predicate = function(key) { return iteratee(iterable[key], key, iterable); }; | ||
| } | ||
| var index = findIndexFunc(collection, predicate, fromIndex); | ||
| return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createFind; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| var LodashWrapper = require('./_LodashWrapper'), | ||
| flatRest = require('./_flatRest'), | ||
| getData = require('./_getData'), | ||
| getFuncName = require('./_getFuncName'), | ||
| isArray = require('./isArray'), | ||
| isLaziable = require('./_isLaziable'); | ||
|
|
||
| /** Error message constants. */ | ||
| var FUNC_ERROR_TEXT = 'Expected a function'; | ||
|
|
||
| /** Used to compose bitmasks for function metadata. */ | ||
| var WRAP_CURRY_FLAG = 8, | ||
| WRAP_PARTIAL_FLAG = 32, | ||
| WRAP_ARY_FLAG = 128, | ||
| WRAP_REARG_FLAG = 256; | ||
|
|
||
| /** | ||
| * Creates a `_.flow` or `_.flowRight` function. | ||
| * | ||
| * @private | ||
| * @param {boolean} [fromRight] Specify iterating from right to left. | ||
| * @returns {Function} Returns the new flow function. | ||
| */ | ||
| function createFlow(fromRight) { | ||
| return flatRest(function(funcs) { | ||
| var length = funcs.length, | ||
| index = length, | ||
| prereq = LodashWrapper.prototype.thru; | ||
|
|
||
| if (fromRight) { | ||
| funcs.reverse(); | ||
| } | ||
| while (index--) { | ||
| var func = funcs[index]; | ||
| if (typeof func != 'function') { | ||
| throw new TypeError(FUNC_ERROR_TEXT); | ||
| } | ||
| if (prereq && !wrapper && getFuncName(func) == 'wrapper') { | ||
| var wrapper = new LodashWrapper([], true); | ||
| } | ||
| } | ||
| index = wrapper ? index : length; | ||
| while (++index < length) { | ||
| func = funcs[index]; | ||
|
|
||
| var funcName = getFuncName(func), | ||
| data = funcName == 'wrapper' ? getData(func) : undefined; | ||
|
|
||
| if (data && isLaziable(data[0]) && | ||
| data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && | ||
| !data[4].length && data[9] == 1 | ||
| ) { | ||
| wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); | ||
| } else { | ||
| wrapper = (func.length == 1 && isLaziable(func)) | ||
| ? wrapper[funcName]() | ||
| : wrapper.thru(func); | ||
| } | ||
| } | ||
| return function() { | ||
| var args = arguments, | ||
| value = args[0]; | ||
|
|
||
| if (wrapper && args.length == 1 && isArray(value)) { | ||
| return wrapper.plant(value).value(); | ||
| } | ||
| var index = 0, | ||
| result = length ? funcs[index].apply(this, args) : value; | ||
|
|
||
| while (++index < length) { | ||
| result = funcs[index].call(this, result); | ||
| } | ||
| return result; | ||
| }; | ||
| }); | ||
| } | ||
|
|
||
| module.exports = createFlow; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| var composeArgs = require('./_composeArgs'), | ||
| composeArgsRight = require('./_composeArgsRight'), | ||
| countHolders = require('./_countHolders'), | ||
| createCtor = require('./_createCtor'), | ||
| createRecurry = require('./_createRecurry'), | ||
| getHolder = require('./_getHolder'), | ||
| reorder = require('./_reorder'), | ||
| replaceHolders = require('./_replaceHolders'), | ||
| root = require('./_root'); | ||
|
|
||
| /** Used to compose bitmasks for function metadata. */ | ||
| var WRAP_BIND_FLAG = 1, | ||
| WRAP_BIND_KEY_FLAG = 2, | ||
| WRAP_CURRY_FLAG = 8, | ||
| WRAP_CURRY_RIGHT_FLAG = 16, | ||
| WRAP_ARY_FLAG = 128, | ||
| WRAP_FLIP_FLAG = 512; | ||
|
|
||
| /** | ||
| * Creates a function that wraps `func` to invoke it with optional `this` | ||
| * binding of `thisArg`, partial application, and currying. | ||
| * | ||
| * @private | ||
| * @param {Function|string} func The function or method name to wrap. | ||
| * @param {number} bitmask The bitmask flags. See `createWrap` for more details. | ||
| * @param {*} [thisArg] The `this` binding of `func`. | ||
| * @param {Array} [partials] The arguments to prepend to those provided to | ||
| * the new function. | ||
| * @param {Array} [holders] The `partials` placeholder indexes. | ||
| * @param {Array} [partialsRight] The arguments to append to those provided | ||
| * to the new function. | ||
| * @param {Array} [holdersRight] The `partialsRight` placeholder indexes. | ||
| * @param {Array} [argPos] The argument positions of the new function. | ||
| * @param {number} [ary] The arity cap of `func`. | ||
| * @param {number} [arity] The arity of `func`. | ||
| * @returns {Function} Returns the new wrapped function. | ||
| */ | ||
| function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { | ||
| var isAry = bitmask & WRAP_ARY_FLAG, | ||
| isBind = bitmask & WRAP_BIND_FLAG, | ||
| isBindKey = bitmask & WRAP_BIND_KEY_FLAG, | ||
| isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), | ||
| isFlip = bitmask & WRAP_FLIP_FLAG, | ||
| Ctor = isBindKey ? undefined : createCtor(func); | ||
|
|
||
| function wrapper() { | ||
| var length = arguments.length, | ||
| args = Array(length), | ||
| index = length; | ||
|
|
||
| while (index--) { | ||
| args[index] = arguments[index]; | ||
| } | ||
| if (isCurried) { | ||
| var placeholder = getHolder(wrapper), | ||
| holdersCount = countHolders(args, placeholder); | ||
| } | ||
| if (partials) { | ||
| args = composeArgs(args, partials, holders, isCurried); | ||
| } | ||
| if (partialsRight) { | ||
| args = composeArgsRight(args, partialsRight, holdersRight, isCurried); | ||
| } | ||
| length -= holdersCount; | ||
| if (isCurried && length < arity) { | ||
| var newHolders = replaceHolders(args, placeholder); | ||
| return createRecurry( | ||
| func, bitmask, createHybrid, wrapper.placeholder, thisArg, | ||
| args, newHolders, argPos, ary, arity - length | ||
| ); | ||
| } | ||
| var thisBinding = isBind ? thisArg : this, | ||
| fn = isBindKey ? thisBinding[func] : func; | ||
|
|
||
| length = args.length; | ||
| if (argPos) { | ||
| args = reorder(args, argPos); | ||
| } else if (isFlip && length > 1) { | ||
| args.reverse(); | ||
| } | ||
| if (isAry && ary < length) { | ||
| args.length = ary; | ||
| } | ||
| if (this && this !== root && this instanceof wrapper) { | ||
| fn = Ctor || createCtor(fn); | ||
| } | ||
| return fn.apply(thisBinding, args); | ||
| } | ||
| return wrapper; | ||
| } | ||
|
|
||
| module.exports = createHybrid; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| var baseInverter = require('./_baseInverter'); | ||
|
|
||
| /** | ||
| * Creates a function like `_.invertBy`. | ||
| * | ||
| * @private | ||
| * @param {Function} setter The function to set accumulator values. | ||
| * @param {Function} toIteratee The function to resolve iteratees. | ||
| * @returns {Function} Returns the new inverter function. | ||
| */ | ||
| function createInverter(setter, toIteratee) { | ||
| return function(object, iteratee) { | ||
| return baseInverter(object, setter, toIteratee(iteratee), {}); | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createInverter; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| var baseToNumber = require('./_baseToNumber'), | ||
| baseToString = require('./_baseToString'); | ||
|
|
||
| /** | ||
| * Creates a function that performs a mathematical operation on two values. | ||
| * | ||
| * @private | ||
| * @param {Function} operator The function to perform the operation. | ||
| * @param {number} [defaultValue] The value used for `undefined` arguments. | ||
| * @returns {Function} Returns the new mathematical operation function. | ||
| */ | ||
| function createMathOperation(operator, defaultValue) { | ||
| return function(value, other) { | ||
| var result; | ||
| if (value === undefined && other === undefined) { | ||
| return defaultValue; | ||
| } | ||
| if (value !== undefined) { | ||
| result = value; | ||
| } | ||
| if (other !== undefined) { | ||
| if (result === undefined) { | ||
| return other; | ||
| } | ||
| if (typeof value == 'string' || typeof other == 'string') { | ||
| value = baseToString(value); | ||
| other = baseToString(other); | ||
| } else { | ||
| value = baseToNumber(value); | ||
| other = baseToNumber(other); | ||
| } | ||
| result = operator(value, other); | ||
| } | ||
| return result; | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createMathOperation; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| var apply = require('./_apply'), | ||
| arrayMap = require('./_arrayMap'), | ||
| baseIteratee = require('./_baseIteratee'), | ||
| baseRest = require('./_baseRest'), | ||
| baseUnary = require('./_baseUnary'), | ||
| flatRest = require('./_flatRest'); | ||
|
|
||
| /** | ||
| * Creates a function like `_.over`. | ||
| * | ||
| * @private | ||
| * @param {Function} arrayFunc The function to iterate over iteratees. | ||
| * @returns {Function} Returns the new over function. | ||
| */ | ||
| function createOver(arrayFunc) { | ||
| return flatRest(function(iteratees) { | ||
| iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); | ||
| return baseRest(function(args) { | ||
| var thisArg = this; | ||
| return arrayFunc(iteratees, function(iteratee) { | ||
| return apply(iteratee, thisArg, args); | ||
| }); | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| module.exports = createOver; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| var baseRepeat = require('./_baseRepeat'), | ||
| baseToString = require('./_baseToString'), | ||
| castSlice = require('./_castSlice'), | ||
| hasUnicode = require('./_hasUnicode'), | ||
| stringSize = require('./_stringSize'), | ||
| stringToArray = require('./_stringToArray'); | ||
|
|
||
| /* Built-in method references for those with the same name as other `lodash` methods. */ | ||
| var nativeCeil = Math.ceil; | ||
|
|
||
| /** | ||
| * Creates the padding for `string` based on `length`. The `chars` string | ||
| * is truncated if the number of characters exceeds `length`. | ||
| * | ||
| * @private | ||
| * @param {number} length The padding length. | ||
| * @param {string} [chars=' '] The string used as padding. | ||
| * @returns {string} Returns the padding for `string`. | ||
| */ | ||
| function createPadding(length, chars) { | ||
| chars = chars === undefined ? ' ' : baseToString(chars); | ||
|
|
||
| var charsLength = chars.length; | ||
| if (charsLength < 2) { | ||
| return charsLength ? baseRepeat(chars, length) : chars; | ||
| } | ||
| var result = baseRepeat(chars, nativeCeil(length / stringSize(chars))); | ||
| return hasUnicode(chars) | ||
| ? castSlice(stringToArray(result), 0, length).join('') | ||
| : result.slice(0, length); | ||
| } | ||
|
|
||
| module.exports = createPadding; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| var apply = require('./_apply'), | ||
| createCtor = require('./_createCtor'), | ||
| root = require('./_root'); | ||
|
|
||
| /** Used to compose bitmasks for function metadata. */ | ||
| var WRAP_BIND_FLAG = 1; | ||
|
|
||
| /** | ||
| * Creates a function that wraps `func` to invoke it with the `this` binding | ||
| * of `thisArg` and `partials` prepended to the arguments it receives. | ||
| * | ||
| * @private | ||
| * @param {Function} func The function to wrap. | ||
| * @param {number} bitmask The bitmask flags. See `createWrap` for more details. | ||
| * @param {*} thisArg The `this` binding of `func`. | ||
| * @param {Array} partials The arguments to prepend to those provided to | ||
| * the new function. | ||
| * @returns {Function} Returns the new wrapped function. | ||
| */ | ||
| function createPartial(func, bitmask, thisArg, partials) { | ||
| var isBind = bitmask & WRAP_BIND_FLAG, | ||
| Ctor = createCtor(func); | ||
|
|
||
| function wrapper() { | ||
| var argsIndex = -1, | ||
| argsLength = arguments.length, | ||
| leftIndex = -1, | ||
| leftLength = partials.length, | ||
| args = Array(leftLength + argsLength), | ||
| fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; | ||
|
|
||
| while (++leftIndex < leftLength) { | ||
| args[leftIndex] = partials[leftIndex]; | ||
| } | ||
| while (argsLength--) { | ||
| args[leftIndex++] = arguments[++argsIndex]; | ||
| } | ||
| return apply(fn, isBind ? thisArg : this, args); | ||
| } | ||
| return wrapper; | ||
| } | ||
|
|
||
| module.exports = createPartial; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| var baseRange = require('./_baseRange'), | ||
| isIterateeCall = require('./_isIterateeCall'), | ||
| toFinite = require('./toFinite'); | ||
|
|
||
| /** | ||
| * Creates a `_.range` or `_.rangeRight` function. | ||
| * | ||
| * @private | ||
| * @param {boolean} [fromRight] Specify iterating from right to left. | ||
| * @returns {Function} Returns the new range function. | ||
| */ | ||
| function createRange(fromRight) { | ||
| return function(start, end, step) { | ||
| if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { | ||
| end = step = undefined; | ||
| } | ||
| // Ensure the sign of `-0` is preserved. | ||
| start = toFinite(start); | ||
| if (end === undefined) { | ||
| end = start; | ||
| start = 0; | ||
| } else { | ||
| end = toFinite(end); | ||
| } | ||
| step = step === undefined ? (start < end ? 1 : -1) : toFinite(step); | ||
| return baseRange(start, end, step, fromRight); | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createRange; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| var isLaziable = require('./_isLaziable'), | ||
| setData = require('./_setData'), | ||
| setWrapToString = require('./_setWrapToString'); | ||
|
|
||
| /** Used to compose bitmasks for function metadata. */ | ||
| var WRAP_BIND_FLAG = 1, | ||
| WRAP_BIND_KEY_FLAG = 2, | ||
| WRAP_CURRY_BOUND_FLAG = 4, | ||
| WRAP_CURRY_FLAG = 8, | ||
| WRAP_PARTIAL_FLAG = 32, | ||
| WRAP_PARTIAL_RIGHT_FLAG = 64; | ||
|
|
||
| /** | ||
| * Creates a function that wraps `func` to continue currying. | ||
| * | ||
| * @private | ||
| * @param {Function} func The function to wrap. | ||
| * @param {number} bitmask The bitmask flags. See `createWrap` for more details. | ||
| * @param {Function} wrapFunc The function to create the `func` wrapper. | ||
| * @param {*} placeholder The placeholder value. | ||
| * @param {*} [thisArg] The `this` binding of `func`. | ||
| * @param {Array} [partials] The arguments to prepend to those provided to | ||
| * the new function. | ||
| * @param {Array} [holders] The `partials` placeholder indexes. | ||
| * @param {Array} [argPos] The argument positions of the new function. | ||
| * @param {number} [ary] The arity cap of `func`. | ||
| * @param {number} [arity] The arity of `func`. | ||
| * @returns {Function} Returns the new wrapped function. | ||
| */ | ||
| function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { | ||
| var isCurry = bitmask & WRAP_CURRY_FLAG, | ||
| newHolders = isCurry ? holders : undefined, | ||
| newHoldersRight = isCurry ? undefined : holders, | ||
| newPartials = isCurry ? partials : undefined, | ||
| newPartialsRight = isCurry ? undefined : partials; | ||
|
|
||
| bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG); | ||
| bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); | ||
|
|
||
| if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { | ||
| bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); | ||
| } | ||
| var newData = [ | ||
| func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, | ||
| newHoldersRight, argPos, ary, arity | ||
| ]; | ||
|
|
||
| var result = wrapFunc.apply(undefined, newData); | ||
| if (isLaziable(func)) { | ||
| setData(result, newData); | ||
| } | ||
| result.placeholder = placeholder; | ||
| return setWrapToString(result, func, bitmask); | ||
| } | ||
|
|
||
| module.exports = createRecurry; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| var toNumber = require('./toNumber'); | ||
|
|
||
| /** | ||
| * Creates a function that performs a relational operation on two values. | ||
| * | ||
| * @private | ||
| * @param {Function} operator The function to perform the operation. | ||
| * @returns {Function} Returns the new relational operation function. | ||
| */ | ||
| function createRelationalOperation(operator) { | ||
| return function(value, other) { | ||
| if (!(typeof value == 'string' && typeof other == 'string')) { | ||
| value = toNumber(value); | ||
| other = toNumber(other); | ||
| } | ||
| return operator(value, other); | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createRelationalOperation; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| var root = require('./_root'), | ||
| toInteger = require('./toInteger'), | ||
| toNumber = require('./toNumber'), | ||
| toString = require('./toString'); | ||
|
|
||
| /* Built-in method references for those with the same name as other `lodash` methods. */ | ||
| var nativeIsFinite = root.isFinite, | ||
| nativeMin = Math.min; | ||
|
|
||
| /** | ||
| * Creates a function like `_.round`. | ||
| * | ||
| * @private | ||
| * @param {string} methodName The name of the `Math` method to use when rounding. | ||
| * @returns {Function} Returns the new round function. | ||
| */ | ||
| function createRound(methodName) { | ||
| var func = Math[methodName]; | ||
| return function(number, precision) { | ||
| number = toNumber(number); | ||
| precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); | ||
| if (precision && nativeIsFinite(number)) { | ||
| // Shift with exponential notation to avoid floating-point issues. | ||
| // See [MDN](https://mdn.io/round#Examples) for more details. | ||
| var pair = (toString(number) + 'e').split('e'), | ||
| value = func(pair[0] + 'e' + (+pair[1] + precision)); | ||
|
|
||
| pair = (toString(value) + 'e').split('e'); | ||
| return +(pair[0] + 'e' + (+pair[1] - precision)); | ||
| } | ||
| return func(number); | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createRound; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| var Set = require('./_Set'), | ||
| noop = require('./noop'), | ||
| setToArray = require('./_setToArray'); | ||
|
|
||
| /** Used as references for various `Number` constants. */ | ||
| var INFINITY = 1 / 0; | ||
|
|
||
| /** | ||
| * Creates a set object of `values`. | ||
| * | ||
| * @private | ||
| * @param {Array} values The values to add to the set. | ||
| * @returns {Object} Returns the new set. | ||
| */ | ||
| var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { | ||
| return new Set(values); | ||
| }; | ||
|
|
||
| module.exports = createSet; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| var baseToPairs = require('./_baseToPairs'), | ||
| getTag = require('./_getTag'), | ||
| mapToArray = require('./_mapToArray'), | ||
| setToPairs = require('./_setToPairs'); | ||
|
|
||
| /** `Object#toString` result references. */ | ||
| var mapTag = '[object Map]', | ||
| setTag = '[object Set]'; | ||
|
|
||
| /** | ||
| * Creates a `_.toPairs` or `_.toPairsIn` function. | ||
| * | ||
| * @private | ||
| * @param {Function} keysFunc The function to get the keys of a given object. | ||
| * @returns {Function} Returns the new pairs function. | ||
| */ | ||
| function createToPairs(keysFunc) { | ||
| return function(object) { | ||
| var tag = getTag(object); | ||
| if (tag == mapTag) { | ||
| return mapToArray(object); | ||
| } | ||
| if (tag == setTag) { | ||
| return setToPairs(object); | ||
| } | ||
| return baseToPairs(object, keysFunc(object)); | ||
| }; | ||
| } | ||
|
|
||
| module.exports = createToPairs; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| var baseSetData = require('./_baseSetData'), | ||
| createBind = require('./_createBind'), | ||
| createCurry = require('./_createCurry'), | ||
| createHybrid = require('./_createHybrid'), | ||
| createPartial = require('./_createPartial'), | ||
| getData = require('./_getData'), | ||
| mergeData = require('./_mergeData'), | ||
| setData = require('./_setData'), | ||
| setWrapToString = require('./_setWrapToString'), | ||
| toInteger = require('./toInteger'); | ||
|
|
||
| /** Error message constants. */ | ||
| var FUNC_ERROR_TEXT = 'Expected a function'; | ||
|
|
||
| /** Used to compose bitmasks for function metadata. */ | ||
| var WRAP_BIND_FLAG = 1, | ||
| WRAP_BIND_KEY_FLAG = 2, | ||
| WRAP_CURRY_FLAG = 8, | ||
| WRAP_CURRY_RIGHT_FLAG = 16, | ||
| WRAP_PARTIAL_FLAG = 32, | ||
| WRAP_PARTIAL_RIGHT_FLAG = 64; | ||
|
|
||
| /* Built-in method references for those with the same name as other `lodash` methods. */ | ||
| var nativeMax = Math.max; | ||
|
|
||
| /** | ||
| * Creates a function that either curries or invokes `func` with optional | ||
| * `this` binding and partially applied arguments. | ||
| * | ||
| * @private | ||
| * @param {Function|string} func The function or method name to wrap. | ||
| * @param {number} bitmask The bitmask flags. | ||
| * 1 - `_.bind` | ||
| * 2 - `_.bindKey` | ||
| * 4 - `_.curry` or `_.curryRight` of a bound function | ||
| * 8 - `_.curry` | ||
| * 16 - `_.curryRight` | ||
| * 32 - `_.partial` | ||
| * 64 - `_.partialRight` | ||
| * 128 - `_.rearg` | ||
| * 256 - `_.ary` | ||
| * 512 - `_.flip` | ||
| * @param {*} [thisArg] The `this` binding of `func`. | ||
| * @param {Array} [partials] The arguments to be partially applied. | ||
| * @param {Array} [holders] The `partials` placeholder indexes. | ||
| * @param {Array} [argPos] The argument positions of the new function. | ||
| * @param {number} [ary] The arity cap of `func`. | ||
| * @param {number} [arity] The arity of `func`. | ||
| * @returns {Function} Returns the new wrapped function. | ||
| */ | ||
| function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { | ||
| var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; | ||
| if (!isBindKey && typeof func != 'function') { | ||
| throw new TypeError(FUNC_ERROR_TEXT); | ||
| } | ||
| var length = partials ? partials.length : 0; | ||
| if (!length) { | ||
| bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); | ||
| partials = holders = undefined; | ||
| } | ||
| ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); | ||
| arity = arity === undefined ? arity : toInteger(arity); | ||
| length -= holders ? holders.length : 0; | ||
|
|
||
| if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { | ||
| var partialsRight = partials, | ||
| holdersRight = holders; | ||
|
|
||
| partials = holders = undefined; | ||
| } | ||
| var data = isBindKey ? undefined : getData(func); | ||
|
|
||
| var newData = [ | ||
| func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, | ||
| argPos, ary, arity | ||
| ]; | ||
|
|
||
| if (data) { | ||
| mergeData(newData, data); | ||
| } | ||
| func = newData[0]; | ||
| bitmask = newData[1]; | ||
| thisArg = newData[2]; | ||
| partials = newData[3]; | ||
| holders = newData[4]; | ||
| arity = newData[9] = newData[9] === undefined | ||
| ? (isBindKey ? 0 : func.length) | ||
| : nativeMax(newData[9] - length, 0); | ||
|
|
||
| if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { | ||
| bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); | ||
| } | ||
| if (!bitmask || bitmask == WRAP_BIND_FLAG) { | ||
| var result = createBind(func, bitmask, thisArg); | ||
| } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { | ||
| result = createCurry(func, bitmask, arity); | ||
| } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { | ||
| result = createPartial(func, bitmask, thisArg, partials); | ||
| } else { | ||
| result = createHybrid.apply(undefined, newData); | ||
| } | ||
| var setter = data ? baseSetData : setData; | ||
| return setWrapToString(setter(result, newData), func, bitmask); | ||
| } | ||
|
|
||
| module.exports = createWrap; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| var eq = require('./eq'); | ||
|
|
||
| /** Used for built-in method references. */ | ||
| var objectProto = Object.prototype; | ||
|
|
||
| /** Used to check objects for own properties. */ | ||
| var hasOwnProperty = objectProto.hasOwnProperty; | ||
|
|
||
| /** | ||
| * Used by `_.defaults` to customize its `_.assignIn` use to assign properties | ||
| * of source objects to the destination object for all destination properties | ||
| * that resolve to `undefined`. | ||
| * | ||
| * @private | ||
| * @param {*} objValue The destination value. | ||
| * @param {*} srcValue The source value. | ||
| * @param {string} key The key of the property to assign. | ||
| * @param {Object} object The parent object of `objValue`. | ||
| * @returns {*} Returns the value to assign. | ||
| */ | ||
| function customDefaultsAssignIn(objValue, srcValue, key, object) { | ||
| if (objValue === undefined || | ||
| (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { | ||
| return srcValue; | ||
| } | ||
| return objValue; | ||
| } | ||
|
|
||
| module.exports = customDefaultsAssignIn; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| var baseMerge = require('./_baseMerge'), | ||
| isObject = require('./isObject'); | ||
|
|
||
| /** | ||
| * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source | ||
| * objects into destination objects that are passed thru. | ||
| * | ||
| * @private | ||
| * @param {*} objValue The destination value. | ||
| * @param {*} srcValue The source value. | ||
| * @param {string} key The key of the property to merge. | ||
| * @param {Object} object The parent object of `objValue`. | ||
| * @param {Object} source The parent object of `srcValue`. | ||
| * @param {Object} [stack] Tracks traversed source values and their merged | ||
| * counterparts. | ||
| * @returns {*} Returns the value to assign. | ||
| */ | ||
| function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { | ||
| if (isObject(objValue) && isObject(srcValue)) { | ||
| // Recursively merge objects and arrays (susceptible to call stack limits). | ||
| stack.set(srcValue, objValue); | ||
| baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); | ||
| stack['delete'](srcValue); | ||
| } | ||
| return objValue; | ||
| } | ||
|
|
||
| module.exports = customDefaultsMerge; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| var isPlainObject = require('./isPlainObject'); | ||
|
|
||
| /** | ||
| * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain | ||
| * objects. | ||
| * | ||
| * @private | ||
| * @param {*} value The value to inspect. | ||
| * @param {string} key The key of the property to inspect. | ||
| * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`. | ||
| */ | ||
| function customOmitClone(value) { | ||
| return isPlainObject(value) ? undefined : value; | ||
| } | ||
|
|
||
| module.exports = customOmitClone; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| var basePropertyOf = require('./_basePropertyOf'); | ||
|
|
||
| /** Used to map Latin Unicode letters to basic Latin letters. */ | ||
| var deburredLetters = { | ||
| // Latin-1 Supplement block. | ||
| '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', | ||
| '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', | ||
| '\xc7': 'C', '\xe7': 'c', | ||
| '\xd0': 'D', '\xf0': 'd', | ||
| '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', | ||
| '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', | ||
| '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', | ||
| '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', | ||
| '\xd1': 'N', '\xf1': 'n', | ||
| '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', | ||
| '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', | ||
| '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', | ||
| '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', | ||
| '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', | ||
| '\xc6': 'Ae', '\xe6': 'ae', | ||
| '\xde': 'Th', '\xfe': 'th', | ||
| '\xdf': 'ss', | ||
| // Latin Extended-A block. | ||
| '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', | ||
| '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', | ||
| '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', | ||
| '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', | ||
| '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', | ||
| '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', | ||
| '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', | ||
| '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', | ||
| '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', | ||
| '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', | ||
| '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', | ||
| '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', | ||
| '\u0134': 'J', '\u0135': 'j', | ||
| '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', | ||
| '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', | ||
| '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', | ||
| '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', | ||
| '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', | ||
| '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', | ||
| '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', | ||
| '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', | ||
| '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', | ||
| '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', | ||
| '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', | ||
| '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', | ||
| '\u0163': 't', '\u0165': 't', '\u0167': 't', | ||
| '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', | ||
| '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', | ||
| '\u0174': 'W', '\u0175': 'w', | ||
| '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', | ||
| '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', | ||
| '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', | ||
| '\u0132': 'IJ', '\u0133': 'ij', | ||
| '\u0152': 'Oe', '\u0153': 'oe', | ||
| '\u0149': "'n", '\u017f': 's' | ||
| }; | ||
|
|
||
| /** | ||
| * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A | ||
| * letters to basic Latin letters. | ||
| * | ||
| * @private | ||
| * @param {string} letter The matched letter to deburr. | ||
| * @returns {string} Returns the deburred letter. | ||
| */ | ||
| var deburrLetter = basePropertyOf(deburredLetters); | ||
|
|
||
| module.exports = deburrLetter; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| var getNative = require('./_getNative'); | ||
|
|
||
| var defineProperty = (function() { | ||
| try { | ||
| var func = getNative(Object, 'defineProperty'); | ||
| func({}, '', {}); | ||
| return func; | ||
| } catch (e) {} | ||
| }()); | ||
|
|
||
| module.exports = defineProperty; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| var SetCache = require('./_SetCache'), | ||
| arraySome = require('./_arraySome'), | ||
| cacheHas = require('./_cacheHas'); | ||
|
|
||
| /** Used to compose bitmasks for value comparisons. */ | ||
| var COMPARE_PARTIAL_FLAG = 1, | ||
| COMPARE_UNORDERED_FLAG = 2; | ||
|
|
||
| /** | ||
| * A specialized version of `baseIsEqualDeep` for arrays with support for | ||
| * partial deep comparisons. | ||
| * | ||
| * @private | ||
| * @param {Array} array The array to compare. | ||
| * @param {Array} other The other array to compare. | ||
| * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. | ||
| * @param {Function} customizer The function to customize comparisons. | ||
| * @param {Function} equalFunc The function to determine equivalents of values. | ||
| * @param {Object} stack Tracks traversed `array` and `other` objects. | ||
| * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. | ||
| */ | ||
| function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { | ||
| var isPartial = bitmask & COMPARE_PARTIAL_FLAG, | ||
| arrLength = array.length, | ||
| othLength = other.length; | ||
|
|
||
| if (arrLength != othLength && !(isPartial && othLength > arrLength)) { | ||
| return false; | ||
| } | ||
| // Assume cyclic values are equal. | ||
| var stacked = stack.get(array); | ||
| if (stacked && stack.get(other)) { | ||
| return stacked == other; | ||
| } | ||
| var index = -1, | ||
| result = true, | ||
| seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; | ||
|
|
||
| stack.set(array, other); | ||
| stack.set(other, array); | ||
|
|
||
| // Ignore non-index properties. | ||
| while (++index < arrLength) { | ||
| var arrValue = array[index], | ||
| othValue = other[index]; | ||
|
|
||
| if (customizer) { | ||
| var compared = isPartial | ||
| ? customizer(othValue, arrValue, index, other, array, stack) | ||
| : customizer(arrValue, othValue, index, array, other, stack); | ||
| } | ||
| if (compared !== undefined) { | ||
| if (compared) { | ||
| continue; | ||
| } | ||
| result = false; | ||
| break; | ||
| } | ||
| // Recursively compare arrays (susceptible to call stack limits). | ||
| if (seen) { | ||
| if (!arraySome(other, function(othValue, othIndex) { | ||
| if (!cacheHas(seen, othIndex) && | ||
| (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { | ||
| return seen.push(othIndex); | ||
| } | ||
| })) { | ||
| result = false; | ||
| break; | ||
| } | ||
| } else if (!( | ||
| arrValue === othValue || | ||
| equalFunc(arrValue, othValue, bitmask, customizer, stack) | ||
| )) { | ||
| result = false; | ||
| break; | ||
| } | ||
| } | ||
| stack['delete'](array); | ||
| stack['delete'](other); | ||
| return result; | ||
| } | ||
|
|
||
| module.exports = equalArrays; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| var Symbol = require('./_Symbol'), | ||
| Uint8Array = require('./_Uint8Array'), | ||
| eq = require('./eq'), | ||
| equalArrays = require('./_equalArrays'), | ||
| mapToArray = require('./_mapToArray'), | ||
| setToArray = require('./_setToArray'); | ||
|
|
||
| /** Used to compose bitmasks for value comparisons. */ | ||
| var COMPARE_PARTIAL_FLAG = 1, | ||
| COMPARE_UNORDERED_FLAG = 2; | ||
|
|
||
| /** `Object#toString` result references. */ | ||
| var boolTag = '[object Boolean]', | ||
| dateTag = '[object Date]', | ||
| errorTag = '[object Error]', | ||
| mapTag = '[object Map]', | ||
| numberTag = '[object Number]', | ||
| regexpTag = '[object RegExp]', | ||
| setTag = '[object Set]', | ||
| stringTag = '[object String]', | ||
| symbolTag = '[object Symbol]'; | ||
|
|
||
| var arrayBufferTag = '[object ArrayBuffer]', | ||
| dataViewTag = '[object DataView]'; | ||
|
|
||
| /** Used to convert symbols to primitives and strings. */ | ||
| var symbolProto = Symbol ? Symbol.prototype : undefined, | ||
| symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; | ||
|
|
||
| /** | ||
| * A specialized version of `baseIsEqualDeep` for comparing objects of | ||
| * the same `toStringTag`. | ||
| * | ||
| * **Note:** This function only supports comparing values with tags of | ||
| * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. | ||
| * | ||
| * @private | ||
| * @param {Object} object The object to compare. | ||
| * @param {Object} other The other object to compare. | ||
| * @param {string} tag The `toStringTag` of the objects to compare. | ||
| * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. | ||
| * @param {Function} customizer The function to customize comparisons. | ||
| * @param {Function} equalFunc The function to determine equivalents of values. | ||
| * @param {Object} stack Tracks traversed `object` and `other` objects. | ||
| * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | ||
| */ | ||
| function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { | ||
| switch (tag) { | ||
| case dataViewTag: | ||
| if ((object.byteLength != other.byteLength) || | ||
| (object.byteOffset != other.byteOffset)) { | ||
| return false; | ||
| } | ||
| object = object.buffer; | ||
| other = other.buffer; | ||
|
|
||
| case arrayBufferTag: | ||
| if ((object.byteLength != other.byteLength) || | ||
| !equalFunc(new Uint8Array(object), new Uint8Array(other))) { | ||
| return false; | ||
| } | ||
| return true; | ||
|
|
||
| case boolTag: | ||
| case dateTag: | ||
| case numberTag: | ||
| // Coerce booleans to `1` or `0` and dates to milliseconds. | ||
| // Invalid dates are coerced to `NaN`. | ||
| return eq(+object, +other); | ||
|
|
||
| case errorTag: | ||
| return object.name == other.name && object.message == other.message; | ||
|
|
||
| case regexpTag: | ||
| case stringTag: | ||
| // Coerce regexes to strings and treat strings, primitives and objects, | ||
| // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring | ||
| // for more details. | ||
| return object == (other + ''); | ||
|
|
||
| case mapTag: | ||
| var convert = mapToArray; | ||
|
|
||
| case setTag: | ||
| var isPartial = bitmask & COMPARE_PARTIAL_FLAG; | ||
| convert || (convert = setToArray); | ||
|
|
||
| if (object.size != other.size && !isPartial) { | ||
| return false; | ||
| } | ||
| // Assume cyclic values are equal. | ||
| var stacked = stack.get(object); | ||
| if (stacked) { | ||
| return stacked == other; | ||
| } | ||
| bitmask |= COMPARE_UNORDERED_FLAG; | ||
|
|
||
| // Recursively compare objects (susceptible to call stack limits). | ||
| stack.set(object, other); | ||
| var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); | ||
| stack['delete'](object); | ||
| return result; | ||
|
|
||
| case symbolTag: | ||
| if (symbolValueOf) { | ||
| return symbolValueOf.call(object) == symbolValueOf.call(other); | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| module.exports = equalByTag; |