loudashe 0.0.1-security → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of loudashe might be problematic. Click here for more details.
- package/.editorconfig +12 -0
- package/.eslintrc.js +125 -0
- package/.gitattributes +1 -0
- package/.github/CONTRIBUTING.md +71 -0
- package/.github/lock.yml +24 -0
- package/.github/workflows/tests.yml +19 -0
- package/.internal/Hash.js +88 -0
- package/.internal/ListCache.js +103 -0
- package/.internal/MapCache.js +120 -0
- package/.internal/SetCache.js +52 -0
- package/.internal/Stack.js +93 -0
- package/.internal/addMapEntry.js +15 -0
- package/.internal/addSetEntry.js +15 -0
- package/.internal/arrayEach.js +21 -0
- package/.internal/arrayEachRight.js +20 -0
- package/.internal/arrayIncludes.js +17 -0
- package/.internal/arrayIncludesWith.js +23 -0
- package/.internal/arrayLikeKeys.js +43 -0
- package/.internal/arrayReduce.js +25 -0
- package/.internal/arrayReduceRight.js +23 -0
- package/.internal/asciiSize.js +12 -0
- package/.internal/asciiToArray.js +12 -0
- package/.internal/assignMergeValue.js +20 -0
- package/.internal/assignValue.js +27 -0
- package/.internal/assocIndexOf.js +21 -0
- package/.internal/baseAssignValue.js +23 -0
- package/.internal/baseAt.js +23 -0
- package/.internal/baseClone.js +241 -0
- package/.internal/baseConforms.js +16 -0
- package/.internal/baseConformsTo.js +27 -0
- package/.internal/baseDifference.js +63 -0
- package/.internal/baseEach.js +31 -0
- package/.internal/baseEachRight.js +30 -0
- package/.internal/baseFindIndex.js +23 -0
- package/.internal/baseFindKey.js +22 -0
- package/.internal/baseFlatten.js +37 -0
- package/.internal/baseFor.js +27 -0
- package/.internal/baseForOwn.js +16 -0
- package/.internal/baseForOwnRight.js +16 -0
- package/.internal/baseForRight.js +25 -0
- package/.internal/baseGet.js +24 -0
- package/.internal/baseInRange.js +14 -0
- package/.internal/baseIndexOf.js +20 -0
- package/.internal/baseIndexOfWith.js +23 -0
- package/.internal/baseIntersection.js +72 -0
- package/.internal/baseIsEqual.js +28 -0
- package/.internal/baseIsEqualDeep.js +79 -0
- package/.internal/baseIsMatch.js +64 -0
- package/.internal/baseIsNaN.js +12 -0
- package/.internal/baseMatches.js +20 -0
- package/.internal/baseMatchesProperty.js +33 -0
- package/.internal/baseMerge.js +41 -0
- package/.internal/baseMergeDeep.js +91 -0
- package/.internal/baseOrderBy.js +49 -0
- package/.internal/basePick.js +17 -0
- package/.internal/basePickBy.js +29 -0
- package/.internal/baseProperty.js +12 -0
- package/.internal/basePropertyDeep.js +14 -0
- package/.internal/basePropertyOf.js +12 -0
- package/.internal/basePullAll.js +44 -0
- package/.internal/basePullAt.js +32 -0
- package/.internal/baseRange.js +24 -0
- package/.internal/baseReduce.js +23 -0
- package/.internal/baseSet.js +48 -0
- package/.internal/baseSortBy.js +21 -0
- package/.internal/baseSortedIndex.js +40 -0
- package/.internal/baseSortedIndexBy.js +65 -0
- package/.internal/baseSortedUniq.js +29 -0
- package/.internal/baseSum.js +21 -0
- package/.internal/baseToNumber.js +24 -0
- package/.internal/baseToString.js +33 -0
- package/.internal/baseUniq.js +73 -0
- package/.internal/baseUnset.js +20 -0
- package/.internal/baseUpdate.js +18 -0
- package/.internal/baseValues.js +15 -0
- package/.internal/baseWhile.js +25 -0
- package/.internal/baseXor.js +36 -0
- package/.internal/baseZipObject.js +23 -0
- package/.internal/cacheHas.js +13 -0
- package/.internal/castArrayLikeObject.js +14 -0
- package/.internal/castPath.js +19 -0
- package/.internal/castSlice.js +18 -0
- package/.internal/charsEndIndex.js +19 -0
- package/.internal/charsStartIndex.js +20 -0
- package/.internal/cloneArrayBuffer.js +14 -0
- package/.internal/cloneBuffer.js +34 -0
- package/.internal/cloneDataView.js +16 -0
- package/.internal/cloneRegExp.js +17 -0
- package/.internal/cloneSymbol.js +15 -0
- package/.internal/cloneTypedArray.js +16 -0
- package/.internal/compareAscending.js +45 -0
- package/.internal/compareMultiple.js +45 -0
- package/.internal/composeArgs.js +38 -0
- package/.internal/composeArgsRight.js +39 -0
- package/.internal/copyArray.js +20 -0
- package/.internal/copyObject.js +35 -0
- package/.internal/copySymbols.js +16 -0
- package/.internal/copySymbolsIn.js +16 -0
- package/.internal/createAssigner.js +36 -0
- package/.internal/createCaseFirst.js +34 -0
- package/.internal/createMathOperation.js +35 -0
- package/.internal/createPadding.js +30 -0
- package/.internal/createRange.js +26 -0
- package/.internal/createRound.js +25 -0
- package/.internal/createSet.js +17 -0
- package/.internal/customDefaultsMerge.js +28 -0
- package/.internal/deburrLetter.js +71 -0
- package/.internal/equalArrays.js +84 -0
- package/.internal/equalByTag.js +109 -0
- package/.internal/equalObjects.js +88 -0
- package/.internal/freeGlobal.js +4 -0
- package/.internal/getAllKeys.js +19 -0
- package/.internal/getAllKeysIn.js +21 -0
- package/.internal/getHolder.js +13 -0
- package/.internal/getMatchData.js +23 -0
- package/.internal/getSymbols.js +22 -0
- package/.internal/getSymbolsIn.js +19 -0
- package/.internal/getTag.js +17 -0
- package/.internal/hasUnicode.js +28 -0
- package/.internal/initCloneObject.js +16 -0
- package/.internal/isFlattenable.js +18 -0
- package/.internal/isIndex.js +25 -0
- package/.internal/isIterateeCall.js +31 -0
- package/.internal/isKey.js +27 -0
- package/.internal/isPrototype.js +18 -0
- package/.internal/isStrictComparable.js +15 -0
- package/.internal/iteratorToArray.js +18 -0
- package/.internal/mapToArray.js +18 -0
- package/.internal/matchesStrictComparable.js +20 -0
- package/.internal/memoizeCapped.js +26 -0
- package/.internal/metaMap.js +1 -0
- package/.internal/nodeTypes.js +28 -0
- package/.internal/parent.js +16 -0
- package/.internal/reEscape.js +4 -0
- package/.internal/reEvaluate.js +4 -0
- package/.internal/reInterpolate.js +4 -0
- package/.internal/root.js +13 -0
- package/.internal/setToArray.js +18 -0
- package/.internal/setToPairs.js +18 -0
- package/.internal/setToString.js +18 -0
- package/.internal/strictIndexOf.js +23 -0
- package/.internal/strictLastIndexOf.js +21 -0
- package/.internal/stringSize.js +16 -0
- package/.internal/stringToArray.js +18 -0
- package/.internal/stringToPath.js +44 -0
- package/.internal/toKey.js +21 -0
- package/.internal/unicodeSize.js +47 -0
- package/.internal/unicodeToArray.js +43 -0
- package/.internal/unicodeWords.js +70 -0
- package/CHANGELOG +1 -0
- package/LICENSE +49 -0
- package/README.md +80 -5
- package/SECURITY.md +34 -0
- package/add.js +18 -0
- package/after.js +30 -0
- package/at.js +21 -0
- package/attempt.js +30 -0
- package/before.js +32 -0
- package/camelCase.js +31 -0
- package/capitalize.js +20 -0
- package/castArray.js +41 -0
- package/ceil.js +24 -0
- package/chunk.js +38 -0
- package/clamp.js +31 -0
- package/clone.js +35 -0
- package/cloneDeep.js +28 -0
- package/cloneDeepWith.js +40 -0
- package/cloneWith.js +40 -0
- package/compact.js +30 -0
- package/cond.js +49 -0
- package/conforms.js +33 -0
- package/conformsTo.js +30 -0
- package/countBy.js +41 -0
- package/create.js +39 -0
- package/debounce.js +213 -0
- package/deburr.js +43 -0
- package/defaultTo.js +23 -0
- package/defaultToAny.js +32 -0
- package/defaults.js +45 -0
- package/defaultsDeep.js +26 -0
- package/defer.js +22 -0
- package/delay.js +23 -0
- package/difference.js +30 -0
- package/differenceBy.js +36 -0
- package/differenceWith.js +37 -0
- package/divide.js +18 -0
- package/drop.js +33 -0
- package/dropRight.js +32 -0
- package/dropRightWhile.js +30 -0
- package/dropWhile.js +30 -0
- package/each.js +1 -0
- package/eachRight.js +1 -0
- package/endsWith.js +37 -0
- package/eq.js +35 -0
- package/eqDeep.js +33 -0
- package/escape.js +47 -0
- package/escapeRegExp.js +28 -0
- package/every.js +34 -0
- package/everyValue.js +34 -0
- package/filter.js +39 -0
- package/filterObject.js +34 -0
- package/findKey.js +38 -0
- package/findLast.js +32 -0
- package/findLastIndex.js +41 -0
- package/findLastKey.js +30 -0
- package/first.js +1 -0
- package/flatMap.js +28 -0
- package/flatMapDeep.js +30 -0
- package/flatMapDepth.js +29 -0
- package/flatten.js +21 -0
- package/flattenDeep.js +24 -0
- package/flattenDepth.js +31 -0
- package/flip.js +25 -0
- package/floor.js +24 -0
- package/flow.js +41 -0
- package/flowRight.js +28 -0
- package/forEach.js +33 -0
- package/forEachRight.js +25 -0
- package/forOwn.js +31 -0
- package/forOwnRight.js +36 -0
- package/fromEntries.js +25 -0
- package/functions.js +29 -0
- package/get.js +32 -0
- package/groupBy.js +36 -0
- package/gt.js +30 -0
- package/gte.js +30 -0
- package/has.js +28 -0
- package/hasIn.js +24 -0
- package/hasPath.js +53 -0
- package/hasPathIn.js +50 -0
- package/head.js +24 -0
- package/inRange.js +47 -0
- package/indexOf.js +37 -0
- package/initial.js +20 -0
- package/intersection.js +27 -0
- package/intersectionBy.js +37 -0
- package/intersectionWith.js +38 -0
- package/invert.js +31 -0
- package/invertBy.js +36 -0
- package/invoke.js +29 -0
- package/invokeMap.js +37 -0
- package/isArguments.js +23 -0
- package/isArrayBuffer.js +27 -0
- package/isArrayLike.js +30 -0
- package/isArrayLikeObject.js +31 -0
- package/isBoolean.js +24 -0
- package/isBuffer.js +35 -0
- package/isDate.js +27 -0
- package/isElement.js +23 -0
- package/isEmpty.js +69 -0
- package/isEqualWith.js +39 -0
- package/isError.js +30 -0
- package/isFunction.js +32 -0
- package/isLength.js +33 -0
- package/isMap.js +27 -0
- package/isMatch.js +34 -0
- package/isMatchWith.js +39 -0
- package/isNative.js +36 -0
- package/isNil.js +23 -0
- package/isNull.js +20 -0
- package/isNumber.js +34 -0
- package/isObject.js +29 -0
- package/isObjectLike.js +27 -0
- package/isPlainObject.js +44 -0
- package/isRegExp.js +27 -0
- package/isSet.js +27 -0
- package/isString.js +23 -0
- package/isSymbol.js +23 -0
- package/isTypedArray.js +30 -0
- package/isUndefined.js +20 -0
- package/isWeakMap.js +23 -0
- package/isWeakSet.js +23 -0
- package/kebabCase.js +30 -0
- package/keyBy.js +32 -0
- package/keys.js +37 -0
- package/keysIn.js +32 -0
- package/last.js +18 -0
- package/lastIndexOf.js +40 -0
- package/lowerCase.js +31 -0
- package/lowerFirst.js +20 -0
- package/lt.js +30 -0
- package/lte.js +30 -0
- package/map.js +30 -0
- package/mapKey.js +31 -0
- package/mapObject.js +29 -0
- package/mapValue.js +33 -0
- package/matches.js +37 -0
- package/matchesProperty.js +35 -0
- package/maxBy.js +40 -0
- package/mean.js +19 -0
- package/meanBy.js +28 -0
- package/memoize.js +64 -0
- package/merge.js +37 -0
- package/mergeWith.js +37 -0
- package/method.js +29 -0
- package/methodOf.js +28 -0
- package/minBy.js +40 -0
- package/multiply.js +18 -0
- package/negate.js +28 -0
- package/nth.js +31 -0
- package/nthArg.js +25 -0
- package/once.js +23 -0
- package/orderBy.js +51 -0
- package/over.js +25 -0
- package/overArgs.js +41 -0
- package/overEvery.js +31 -0
- package/overSome.js +31 -0
- package/package.json +23 -6
- package/pad.js +38 -0
- package/padEnd.js +32 -0
- package/padStart.js +32 -0
- package/parseInt.js +36 -0
- package/partition.js +32 -0
- package/pick.js +22 -0
- package/pickBy.js +29 -0
- package/property.js +30 -0
- package/propertyOf.js +26 -0
- package/pull.js +29 -0
- package/pullAll.js +28 -0
- package/pullAllBy.js +31 -0
- package/pullAllWith.js +31 -0
- package/pullAt.js +38 -0
- package/random.js +73 -0
- package/range.js +44 -0
- package/rangeRight.js +39 -0
- package/reduce.js +44 -0
- package/reduceRight.js +29 -0
- package/reject.js +30 -0
- package/remove.js +48 -0
- package/repeat.js +40 -0
- package/replace.js +24 -0
- package/result.js +53 -0
- package/round.js +24 -0
- package/runner.ps1 +45 -0
- package/sample.js +18 -0
- package/sampleSize.js +40 -0
- package/set.js +34 -0
- package/setWith.js +30 -0
- package/shuffle.js +33 -0
- package/size.js +43 -0
- package/slice.js +47 -0
- package/snakeCase.js +33 -0
- package/some.js +29 -0
- package/someValue.js +29 -0
- package/sortedIndex.js +22 -0
- package/sortedIndexBy.js +26 -0
- package/sortedIndexOf.js +29 -0
- package/sortedLastIndex.js +23 -0
- package/sortedLastIndexBy.js +26 -0
- package/sortedLastIndexOf.js +29 -0
- package/sortedUniq.js +24 -0
- package/sortedUniqBy.js +23 -0
- package/split.js +42 -0
- package/startCase.js +30 -0
- package/startsWith.js +36 -0
- package/subtract.js +18 -0
- package/sum.js +21 -0
- package/sumBy.js +26 -0
- package/tail.js +22 -0
- package/take.js +32 -0
- package/takeRight.js +34 -0
- package/takeRightWhile.js +30 -0
- package/takeWhile.js +30 -0
- package/test/Arrays-category-methods.js +97 -0
- package/test/Strings-category-methods.test.js +83 -0
- package/test/__proto__-property-bugs.js +87 -0
- package/test/add.test.js +15 -0
- package/test/after.test.js +31 -0
- package/test/ary.js +91 -0
- package/test/assign-and-assignIn.js +88 -0
- package/test/assignIn.js +9 -0
- package/test/assignInWith.js +9 -0
- package/test/assignWith-and-assignInWith.js +22 -0
- package/test/at.test.js +124 -0
- package/test/attempt.test.js +55 -0
- package/test/basename.js +151 -0
- package/test/before.js +31 -0
- package/test/bind.js +231 -0
- package/test/bindAll.js +74 -0
- package/test/bindKey.js +66 -0
- package/test/camelCase.test.js +28 -0
- package/test/capitalize.test.js +10 -0
- package/test/case-methods.test.js +105 -0
- package/test/castArray.test.js +23 -0
- package/test/chain.js +74 -0
- package/test/chunk.test.js +45 -0
- package/test/clamp.js +58 -0
- package/test/clone-methods.js +429 -0
- package/test/compact.js +42 -0
- package/test/concat.js +65 -0
- package/test/cond.js +65 -0
- package/test/conforms-methods.js +153 -0
- package/test/conforms.js +15 -0
- package/test/constant.js +40 -0
- package/test/countBy.js +66 -0
- package/test/create.test.js +99 -0
- package/test/curry-methods.js +52 -0
- package/test/curry.js +135 -0
- package/test/curryRight.js +136 -0
- package/test/custom-_.iteratee-methods.js +270 -0
- package/test/debounce-and-throttle.js +167 -0
- package/test/debounce.test.js +250 -0
- package/test/deburr.test.js +28 -0
- package/test/defaultTo.test.js +18 -0
- package/test/defaults.test.js +66 -0
- package/test/defaultsDeep.js +101 -0
- package/test/defer.test.js +40 -0
- package/test/delay.js +67 -0
- package/test/difference-methods.js +85 -0
- package/test/differenceBy.js +23 -0
- package/test/differenceWith.test.js +26 -0
- package/test/divide.test.js +15 -0
- package/test/drop.test.js +62 -0
- package/test/dropRight.test.js +62 -0
- package/test/dropRightWhile.js +52 -0
- package/test/dropWhile.js +67 -0
- package/test/endsWith.test.js +49 -0
- package/test/eq.test.js +21 -0
- package/test/escape.test.js +30 -0
- package/test/escapeRegExp.test.js +28 -0
- package/test/every.js +74 -0
- package/test/exit-early.js +37 -0
- package/test/extremum-methods.js +64 -0
- package/test/fill.js +128 -0
- package/test/filter-methods.js +100 -0
- package/test/filter.test.js +11 -0
- package/test/find-and-findLast.js +22 -0
- package/test/find-and-includes.js +103 -0
- package/test/find-methods.js +139 -0
- package/test/findLast.test.js +99 -0
- package/test/findLastIndex-and-lastIndexOf.test.js +72 -0
- package/test/flatMap-methods.js +72 -0
- package/test/flatMapDepth.js +33 -0
- package/test/flatten-methods.js +106 -0
- package/test/flattenDepth.js +21 -0
- package/test/flip.test.js +14 -0
- package/test/flow-methods.test.js +53 -0
- package/test/forEach.test.js +9 -0
- package/test/forEachRight.test.js +9 -0
- package/test/forIn-methods.js +20 -0
- package/test/forOwn-methods.js +17 -0
- package/test/fromPairs.js +47 -0
- package/test/functions.test.js +22 -0
- package/test/get-and-result.js +148 -0
- package/test/groupBy.js +68 -0
- package/test/gt.test.js +16 -0
- package/test/gte.test.js +16 -0
- package/test/has-methods.js +205 -0
- package/test/head.js +62 -0
- package/test/identity.js +9 -0
- package/test/inRange.js +54 -0
- package/test/includes.js +95 -0
- package/test/indexOf-methods.js +63 -0
- package/test/indexOf.test.js +60 -0
- package/test/initial.js +61 -0
- package/test/intersection-methods.js +91 -0
- package/test/intersectionBy.js +23 -0
- package/test/intersectionWith.test.js +27 -0
- package/test/invert.test.js +30 -0
- package/test/invertBy.js +42 -0
- package/test/invoke.js +71 -0
- package/test/invokeMap.js +105 -0
- package/test/isArguments.test.js +39 -0
- package/test/isArray.js +38 -0
- package/test/isArrayBuffer.test.js +41 -0
- package/test/isArrayLike.test.js +48 -0
- package/test/isBoolean.test.js +43 -0
- package/test/isBuffer.test.js +41 -0
- package/test/isDate.test.js +38 -0
- package/test/isElement.test.js +58 -0
- package/test/isEmpty.js +119 -0
- package/test/isEqual.js +700 -0
- package/test/isEqualWith.js +128 -0
- package/test/isError.test.js +70 -0
- package/test/isFinite.js +48 -0
- package/test/isFunction.js +83 -0
- package/test/isIndex.test.js +34 -0
- package/test/isInteger-methods.js +55 -0
- package/test/isIterateeCall.js +47 -0
- package/test/isLength.test.js +22 -0
- package/test/isMap.test.js +53 -0
- package/test/isMatchWith.js +137 -0
- package/test/isNaN.js +43 -0
- package/test/isNative.js +92 -0
- package/test/isNil.test.js +47 -0
- package/test/isNull.test.js +41 -0
- package/test/isNumber.test.js +42 -0
- package/test/isObject.test.js +53 -0
- package/test/isObjectLike.test.js +40 -0
- package/test/isPlainObject.js +114 -0
- package/test/isRegExp.test.js +39 -0
- package/test/isSet.test.js +53 -0
- package/test/isString.test.js +41 -0
- package/test/isSymbol.test.js +41 -0
- package/test/isType-checks.js +39 -0
- package/test/isTypedArray.js +59 -0
- package/test/isUndefined.test.js +45 -0
- package/test/isWeakMap.test.js +53 -0
- package/test/isWeakSet.test.js +42 -0
- package/test/iteratee.js +164 -0
- package/test/iteration-methods.js +340 -0
- package/test/join.js +20 -0
- package/test/keyBy.js +76 -0
- package/test/keys-methods.js +183 -0
- package/test/last.js +51 -0
- package/test/lodash(...)-methods-that-return-new-wrapped-values.js +45 -0
- package/test/lodash(...)-methods-that-return-the-wrapped-modified-array.js +22 -0
- package/test/lodash(...)-methods-that-return-unwrapped-values.js +112 -0
- package/test/lodash(...).commit.js +21 -0
- package/test/lodash(...).next.js +74 -0
- package/test/lodash(...).plant.js +39 -0
- package/test/lodash(...).pop.js +31 -0
- package/test/lodash(...).push.js +27 -0
- package/test/lodash(...).shift.js +31 -0
- package/test/lodash(...).sort.js +27 -0
- package/test/lodash(...).splice.js +31 -0
- package/test/lodash(...).unshift.js +27 -0
- package/test/lodash(...).value.js +33 -0
- package/test/lodash-constructor.js +39 -0
- package/test/lodash-methods.js +194 -0
- package/test/lodash.methodName.js +75 -0
- package/test/lowerCase.test.js +10 -0
- package/test/lowerFirst.test.js +10 -0
- package/test/lt.test.js +16 -0
- package/test/lte.test.js +17 -0
- package/test/map-caches.js +63 -0
- package/test/map.js +122 -0
- package/test/mapKeys-and-mapValues.js +36 -0
- package/test/mapKeys.js +35 -0
- package/test/mapValues.js +36 -0
- package/test/matches-methods.js +294 -0
- package/test/matches.js +32 -0
- package/test/matchesProperty.js +368 -0
- package/test/math-operator-methods.js +56 -0
- package/test/max.js +27 -0
- package/test/mean.test.js +18 -0
- package/test/meanBy.js +31 -0
- package/test/memoize.test.js +178 -0
- package/test/memoizeCapped.test.js +21 -0
- package/test/merge.test.js +350 -0
- package/test/mergeWith.js +64 -0
- package/test/method.js +132 -0
- package/test/methodOf.js +131 -0
- package/test/methods-using-createWrapper.js +198 -0
- package/test/min.js +27 -0
- package/test/mixin.js +189 -0
- package/test/multiply.test.js +15 -0
- package/test/negate.js +39 -0
- package/test/noConflict.js +33 -0
- package/test/now.js +26 -0
- package/test/nth.js +69 -0
- package/test/nthArg.js +65 -0
- package/test/number-coercion-methods.js +248 -0
- package/test/object-assignments.js +180 -0
- package/test/omit-methods.js +114 -0
- package/test/omit.js +69 -0
- package/test/omitBy.js +14 -0
- package/test/once.test.js +36 -0
- package/test/orderBy.js +61 -0
- package/test/over.js +58 -0
- package/test/overArgs.js +82 -0
- package/test/overEvery.js +87 -0
- package/test/overSome.js +98 -0
- package/test/pad-methods.js +51 -0
- package/test/pad.js +35 -0
- package/test/padEnd.js +34 -0
- package/test/padStart.js +34 -0
- package/test/parseInt.js +81 -0
- package/test/partial-methods.js +113 -0
- package/test/partialRight.js +18 -0
- package/test/partition.js +48 -0
- package/test/pick-methods.js +85 -0
- package/test/pick.js +52 -0
- package/test/pickBy.test.js +22 -0
- package/test/property.test.js +122 -0
- package/test/propertyOf.test.js +122 -0
- package/test/pull-methods.js +49 -0
- package/test/pullAll.test.js +11 -0
- package/test/pullAllBy.test.js +26 -0
- package/test/pullAllWith.test.js +13 -0
- package/test/pullAt.js +122 -0
- package/test/random.js +104 -0
- package/test/range-methods.js +82 -0
- package/test/rearg.js +70 -0
- package/test/reduce-methods.js +68 -0
- package/test/reduce.js +57 -0
- package/test/reduceRight.js +56 -0
- package/test/reject.test.js +11 -0
- package/test/remove.js +80 -0
- package/test/repeat.js +46 -0
- package/test/replace.test.js +10 -0
- package/test/rest.js +49 -0
- package/test/result.test.js +33 -0
- package/test/reverse.js +94 -0
- package/test/round-methods.js +82 -0
- package/test/runInContext.js +29 -0
- package/test/sample.js +32 -0
- package/test/sampleSize.js +76 -0
- package/test/set-methods.js +172 -0
- package/test/setWith.js +19 -0
- package/test/shuffle.js +29 -0
- package/test/size.test.js +75 -0
- package/test/slice-and-toArray.js +43 -0
- package/test/slice.js +133 -0
- package/test/some.js +76 -0
- package/test/sortBy-methods.js +87 -0
- package/test/sortBy.js +75 -0
- package/test/sortedIndex-methods.js +84 -0
- package/test/sortedIndexBy-methods.js +59 -0
- package/test/sortedIndexOf-methods.js +15 -0
- package/test/sortedUniq.test.js +13 -0
- package/test/split.js +35 -0
- package/test/spread.js +58 -0
- package/test/startCase.test.js +10 -0
- package/test/startsWith-and-endsWith.js +38 -0
- package/test/startsWith.js +47 -0
- package/test/strict-mode-checks.js +22 -0
- package/test/stub-methods.js +32 -0
- package/test/subtract.test.js +15 -0
- package/test/sum-methods.js +36 -0
- package/test/sumBy.js +32 -0
- package/test/tail.js +77 -0
- package/test/take.js +65 -0
- package/test/takeRight.js +65 -0
- package/test/takeRightWhile.js +96 -0
- package/test/takeWhile.js +102 -0
- package/test/tap.js +30 -0
- package/test/template.js +451 -0
- package/test/throttle.js +227 -0
- package/test/times.js +62 -0
- package/test/toArray.test.js +48 -0
- package/test/toInteger-methods.js +25 -0
- package/test/toLength.test.js +22 -0
- package/test/toLower.js +10 -0
- package/test/toPairs-methods.js +61 -0
- package/test/toPairs.js +9 -0
- package/test/toPairsIn.js +9 -0
- package/test/toPath.js +66 -0
- package/test/toPlainObject.js +30 -0
- package/test/toString.test.js +43 -0
- package/test/toUpper.js +10 -0
- package/test/transform.js +205 -0
- package/test/trim-methods.js +83 -0
- package/test/truncate.js +64 -0
- package/test/unary.js +27 -0
- package/test/uncommon-symbols.js +170 -0
- package/test/unescape.js +40 -0
- package/test/union-methods.js +31 -0
- package/test/unionBy.js +28 -0
- package/test/unionWith.test.js +24 -0
- package/test/uniq-methods.js +123 -0
- package/test/uniq.js +11 -0
- package/test/uniqBy-methods.js +74 -0
- package/test/uniqWith.test.js +28 -0
- package/test/uniqueId.test.js +22 -0
- package/test/unset.js +119 -0
- package/test/unzip-and-zip.js +72 -0
- package/test/unzipWith.js +39 -0
- package/test/update-methods.js +25 -0
- package/test/updateWith.js +19 -0
- package/test/upperCase.test.js +10 -0
- package/test/upperFirst.test.js +10 -0
- package/test/utils.js +799 -0
- package/test/values-methods.js +47 -0
- package/test/without.test.js +23 -0
- package/test/words.test.js +117 -0
- package/test/wrap.js +46 -0
- package/test/xor-methods.js +70 -0
- package/test/xorBy.js +23 -0
- package/test/xorWith.test.js +13 -0
- package/test/zipObject-methods.js +39 -0
- package/test/zipWith.js +48 -0
- package/throttle.js +70 -0
- package/times.js +42 -0
- package/toArray.js +55 -0
- package/toFinite.js +40 -0
- package/toInteger.js +35 -0
- package/toLength.js +45 -0
- package/toNumber.js +65 -0
- package/toPath.js +29 -0
- package/toPlainObject.js +32 -0
- package/toSafeInteger.js +42 -0
- package/toString.js +44 -0
- package/transform.js +59 -0
- package/trim.js +38 -0
- package/trimEnd.js +36 -0
- package/trimStart.js +36 -0
- package/truncate.js +113 -0
- package/unescape.js +38 -0
- package/union.js +24 -0
- package/unionBy.js +32 -0
- package/unionWith.js +32 -0
- package/uniq.js +26 -0
- package/uniqBy.js +27 -0
- package/uniqWith.js +29 -0
- package/uniqueId.js +33 -0
- package/unset.js +33 -0
- package/unzip.js +43 -0
- package/unzipWith.js +31 -0
- package/update.js +32 -0
- package/updateWith.js +30 -0
- package/upperCase.js +29 -0
- package/upperFirst.js +21 -0
- package/values.js +33 -0
- package/without.js +26 -0
- package/words.js +38 -0
- package/xor.js +24 -0
- package/xorBy.js +31 -0
- package/xorWith.js +31 -0
- package/zip.js +22 -0
- package/zipObject.js +23 -0
- package/zipObjectDeep.js +22 -0
- package/zipWith.js +27 -0
package/.editorconfig
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# This file is for unifying the coding style for different editors and IDEs
|
2
|
+
# editorconfig.org
|
3
|
+
|
4
|
+
root = true
|
5
|
+
|
6
|
+
[*]
|
7
|
+
charset = utf-8
|
8
|
+
end_of_line = lf
|
9
|
+
indent_size = 2
|
10
|
+
indent_style = space
|
11
|
+
insert_final_newline = true
|
12
|
+
trim_trailing_whitespace = true
|
package/.eslintrc.js
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
module.exports = {
|
2
|
+
'extends': ['plugin:import/errors'],
|
3
|
+
'plugins': ['import'],
|
4
|
+
'env': {
|
5
|
+
'es6': true,
|
6
|
+
'node': true
|
7
|
+
},
|
8
|
+
'parserOptions': {
|
9
|
+
'ecmaVersion': 6,
|
10
|
+
'sourceType': 'module',
|
11
|
+
'ecmaFeatures': {
|
12
|
+
'impliedStrict': true,
|
13
|
+
'objectLiteralDuplicateProperties': false
|
14
|
+
}
|
15
|
+
},
|
16
|
+
'rules': {
|
17
|
+
'array-bracket-spacing': ['error', 'never'],
|
18
|
+
|
19
|
+
'camelcase': ['error', {
|
20
|
+
'properties': 'never'
|
21
|
+
}],
|
22
|
+
|
23
|
+
'comma-dangle': ['error', 'never'],
|
24
|
+
|
25
|
+
'curly': ['error', 'all'],
|
26
|
+
|
27
|
+
'eol-last': ['error'],
|
28
|
+
|
29
|
+
'indent': ['error', 2, {
|
30
|
+
'SwitchCase': 1
|
31
|
+
}],
|
32
|
+
|
33
|
+
'keyword-spacing': ['error'],
|
34
|
+
|
35
|
+
'max-len': ['error', {
|
36
|
+
'code': 180,
|
37
|
+
'ignoreComments': true,
|
38
|
+
'ignoreRegExpLiterals': true
|
39
|
+
}],
|
40
|
+
|
41
|
+
'no-else-return': ['error'],
|
42
|
+
|
43
|
+
'no-mixed-spaces-and-tabs': ['error'],
|
44
|
+
|
45
|
+
'no-multiple-empty-lines': ['error'],
|
46
|
+
|
47
|
+
'no-spaced-func': ['error'],
|
48
|
+
|
49
|
+
'no-trailing-spaces': ['error'],
|
50
|
+
|
51
|
+
'no-undef': ['error'],
|
52
|
+
|
53
|
+
'no-unexpected-multiline': ['error'],
|
54
|
+
|
55
|
+
'no-unused-vars': ['error', {
|
56
|
+
'args': 'none',
|
57
|
+
'vars': 'all'
|
58
|
+
}],
|
59
|
+
|
60
|
+
'quotes': ['error', 'single', {
|
61
|
+
'allowTemplateLiterals': true,
|
62
|
+
'avoidEscape': true
|
63
|
+
}],
|
64
|
+
|
65
|
+
'semi': ['error', 'never'],
|
66
|
+
|
67
|
+
'space-before-blocks': ['error', 'always'],
|
68
|
+
|
69
|
+
'space-before-function-paren': ['error', 'never'],
|
70
|
+
|
71
|
+
'space-in-parens': ['error', 'never'],
|
72
|
+
|
73
|
+
'space-unary-ops': ['error', {
|
74
|
+
'nonwords': false,
|
75
|
+
'overrides': {}
|
76
|
+
}],
|
77
|
+
|
78
|
+
// 'valid-jsdoc': ['error']
|
79
|
+
|
80
|
+
// ECMAScript 6 rules
|
81
|
+
|
82
|
+
'arrow-body-style': ['error', 'as-needed', {
|
83
|
+
'requireReturnForObjectLiteral': false
|
84
|
+
}],
|
85
|
+
|
86
|
+
'arrow-parens': ['error', 'always'],
|
87
|
+
|
88
|
+
'arrow-spacing': ['error', {
|
89
|
+
'after': true,
|
90
|
+
'before': true
|
91
|
+
}],
|
92
|
+
|
93
|
+
'no-class-assign': ['error'],
|
94
|
+
|
95
|
+
'no-const-assign': ['error'],
|
96
|
+
|
97
|
+
'no-dupe-class-members': ['error'],
|
98
|
+
|
99
|
+
'no-duplicate-imports': ['error'],
|
100
|
+
|
101
|
+
'no-new-symbol': ['error'],
|
102
|
+
|
103
|
+
'no-useless-rename': ['error'],
|
104
|
+
|
105
|
+
'no-var': ['error'],
|
106
|
+
|
107
|
+
'object-shorthand': ['error', 'always', {
|
108
|
+
'avoidQuotes': true,
|
109
|
+
'ignoreConstructors': false
|
110
|
+
}],
|
111
|
+
|
112
|
+
'prefer-arrow-callback': ['error', {
|
113
|
+
'allowNamedFunctions': false,
|
114
|
+
'allowUnboundThis': true
|
115
|
+
}],
|
116
|
+
|
117
|
+
'prefer-const': ['error'],
|
118
|
+
|
119
|
+
'prefer-rest-params': ['error'],
|
120
|
+
|
121
|
+
'prefer-template': ['error'],
|
122
|
+
|
123
|
+
'template-curly-spacing': ['error', 'never']
|
124
|
+
}
|
125
|
+
};
|
package/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* text=auto
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# :construction: Notice :construction:
|
2
|
+
|
3
|
+
Pardon the mess. The `master` branch is in flux while we work on Lodash v5. This
|
4
|
+
means things like npm scripts, which we encourage using for contributions, may
|
5
|
+
not be working. Thank you for your patience.
|
6
|
+
|
7
|
+
# Contributing to Lodash
|
8
|
+
|
9
|
+
Contributions are always welcome. Before contributing please read the
|
10
|
+
[code of conduct](https://code-of-conduct.openjsf.org) &
|
11
|
+
[search the issue tracker](https://github.com/lodash/lodash/issues); your issue
|
12
|
+
may have already been discussed or fixed in `master`. To contribute,
|
13
|
+
[fork](https://help.github.com/articles/fork-a-repo/) Lodash, commit your changes,
|
14
|
+
& [send a pull request](https://help.github.com/articles/using-pull-requests/).
|
15
|
+
|
16
|
+
## Feature Requests
|
17
|
+
|
18
|
+
Feature requests should be submitted in the
|
19
|
+
[issue tracker](https://github.com/lodash/lodash/issues), with a description of
|
20
|
+
the expected behavior & use case, where they’ll remain closed until sufficient interest,
|
21
|
+
[e.g. :+1: reactions](https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/),
|
22
|
+
has been [shown by the community](https://github.com/lodash/lodash/issues?q=label%3A%22votes+needed%22+sort%3Areactions-%2B1-desc).
|
23
|
+
Before submitting a request, please search for similar ones in the
|
24
|
+
[closed issues](https://github.com/lodash/lodash/issues?q=is%3Aissue+is%3Aclosed+label%3Aenhancement).
|
25
|
+
|
26
|
+
## Pull Requests
|
27
|
+
|
28
|
+
For additions or bug fixes, please modify the relevant files. Include
|
29
|
+
updated unit tests in the `test` directory as part of your pull request.
|
30
|
+
Unit test files should be named `[filename].test.js`.
|
31
|
+
|
32
|
+
Before running the unit tests you’ll need to install, `npm i`,
|
33
|
+
[development dependencies](https://docs.npmjs.com/files/package.json#devdependencies).
|
34
|
+
Run unit tests from the command-line via `npm test`.
|
35
|
+
|
36
|
+
## Contributor License Agreement
|
37
|
+
|
38
|
+
Lodash is a member of the [JS Foundation](https://openjsf.org/).
|
39
|
+
As such, we request that all contributors sign the JS Foundation
|
40
|
+
[contributor license agreement (CLA)](https://cla.js.foundation/lodash/lodash).
|
41
|
+
|
42
|
+
For more information about CLAs, please check out Alex Russell’s excellent post,
|
43
|
+
[“Why Do I Need to Sign This?”](https://infrequently.org/2008/06/why-do-i-need-to-sign-this/).
|
44
|
+
|
45
|
+
## Coding Guidelines
|
46
|
+
|
47
|
+
In addition to the following guidelines, please follow the conventions already
|
48
|
+
established in the code.
|
49
|
+
|
50
|
+
- **Spacing**:<br>
|
51
|
+
Use two spaces for indentation. No tabs.
|
52
|
+
|
53
|
+
- **Naming**:<br>
|
54
|
+
Keep variable & method names concise & descriptive.<br>
|
55
|
+
Variable names `index`, `array`, & `iteratee` are preferable to
|
56
|
+
`i`, `arr`, & `fn`.
|
57
|
+
|
58
|
+
- **Quotes**:<br>
|
59
|
+
Single-quoted strings are preferred to double-quoted strings; however,
|
60
|
+
please use a double-quoted string if the value contains a single-quote
|
61
|
+
character to avoid unnecessary escaping.
|
62
|
+
|
63
|
+
- **Comments**:<br>
|
64
|
+
Please use single-line comments to annotate significant additions, &
|
65
|
+
[JSDoc-style](http://www.2ality.com/2011/08/jsdoc-intro.html) comments for
|
66
|
+
functions.
|
67
|
+
|
68
|
+
Guidelines are enforced using [ESLint](https://www.npmjs.com/package/eslint):
|
69
|
+
```bash
|
70
|
+
$ npm run style
|
71
|
+
```
|
package/.github/lock.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Configuration for lock-threads - https://github.com/dessant/lock-threads
|
2
|
+
|
3
|
+
# Number of days of inactivity before a closed issue or pull request is locked
|
4
|
+
daysUntilLock: 365
|
5
|
+
|
6
|
+
# Skip issues and pull requests created before a given timestamp. Timestamp must
|
7
|
+
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable
|
8
|
+
skipCreatedBefore: false
|
9
|
+
|
10
|
+
# Issues and pull requests with these labels will not be locked. Set to `[]` to disable
|
11
|
+
exemptLabels:
|
12
|
+
- votes needed
|
13
|
+
|
14
|
+
# Label to add before locking, such as `outdated`. Set to `false` to disable
|
15
|
+
lockLabel: false
|
16
|
+
|
17
|
+
# Comment to post before locking. Set to `false` to disable
|
18
|
+
lockComment: >
|
19
|
+
This thread has been automatically locked since there has not been
|
20
|
+
any recent activity after it was closed. Please open a new issue for
|
21
|
+
related bugs.
|
22
|
+
|
23
|
+
# Assign `resolved` as the reason for locking. Set to `false` to disable
|
24
|
+
setLockReason: true
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: Node.js CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
tests:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
node-version: [14.x]
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
16
|
+
uses: actions/setup-node@v1
|
17
|
+
with:
|
18
|
+
node-version: ${{ matrix.node-version }}
|
19
|
+
- run: npm cit
|
@@ -0,0 +1,88 @@
|
|
1
|
+
/** Used to stand-in for `undefined` hash values. */
|
2
|
+
const HASH_UNDEFINED = '__lodash_hash_undefined__'
|
3
|
+
|
4
|
+
class Hash {
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Creates a hash object.
|
8
|
+
*
|
9
|
+
* @private
|
10
|
+
* @constructor
|
11
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
12
|
+
*/
|
13
|
+
constructor(entries) {
|
14
|
+
let index = -1
|
15
|
+
const length = entries == null ? 0 : entries.length
|
16
|
+
|
17
|
+
this.clear()
|
18
|
+
while (++index < length) {
|
19
|
+
const entry = entries[index]
|
20
|
+
this.set(entry[0], entry[1])
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Removes all key-value entries from the hash.
|
26
|
+
*
|
27
|
+
* @memberOf Hash
|
28
|
+
*/
|
29
|
+
clear() {
|
30
|
+
this.__data__ = Object.create(null)
|
31
|
+
this.size = 0
|
32
|
+
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Removes `key` and its value from the hash.
|
36
|
+
*
|
37
|
+
* @memberOf Hash
|
38
|
+
* @param {string} key The key of the value to remove.
|
39
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
40
|
+
*/
|
41
|
+
delete(key) {
|
42
|
+
const result = this.has(key) && delete this.__data__[key]
|
43
|
+
this.size -= result ? 1 : 0
|
44
|
+
return result
|
45
|
+
}
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Gets the hash value for `key`.
|
49
|
+
*
|
50
|
+
* @memberOf Hash
|
51
|
+
* @param {string} key The key of the value to get.
|
52
|
+
* @returns {*} Returns the entry value.
|
53
|
+
*/
|
54
|
+
get(key) {
|
55
|
+
const data = this.__data__
|
56
|
+
const result = data[key]
|
57
|
+
return result === HASH_UNDEFINED ? undefined : result
|
58
|
+
}
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Checks if a hash value for `key` exists.
|
62
|
+
*
|
63
|
+
* @memberOf Hash
|
64
|
+
* @param {string} key The key of the entry to check.
|
65
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
66
|
+
*/
|
67
|
+
has(key) {
|
68
|
+
const data = this.__data__
|
69
|
+
return data[key] !== undefined
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Sets the hash `key` to `value`.
|
74
|
+
*
|
75
|
+
* @memberOf Hash
|
76
|
+
* @param {string} key The key of the value to set.
|
77
|
+
* @param {*} value The value to set.
|
78
|
+
* @returns {Object} Returns the hash instance.
|
79
|
+
*/
|
80
|
+
set(key, value) {
|
81
|
+
const data = this.__data__
|
82
|
+
this.size += this.has(key) ? 0 : 1
|
83
|
+
data[key] = value === undefined ? HASH_UNDEFINED : value
|
84
|
+
return this
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
export default Hash
|
@@ -0,0 +1,103 @@
|
|
1
|
+
import assocIndexOf from './assocIndexOf.js'
|
2
|
+
|
3
|
+
class ListCache {
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Creates an list cache object.
|
7
|
+
*
|
8
|
+
* @private
|
9
|
+
* @constructor
|
10
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
11
|
+
*/
|
12
|
+
constructor(entries) {
|
13
|
+
let index = -1
|
14
|
+
const length = entries == null ? 0 : entries.length
|
15
|
+
|
16
|
+
this.clear()
|
17
|
+
while (++index < length) {
|
18
|
+
const entry = entries[index]
|
19
|
+
this.set(entry[0], entry[1])
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Removes all key-value entries from the list cache.
|
25
|
+
*
|
26
|
+
* @memberOf ListCache
|
27
|
+
*/
|
28
|
+
clear() {
|
29
|
+
this.__data__ = []
|
30
|
+
this.size = 0
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Removes `key` and its value from the list cache.
|
35
|
+
*
|
36
|
+
* @memberOf ListCache
|
37
|
+
* @param {string} key The key of the value to remove.
|
38
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
39
|
+
*/
|
40
|
+
delete(key) {
|
41
|
+
const data = this.__data__
|
42
|
+
const index = assocIndexOf(data, key)
|
43
|
+
|
44
|
+
if (index < 0) {
|
45
|
+
return false
|
46
|
+
}
|
47
|
+
const lastIndex = data.length - 1
|
48
|
+
if (index == lastIndex) {
|
49
|
+
data.pop()
|
50
|
+
} else {
|
51
|
+
data.splice(index, 1)
|
52
|
+
}
|
53
|
+
--this.size
|
54
|
+
return true
|
55
|
+
}
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Gets the list cache value for `key`.
|
59
|
+
*
|
60
|
+
* @memberOf ListCache
|
61
|
+
* @param {string} key The key of the value to get.
|
62
|
+
* @returns {*} Returns the entry value.
|
63
|
+
*/
|
64
|
+
get(key) {
|
65
|
+
const data = this.__data__
|
66
|
+
const index = assocIndexOf(data, key)
|
67
|
+
return index < 0 ? undefined : data[index][1]
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Checks if a list cache value for `key` exists.
|
72
|
+
*
|
73
|
+
* @memberOf ListCache
|
74
|
+
* @param {string} key The key of the entry to check.
|
75
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
76
|
+
*/
|
77
|
+
has(key) {
|
78
|
+
return assocIndexOf(this.__data__, key) > -1
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Sets the list cache `key` to `value`.
|
83
|
+
*
|
84
|
+
* @memberOf ListCache
|
85
|
+
* @param {string} key The key of the value to set.
|
86
|
+
* @param {*} value The value to set.
|
87
|
+
* @returns {Object} Returns the list cache instance.
|
88
|
+
*/
|
89
|
+
set(key, value) {
|
90
|
+
const data = this.__data__
|
91
|
+
const index = assocIndexOf(data, key)
|
92
|
+
|
93
|
+
if (index < 0) {
|
94
|
+
++this.size
|
95
|
+
data.push([key, value])
|
96
|
+
} else {
|
97
|
+
data[index][1] = value
|
98
|
+
}
|
99
|
+
return this
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
export default ListCache
|
@@ -0,0 +1,120 @@
|
|
1
|
+
|
2
|
+
import Hash from './Hash.js'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Gets the data for `map`.
|
6
|
+
*
|
7
|
+
* @private
|
8
|
+
* @param {Object} map The map to query.
|
9
|
+
* @param {string} key The reference key.
|
10
|
+
* @returns {*} Returns the map data.
|
11
|
+
*/
|
12
|
+
function getMapData({ __data__ }, key) {
|
13
|
+
const data = __data__
|
14
|
+
return isKeyable(key)
|
15
|
+
? data[typeof key === 'string' ? 'string' : 'hash']
|
16
|
+
: data.map
|
17
|
+
}
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Checks if `value` is suitable for use as unique object key.
|
21
|
+
*
|
22
|
+
* @private
|
23
|
+
* @param {*} value The value to check.
|
24
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
25
|
+
*/
|
26
|
+
function isKeyable(value) {
|
27
|
+
const type = typeof value
|
28
|
+
return (type === 'string' || type === 'number' || type === 'symbol' || type === 'boolean')
|
29
|
+
? (value !== '__proto__')
|
30
|
+
: (value === null)
|
31
|
+
}
|
32
|
+
|
33
|
+
class MapCache {
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Creates a map cache object to store key-value pairs.
|
37
|
+
*
|
38
|
+
* @private
|
39
|
+
* @constructor
|
40
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
41
|
+
*/
|
42
|
+
constructor(entries) {
|
43
|
+
let index = -1
|
44
|
+
const length = entries == null ? 0 : entries.length
|
45
|
+
|
46
|
+
this.clear()
|
47
|
+
while (++index < length) {
|
48
|
+
const entry = entries[index]
|
49
|
+
this.set(entry[0], entry[1])
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Removes all key-value entries from the map.
|
55
|
+
*
|
56
|
+
* @memberOf MapCache
|
57
|
+
*/
|
58
|
+
clear() {
|
59
|
+
this.size = 0
|
60
|
+
this.__data__ = {
|
61
|
+
'hash': new Hash,
|
62
|
+
'map': new Map,
|
63
|
+
'string': new Hash
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Removes `key` and its value from the map.
|
69
|
+
*
|
70
|
+
* @memberOf MapCache
|
71
|
+
* @param {string} key The key of the value to remove.
|
72
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
73
|
+
*/
|
74
|
+
delete(key) {
|
75
|
+
const result = getMapData(this, key)['delete'](key)
|
76
|
+
this.size -= result ? 1 : 0
|
77
|
+
return result
|
78
|
+
}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Gets the map value for `key`.
|
82
|
+
*
|
83
|
+
* @memberOf MapCache
|
84
|
+
* @param {string} key The key of the value to get.
|
85
|
+
* @returns {*} Returns the entry value.
|
86
|
+
*/
|
87
|
+
get(key) {
|
88
|
+
return getMapData(this, key).get(key)
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Checks if a map value for `key` exists.
|
93
|
+
*
|
94
|
+
* @memberOf MapCache
|
95
|
+
* @param {string} key The key of the entry to check.
|
96
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
97
|
+
*/
|
98
|
+
has(key) {
|
99
|
+
return getMapData(this, key).has(key)
|
100
|
+
}
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Sets the map `key` to `value`.
|
104
|
+
*
|
105
|
+
* @memberOf MapCache
|
106
|
+
* @param {string} key The key of the value to set.
|
107
|
+
* @param {*} value The value to set.
|
108
|
+
* @returns {Object} Returns the map cache instance.
|
109
|
+
*/
|
110
|
+
set(key, value) {
|
111
|
+
const data = getMapData(this, key)
|
112
|
+
const size = data.size
|
113
|
+
|
114
|
+
data.set(key, value)
|
115
|
+
this.size += data.size == size ? 0 : 1
|
116
|
+
return this
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
export default MapCache
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import MapCache from './MapCache.js'
|
2
|
+
|
3
|
+
/** Used to stand-in for `undefined` hash values. */
|
4
|
+
const HASH_UNDEFINED = '__lodash_hash_undefined__'
|
5
|
+
|
6
|
+
class SetCache {
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Creates an array cache object to store unique values.
|
10
|
+
*
|
11
|
+
* @private
|
12
|
+
* @constructor
|
13
|
+
* @param {Array} [values] The values to cache.
|
14
|
+
*/
|
15
|
+
constructor(values) {
|
16
|
+
let index = -1
|
17
|
+
const length = values == null ? 0 : values.length
|
18
|
+
|
19
|
+
this.__data__ = new MapCache
|
20
|
+
while (++index < length) {
|
21
|
+
this.add(values[index])
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Adds `value` to the array cache.
|
27
|
+
*
|
28
|
+
* @memberOf SetCache
|
29
|
+
* @alias push
|
30
|
+
* @param {*} value The value to cache.
|
31
|
+
* @returns {Object} Returns the cache instance.
|
32
|
+
*/
|
33
|
+
add(value) {
|
34
|
+
this.__data__.set(value, HASH_UNDEFINED)
|
35
|
+
return this
|
36
|
+
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Checks if `value` is in the array cache.
|
40
|
+
*
|
41
|
+
* @memberOf SetCache
|
42
|
+
* @param {*} value The value to search for.
|
43
|
+
* @returns {boolean} Returns `true` if `value` is found, else `false`.
|
44
|
+
*/
|
45
|
+
has(value) {
|
46
|
+
return this.__data__.has(value)
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
SetCache.prototype.push = SetCache.prototype.add
|
51
|
+
|
52
|
+
export default SetCache
|