@gooddata/util 11.68.0-alpha.0 → 11.68.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/NOTICE +179 -0
- package/esm/_/_assignValue.d.ts +12 -0
- package/esm/_/_assignValue.d.ts.map +1 -0
- package/esm/_/_assignValue.js +49 -0
- package/esm/_/_baseAssignValue.d.ts +41 -0
- package/esm/_/_baseAssignValue.d.ts.map +1 -0
- package/esm/_/_baseAssignValue.js +48 -0
- package/esm/_/_baseClone.d.ts +28 -0
- package/esm/_/_baseClone.d.ts.map +1 -0
- package/esm/_/_baseClone.js +229 -0
- package/esm/_/_baseDifference.d.ts +18 -0
- package/esm/_/_baseDifference.d.ts.map +1 -0
- package/esm/_/_baseDifference.js +79 -0
- package/esm/_/_baseEach.d.ts +11 -0
- package/esm/_/_baseEach.d.ts.map +1 -0
- package/esm/_/_baseEach.js +62 -0
- package/esm/_/_baseExtremum.d.ts +15 -0
- package/esm/_/_baseExtremum.d.ts.map +1 -0
- package/esm/_/_baseExtremum.js +64 -0
- package/esm/_/_baseGet.d.ts +10 -0
- package/esm/_/_baseGet.d.ts.map +1 -0
- package/esm/_/_baseGet.js +50 -0
- package/esm/_/_baseGetTag.d.ts +9 -0
- package/esm/_/_baseGetTag.d.ts.map +1 -0
- package/esm/_/_baseGetTag.js +48 -0
- package/esm/_/_baseIntersection.d.ts +19 -0
- package/esm/_/_baseIntersection.d.ts.map +1 -0
- package/esm/_/_baseIntersection.js +91 -0
- package/esm/_/_baseIsEqual.d.ts +34 -0
- package/esm/_/_baseIsEqual.d.ts.map +1 -0
- package/esm/_/_baseIsEqual.js +278 -0
- package/esm/_/_baseIsMatch.d.ts +13 -0
- package/esm/_/_baseIsMatch.d.ts.map +1 -0
- package/esm/_/_baseIsMatch.js +67 -0
- package/esm/_/_baseIteratee.d.ts +15 -0
- package/esm/_/_baseIteratee.d.ts.map +1 -0
- package/esm/_/_baseIteratee.js +65 -0
- package/esm/_/_baseKeys.d.ts +12 -0
- package/esm/_/_baseKeys.d.ts.map +1 -0
- package/esm/_/_baseKeys.js +46 -0
- package/esm/_/_baseMatches.d.ts +10 -0
- package/esm/_/_baseMatches.d.ts.map +1 -0
- package/esm/_/_baseMatches.js +50 -0
- package/esm/_/_baseMatchesProperty.d.ts +11 -0
- package/esm/_/_baseMatchesProperty.d.ts.map +1 -0
- package/esm/_/_baseMatchesProperty.js +59 -0
- package/esm/_/_baseMerge.d.ts +19 -0
- package/esm/_/_baseMerge.d.ts.map +1 -0
- package/esm/_/_baseMerge.js +146 -0
- package/esm/_/_baseOrderBy.d.ts +11 -0
- package/esm/_/_baseOrderBy.d.ts.map +1 -0
- package/esm/_/_baseOrderBy.js +70 -0
- package/esm/_/_basePickBy.d.ts +14 -0
- package/esm/_/_basePickBy.d.ts.map +1 -0
- package/esm/_/_basePickBy.js +57 -0
- package/esm/_/_baseSet.d.ts +13 -0
- package/esm/_/_baseSet.d.ts.map +1 -0
- package/esm/_/_baseSet.js +74 -0
- package/esm/_/_baseSlice.d.ts +45 -0
- package/esm/_/_baseSlice.d.ts.map +1 -0
- package/esm/_/_baseSlice.js +30 -0
- package/esm/_/_baseSum.d.ts +42 -0
- package/esm/_/_baseSum.d.ts.map +1 -0
- package/esm/_/_baseSum.js +21 -0
- package/esm/_/_baseUniq.d.ts +43 -0
- package/esm/_/_baseUniq.d.ts.map +1 -0
- package/esm/_/_baseUniq.js +57 -0
- package/esm/_/_baseUnset.d.ts +13 -0
- package/esm/_/_baseUnset.d.ts.map +1 -0
- package/esm/_/_baseUnset.js +62 -0
- package/esm/_/_castPath.d.ts +10 -0
- package/esm/_/_castPath.d.ts.map +1 -0
- package/esm/_/_castPath.js +48 -0
- package/esm/_/_cloneArrayBuffer.d.ts +39 -0
- package/esm/_/_cloneArrayBuffer.d.ts.map +1 -0
- package/esm/_/_cloneArrayBuffer.js +45 -0
- package/esm/_/_cloneTypedArray.d.ts +10 -0
- package/esm/_/_cloneTypedArray.d.ts.map +1 -0
- package/esm/_/_cloneTypedArray.js +50 -0
- package/esm/_/_compareAscending.d.ts +12 -0
- package/esm/_/_compareAscending.d.ts.map +1 -0
- package/esm/_/_compareAscending.js +78 -0
- package/esm/_/_createCompounder.d.ts +11 -0
- package/esm/_/_createCompounder.d.ts.map +1 -0
- package/esm/_/_createCompounder.js +47 -0
- package/esm/_/_flattenArrayLikeObjects.d.ts +11 -0
- package/esm/_/_flattenArrayLikeObjects.d.ts.map +1 -0
- package/esm/_/_flattenArrayLikeObjects.js +55 -0
- package/esm/_/_getAllKeys.d.ts +9 -0
- package/esm/_/_getAllKeys.d.ts.map +1 -0
- package/esm/_/_getAllKeys.js +43 -0
- package/esm/_/_getAllKeysIn.d.ts +12 -0
- package/esm/_/_getAllKeysIn.d.ts.map +1 -0
- package/esm/_/_getAllKeysIn.js +59 -0
- package/esm/_/_getMatchData.d.ts +16 -0
- package/esm/_/_getMatchData.d.ts.map +1 -0
- package/esm/_/_getMatchData.js +46 -0
- package/esm/_/_getRawTag.d.ts +43 -0
- package/esm/_/_getRawTag.d.ts.map +1 -0
- package/esm/_/_getRawTag.js +65 -0
- package/esm/_/_hasPath.d.ts +13 -0
- package/esm/_/_hasPath.d.ts.map +1 -0
- package/esm/_/_hasPath.js +70 -0
- package/esm/_/_initCloneObject.d.ts +10 -0
- package/esm/_/_initCloneObject.d.ts.map +1 -0
- package/esm/_/_initCloneObject.js +48 -0
- package/esm/_/_isIndex.d.ts +11 -0
- package/esm/_/_isIndex.d.ts.map +1 -0
- package/esm/_/_isIndex.js +51 -0
- package/esm/_/_isIterateeCall.d.ts +13 -0
- package/esm/_/_isIterateeCall.d.ts.map +1 -0
- package/esm/_/_isIterateeCall.js +55 -0
- package/esm/_/_isKey.d.ts +12 -0
- package/esm/_/_isKey.d.ts.map +1 -0
- package/esm/_/_isKey.js +58 -0
- package/esm/_/_isPrototype.d.ts +39 -0
- package/esm/_/_isPrototype.d.ts.map +1 -0
- package/esm/_/_isPrototype.js +43 -0
- package/esm/_/_isStrictComparable.d.ts +9 -0
- package/esm/_/_isStrictComparable.d.ts.map +1 -0
- package/esm/_/_isStrictComparable.js +42 -0
- package/esm/_/_matchesStrictComparable.d.ts +41 -0
- package/esm/_/_matchesStrictComparable.d.ts.map +1 -0
- package/esm/_/_matchesStrictComparable.js +50 -0
- package/esm/_/_stringToPath.d.ts +10 -0
- package/esm/_/_stringToPath.d.ts.map +1 -0
- package/esm/_/_stringToPath.js +64 -0
- package/esm/_/_toKey.d.ts +9 -0
- package/esm/_/_toKey.d.ts.map +1 -0
- package/esm/_/_toKey.js +46 -0
- package/esm/_/_unicode.d.ts +27 -0
- package/esm/_/_unicode.d.ts.map +1 -0
- package/esm/_/_unicode.js +120 -0
- package/esm/_/assignIn.d.ts +35 -0
- package/esm/_/assignIn.d.ts.map +1 -0
- package/esm/_/assignIn.js +50 -0
- package/esm/_/bindAll.d.ts +16 -0
- package/esm/_/bindAll.d.ts.map +1 -0
- package/esm/_/bindAll.js +88 -0
- package/esm/_/camelCase.d.ts +10 -0
- package/esm/_/camelCase.d.ts.map +1 -0
- package/esm/_/camelCase.js +45 -0
- package/esm/_/capitalize.d.ts +9 -0
- package/esm/_/capitalize.d.ts.map +1 -0
- package/esm/_/capitalize.js +43 -0
- package/esm/_/chunk.d.ts +15 -0
- package/esm/_/chunk.d.ts.map +1 -0
- package/esm/_/chunk.js +61 -0
- package/esm/_/clamp.d.ts +17 -0
- package/esm/_/clamp.d.ts.map +1 -0
- package/esm/_/clamp.js +56 -0
- package/esm/_/clone.d.ts +12 -0
- package/esm/_/clone.d.ts.map +1 -0
- package/esm/_/clone.js +45 -0
- package/esm/_/cloneDeep.d.ts +14 -0
- package/esm/_/cloneDeep.d.ts.map +1 -0
- package/esm/_/cloneDeep.js +47 -0
- package/esm/_/cloneDeepWith.d.ts +18 -0
- package/esm/_/cloneDeepWith.d.ts.map +1 -0
- package/esm/_/cloneDeepWith.js +36 -0
- package/esm/_/compact.d.ts +46 -0
- package/esm/_/compact.d.ts.map +1 -0
- package/esm/_/compact.js +23 -0
- package/esm/_/constant.d.ts +39 -0
- package/esm/_/constant.d.ts.map +1 -0
- package/esm/_/constant.js +43 -0
- package/esm/_/debounce.d.ts +70 -0
- package/esm/_/debounce.d.ts.map +1 -0
- package/esm/_/debounce.js +136 -0
- package/esm/_/deburr.d.ts +10 -0
- package/esm/_/deburr.d.ts.map +1 -0
- package/esm/_/deburr.js +243 -0
- package/esm/_/defaults.d.ts +36 -0
- package/esm/_/defaults.d.ts.map +1 -0
- package/esm/_/defaults.js +51 -0
- package/esm/_/difference.d.ts +14 -0
- package/esm/_/difference.d.ts.map +1 -0
- package/esm/_/difference.js +46 -0
- package/esm/_/differenceBy.d.ts +39 -0
- package/esm/_/differenceBy.d.ts.map +1 -0
- package/esm/_/differenceBy.js +40 -0
- package/esm/_/differenceWith.d.ts +27 -0
- package/esm/_/differenceWith.d.ts.map +1 -0
- package/esm/_/differenceWith.js +39 -0
- package/esm/_/dropRightWhile.d.ts +13 -0
- package/esm/_/dropRightWhile.d.ts.map +1 -0
- package/esm/_/dropRightWhile.js +54 -0
- package/esm/_/eq.d.ts +41 -0
- package/esm/_/eq.d.ts.map +1 -0
- package/esm/_/eq.js +43 -0
- package/esm/_/escape.d.ts +13 -0
- package/esm/_/escape.d.ts.map +1 -0
- package/esm/_/escape.js +56 -0
- package/esm/_/escapeRegExp.d.ts +12 -0
- package/esm/_/escapeRegExp.d.ts.map +1 -0
- package/esm/_/escapeRegExp.js +47 -0
- package/esm/_/findKey.d.ts +14 -0
- package/esm/_/findKey.d.ts.map +1 -0
- package/esm/_/findKey.js +58 -0
- package/esm/_/findLastIndex.d.ts +16 -0
- package/esm/_/findLastIndex.d.ts.map +1 -0
- package/esm/_/findLastIndex.js +67 -0
- package/esm/_/get.d.ts +78 -0
- package/esm/_/get.d.ts.map +1 -0
- package/esm/_/get.js +36 -0
- package/esm/_/groupBy.d.ts +19 -0
- package/esm/_/groupBy.d.ts.map +1 -0
- package/esm/_/groupBy.js +49 -0
- package/esm/_/has.d.ts +23 -0
- package/esm/_/has.d.ts.map +1 -0
- package/esm/_/has.js +35 -0
- package/esm/_/inRange.d.ts +14 -0
- package/esm/_/inRange.d.ts.map +1 -0
- package/esm/_/inRange.js +51 -0
- package/esm/_/initial.d.ts +11 -0
- package/esm/_/initial.d.ts.map +1 -0
- package/esm/_/initial.js +44 -0
- package/esm/_/intersection.d.ts +13 -0
- package/esm/_/intersection.d.ts.map +1 -0
- package/esm/_/intersection.js +45 -0
- package/esm/_/intersectionBy.d.ts +32 -0
- package/esm/_/intersectionBy.d.ts.map +1 -0
- package/esm/_/intersectionBy.js +41 -0
- package/esm/_/intersectionWith.d.ts +28 -0
- package/esm/_/intersectionWith.d.ts.map +1 -0
- package/esm/_/intersectionWith.js +38 -0
- package/esm/_/invert.d.ts +14 -0
- package/esm/_/invert.d.ts.map +1 -0
- package/esm/_/invert.js +55 -0
- package/esm/_/isArguments.d.ts +9 -0
- package/esm/_/isArguments.d.ts.map +1 -0
- package/esm/_/isArguments.js +45 -0
- package/esm/_/isArray.d.ts +61 -0
- package/esm/_/isArray.d.ts.map +1 -0
- package/esm/_/isArray.js +62 -0
- package/esm/_/isArrayLike.d.ts +25 -0
- package/esm/_/isArrayLike.d.ts.map +1 -0
- package/esm/_/isArrayLike.js +35 -0
- package/esm/_/isEmpty.d.ts +49 -0
- package/esm/_/isEmpty.d.ts.map +1 -0
- package/esm/_/isEmpty.js +57 -0
- package/esm/_/isEqual.d.ts +15 -0
- package/esm/_/isEqual.d.ts.map +1 -0
- package/esm/_/isEqual.js +48 -0
- package/esm/_/isError.d.ts +11 -0
- package/esm/_/isError.d.ts.map +1 -0
- package/esm/_/isError.js +57 -0
- package/esm/_/isLength.d.ts +41 -0
- package/esm/_/isLength.d.ts.map +1 -0
- package/esm/_/isLength.js +43 -0
- package/esm/_/isObject.d.ts +40 -0
- package/esm/_/isObject.d.ts.map +1 -0
- package/esm/_/isObject.js +42 -0
- package/esm/_/isObjectLike.d.ts +40 -0
- package/esm/_/isObjectLike.d.ts.map +1 -0
- package/esm/_/isObjectLike.js +42 -0
- package/esm/_/isPlainObject.d.ts +10 -0
- package/esm/_/isPlainObject.d.ts.map +1 -0
- package/esm/_/isPlainObject.js +58 -0
- package/esm/_/isSymbol.d.ts +9 -0
- package/esm/_/isSymbol.d.ts.map +1 -0
- package/esm/_/isSymbol.js +45 -0
- package/esm/_/isTypedArray.d.ts +43 -0
- package/esm/_/isTypedArray.d.ts.map +1 -0
- package/esm/_/isTypedArray.js +45 -0
- package/esm/_/kebabCase.d.ts +9 -0
- package/esm/_/kebabCase.d.ts.map +1 -0
- package/esm/_/kebabCase.js +40 -0
- package/esm/_/keyBy.d.ts +17 -0
- package/esm/_/keyBy.d.ts.map +1 -0
- package/esm/_/keyBy.js +43 -0
- package/esm/_/keys.d.ts +11 -0
- package/esm/_/keys.d.ts.map +1 -0
- package/esm/_/keys.js +60 -0
- package/esm/_/keysIn.d.ts +10 -0
- package/esm/_/keysIn.d.ts.map +1 -0
- package/esm/_/keysIn.js +54 -0
- package/esm/_/mapValues.d.ts +63 -0
- package/esm/_/mapValues.d.ts.map +1 -0
- package/esm/_/mapValues.js +47 -0
- package/esm/_/max.d.ts +16 -0
- package/esm/_/max.d.ts.map +1 -0
- package/esm/_/max.js +37 -0
- package/esm/_/memoize.d.ts +89 -0
- package/esm/_/memoize.d.ts.map +1 -0
- package/esm/_/memoize.js +36 -0
- package/esm/_/merge.d.ts +32 -0
- package/esm/_/merge.d.ts.map +1 -0
- package/esm/_/merge.js +45 -0
- package/esm/_/mergeWith.d.ts +34 -0
- package/esm/_/mergeWith.d.ts.map +1 -0
- package/esm/_/mergeWith.js +50 -0
- package/esm/_/min.d.ts +16 -0
- package/esm/_/min.d.ts.map +1 -0
- package/esm/_/min.js +37 -0
- package/esm/_/negate.d.ts +41 -0
- package/esm/_/negate.d.ts.map +1 -0
- package/esm/_/negate.js +48 -0
- package/esm/_/omit.d.ts +27 -0
- package/esm/_/omit.d.ts.map +1 -0
- package/esm/_/omit.js +76 -0
- package/esm/_/omitBy.d.ts +21 -0
- package/esm/_/omitBy.d.ts.map +1 -0
- package/esm/_/omitBy.js +37 -0
- package/esm/_/partial.d.ts +87 -0
- package/esm/_/partial.d.ts.map +1 -0
- package/esm/_/partial.js +30 -0
- package/esm/_/partition.d.ts +23 -0
- package/esm/_/partition.d.ts.map +1 -0
- package/esm/_/partition.js +42 -0
- package/esm/_/pick.d.ts +18 -0
- package/esm/_/pick.d.ts.map +1 -0
- package/esm/_/pick.js +48 -0
- package/esm/_/pickBy.d.ts +21 -0
- package/esm/_/pickBy.d.ts.map +1 -0
- package/esm/_/pickBy.js +36 -0
- package/esm/_/range.d.ts +24 -0
- package/esm/_/range.d.ts.map +1 -0
- package/esm/_/range.js +56 -0
- package/esm/_/reduce.d.ts +37 -0
- package/esm/_/reduce.d.ts.map +1 -0
- package/esm/_/reduce.js +48 -0
- package/esm/_/set.d.ts +25 -0
- package/esm/_/set.d.ts.map +1 -0
- package/esm/_/set.js +35 -0
- package/esm/_/sortBy.d.ts +17 -0
- package/esm/_/sortBy.d.ts.map +1 -0
- package/esm/_/sortBy.js +46 -0
- package/esm/_/sumBy.d.ts +14 -0
- package/esm/_/sumBy.d.ts.map +1 -0
- package/esm/_/sumBy.js +47 -0
- package/esm/_/tail.d.ts +15 -0
- package/esm/_/tail.d.ts.map +1 -0
- package/esm/_/tail.js +36 -0
- package/esm/_/throttle.d.ts +76 -0
- package/esm/_/throttle.d.ts.map +1 -0
- package/esm/_/throttle.js +45 -0
- package/esm/_/times.d.ts +17 -0
- package/esm/_/times.d.ts.map +1 -0
- package/esm/_/times.js +57 -0
- package/esm/_/toFinite.d.ts +10 -0
- package/esm/_/toFinite.d.ts.map +1 -0
- package/esm/_/toFinite.js +50 -0
- package/esm/_/toInteger.d.ts +11 -0
- package/esm/_/toInteger.d.ts.map +1 -0
- package/esm/_/toInteger.js +46 -0
- package/esm/_/toNumber.d.ts +11 -0
- package/esm/_/toNumber.d.ts.map +1 -0
- package/esm/_/toNumber.js +69 -0
- package/esm/_/toString.d.ts +11 -0
- package/esm/_/toString.d.ts.map +1 -0
- package/esm/_/toString.js +57 -0
- package/esm/_/types.d.ts +181 -0
- package/esm/_/types.d.ts.map +1 -0
- package/esm/_/types.js +2 -0
- package/esm/_/unescape.d.ts +13 -0
- package/esm/_/unescape.d.ts.map +1 -0
- package/esm/_/unescape.js +56 -0
- package/esm/_/union.d.ts +11 -0
- package/esm/_/union.d.ts.map +1 -0
- package/esm/_/union.js +44 -0
- package/esm/_/unionBy.d.ts +34 -0
- package/esm/_/unionBy.d.ts.map +1 -0
- package/esm/_/unionBy.js +42 -0
- package/esm/_/uniq.d.ts +12 -0
- package/esm/_/uniq.d.ts.map +1 -0
- package/esm/_/uniq.js +47 -0
- package/esm/_/uniqBy.d.ts +13 -0
- package/esm/_/uniqBy.d.ts.map +1 -0
- package/esm/_/uniqBy.js +49 -0
- package/esm/_/uniqWith.d.ts +14 -0
- package/esm/_/uniqWith.d.ts.map +1 -0
- package/esm/_/uniqWith.js +59 -0
- package/esm/_/update.d.ts +17 -0
- package/esm/_/update.d.ts.map +1 -0
- package/esm/_/update.js +55 -0
- package/esm/_/updateWith.d.ts +23 -0
- package/esm/_/updateWith.d.ts.map +1 -0
- package/esm/_/updateWith.js +41 -0
- package/esm/_/upperFirst.d.ts +10 -0
- package/esm/_/upperFirst.d.ts.map +1 -0
- package/esm/_/upperFirst.js +46 -0
- package/esm/_/without.d.ts +15 -0
- package/esm/_/without.d.ts.map +1 -0
- package/esm/_/without.js +47 -0
- package/esm/_/words.d.ts +9 -0
- package/esm/_/words.d.ts.map +1 -0
- package/esm/_/words.js +50 -0
- package/esm/_/zip.d.ts +28 -0
- package/esm/_/zip.d.ts.map +1 -0
- package/esm/_/zip.js +38 -0
- package/esm/index.d.ts +69 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +69 -0
- package/esm/util.d.ts +1870 -67
- package/package.json +5 -4
package/esm/_/range.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an array of numbers (positive and/or negative) progressing from `start` up to, but not
|
|
3
|
+
* including, `end`. A step of `-1` is used if a negative `start` is specified without an `end` or
|
|
4
|
+
* `step`. If `end` is not specified, it's set to `start` with `start` then set to `0`.
|
|
5
|
+
*
|
|
6
|
+
* **Note:** JavaScript follows the IEEE-754 standard for resolving floating-point values which can
|
|
7
|
+
* produce unexpected results.
|
|
8
|
+
*
|
|
9
|
+
* @param start - The start of the range.
|
|
10
|
+
* @param end - The end of the range.
|
|
11
|
+
* @param step - The value to increment or decrement by.
|
|
12
|
+
* @returns Returns the range of numbers.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function _range(start: number, end?: number, step?: number): number[];
|
|
16
|
+
/**
|
|
17
|
+
* The iteratee form, so that `_range` can be passed straight to `map` and the like: the index and the
|
|
18
|
+
* collection are ignored and `end` alone defines the range.
|
|
19
|
+
*
|
|
20
|
+
* @see _range
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function _range(end: number, index: string | number, guard: object): number[];
|
|
24
|
+
//# sourceMappingURL=range.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../src/_/range.ts"],"names":[],"mappings":"AAoCA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;AAC7E;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC"}
|
package/esm/_/range.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _isIterateeCall } from "./_isIterateeCall.js";
|
|
33
|
+
import { _toFinite } from "./toFinite.js";
|
|
34
|
+
export function _range(start, end, step) {
|
|
35
|
+
if (step && typeof step !== "number" && _isIterateeCall(start, end, step)) {
|
|
36
|
+
end = step = undefined;
|
|
37
|
+
}
|
|
38
|
+
// `_toFinite` keeps the sign of `-0`
|
|
39
|
+
let from = _toFinite(start);
|
|
40
|
+
let to;
|
|
41
|
+
if (end === undefined) {
|
|
42
|
+
to = from;
|
|
43
|
+
from = 0;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
to = _toFinite(end);
|
|
47
|
+
}
|
|
48
|
+
const by = step === undefined ? (from < to ? 1 : -1) : _toFinite(step);
|
|
49
|
+
const length = Math.max(Math.ceil((to - from) / (by || 1)), 0);
|
|
50
|
+
const result = [];
|
|
51
|
+
for (let index = 0; index < length; index++) {
|
|
52
|
+
result.push(from);
|
|
53
|
+
from += by;
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { _List, _MemoListIterator, _MemoObjectIterator } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Reduces `collection` to a value which is the accumulated result of running each element in `collection`
|
|
4
|
+
* thru `iteratee`, where each successive invocation is supplied the return value of the previous. If
|
|
5
|
+
* `accumulator` is not given, the first element of `collection` is used as the initial value; whether it
|
|
6
|
+
* was given is decided by the argument count, as in lodash. The iteratee is invoked with four arguments:
|
|
7
|
+
* (accumulator, value, index|key, collection). Arrays and array-likes are iterated by index, strings by
|
|
8
|
+
* character, other objects by their own enumerable string keys.
|
|
9
|
+
*
|
|
10
|
+
* @param collection - The collection to iterate over.
|
|
11
|
+
* @param iteratee - The function invoked per iteration, or an iteratee shorthand.
|
|
12
|
+
* @param accumulator - The initial value.
|
|
13
|
+
* @returns Returns the accumulated value.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function _reduce<T, TResult>(collection: T[] | null | undefined, iteratee: _MemoListIterator<T, TResult, T[]>, accumulator: TResult): TResult;
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function _reduce<T, TResult>(collection: _List<T> | null | undefined, iteratee: _MemoListIterator<T, TResult, _List<T>>, accumulator: TResult): TResult;
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function _reduce<T extends object, TResult>(collection: T | null | undefined, iteratee: _MemoObjectIterator<T[keyof T], TResult, T>, accumulator: TResult): TResult;
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function _reduce<T>(collection: T[] | null | undefined, iteratee: _MemoListIterator<T, T, T[]>): T | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare function _reduce<T>(collection: _List<T> | null | undefined, iteratee: _MemoListIterator<T, T, _List<T>>): T | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export declare function _reduce<T extends object>(collection: T | null | undefined, iteratee: _MemoObjectIterator<T[keyof T], T[keyof T], T>): T[keyof T] | undefined;
|
|
37
|
+
//# sourceMappingURL=reduce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reduce.d.ts","sourceRoot":"","sources":["../../src/_/reduce.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,EAC9B,UAAU,EAAE,CAAC,EAAE,GAAG,IAAI,GAAG,SAAS,EAClC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAC5C,WAAW,EAAE,OAAO,GACrB,OAAO,CAAC;AACX;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,EAC9B,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EACvC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EACjD,WAAW,EAAE,OAAO,GACrB,OAAO,CAAC;AACX;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAC7C,UAAU,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAChC,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EACrD,WAAW,EAAE,OAAO,GACrB,OAAO,CAAC;AACX;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACrB,UAAU,EAAE,CAAC,EAAE,GAAG,IAAI,GAAG,SAAS,EAClC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GACvC,CAAC,GAAG,SAAS,CAAC;AACjB;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACrB,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EACvC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAC5C,CAAC,GAAG,SAAS,CAAC;AACjB;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EACpC,UAAU,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAChC,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACzD,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC"}
|
package/esm/_/reduce.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _baseEach } from "./_baseEach.js";
|
|
33
|
+
import { _baseIteratee } from "./_baseIteratee.js";
|
|
34
|
+
export function _reduce(collection, iteratee, ...accumulator) {
|
|
35
|
+
const callback = _baseIteratee(iteratee);
|
|
36
|
+
let initial = accumulator.length === 0;
|
|
37
|
+
let result = accumulator[0];
|
|
38
|
+
_baseEach(collection, (value, key, iterable) => {
|
|
39
|
+
if (initial) {
|
|
40
|
+
initial = false;
|
|
41
|
+
result = value;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
result = callback(result, value, key, iterable);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
}
|
package/esm/_/set.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { _Many, _PropertyName } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export type _PropertyPath = _Many<_PropertyName>;
|
|
6
|
+
/**
|
|
7
|
+
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist, it's created. Arrays are
|
|
8
|
+
* created for missing index properties while objects are created for all other missing properties.
|
|
9
|
+
* The segments `__proto__`, `constructor` and `prototype` are refused, which prevents prototype pollution.
|
|
10
|
+
*
|
|
11
|
+
* **Note:** This method mutates `object`.
|
|
12
|
+
*
|
|
13
|
+
* @param object - The object to modify.
|
|
14
|
+
* @param path - The path of the property to set.
|
|
15
|
+
* @param value - The value to set.
|
|
16
|
+
* @returns Returns `object`.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function _set<T extends object>(object: T, path: _PropertyPath, value: unknown): T;
|
|
20
|
+
/**
|
|
21
|
+
* @see _set
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export declare function _set<TResult>(object: object, path: _PropertyPath, value: unknown): TResult;
|
|
25
|
+
//# sourceMappingURL=set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/_/set.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC;AAC1F;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC"}
|
package/esm/_/set.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _baseSet } from "./_baseSet.js";
|
|
33
|
+
export function _set(object, path, value) {
|
|
34
|
+
return object == null ? object : _baseSet(object, path, value);
|
|
35
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { _List, _ListIteratee, _Many, _ObjectIteratee } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates an array of elements, sorted in ascending order by the results of running each element in a
|
|
4
|
+
* collection through each iteratee. This method performs a stable sort, that is, it preserves the original
|
|
5
|
+
* sort order of equal elements. The iteratees are invoked with one argument: (value).
|
|
6
|
+
*
|
|
7
|
+
* @param collection - The collection to iterate over.
|
|
8
|
+
* @param iteratees - The iteratees to sort by, specified individually or in arrays.
|
|
9
|
+
* @returns Returns the new sorted array.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function _sortBy<T>(collection: _List<T> | null | undefined, ...iteratees: _Many<_ListIteratee<T>>[]): T[];
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function _sortBy<T extends object>(collection: T | null | undefined, ...iteratees: _Many<_ObjectIteratee<T>>[]): T[keyof T][];
|
|
17
|
+
//# sourceMappingURL=sortBy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortBy.d.ts","sourceRoot":"","sources":["../../src/_/sortBy.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE/E;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,CAAC,EACrB,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EACvC,GAAG,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,GACxC,CAAC,EAAE,CAAC;AACP;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EACpC,UAAU,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAChC,GAAG,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,GAC1C,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC"}
|
package/esm/_/sortBy.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _baseOrderBy } from "./_baseOrderBy.js";
|
|
33
|
+
import { _isIterateeCall } from "./_isIterateeCall.js";
|
|
34
|
+
export function _sortBy(collection, ...iteratees) {
|
|
35
|
+
if (collection == null) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
// called as an iteratee, e.g. by `map`, the trailing index and collection are not iteratees
|
|
39
|
+
if (iteratees.length > 1 && _isIterateeCall(collection, iteratees[0], iteratees[1])) {
|
|
40
|
+
iteratees = [];
|
|
41
|
+
}
|
|
42
|
+
else if (iteratees.length > 2 && _isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
|
|
43
|
+
iteratees = [iteratees[0]];
|
|
44
|
+
}
|
|
45
|
+
return _baseOrderBy(collection, iteratees.flat());
|
|
46
|
+
}
|
package/esm/_/sumBy.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { _List } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* This method is like `_sum` except that it accepts `iteratee` which is invoked for each element in `array`
|
|
4
|
+
* to generate the value to be summed. The iteratee is invoked with one argument: (value). Values are added
|
|
5
|
+
* with the `+` operator, `undefined` results are skipped, and, as in lodash, an empty or nullish array
|
|
6
|
+
* yields `0` while an array without any defined result yields `undefined`.
|
|
7
|
+
*
|
|
8
|
+
* @param array - The array to iterate over.
|
|
9
|
+
* @param iteratee - The iteratee invoked per element, or a property shorthand.
|
|
10
|
+
* @returns Returns the sum.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function _sumBy<T>(array: _List<T> | null | undefined, iteratee?: ((value: T) => number) | string): number;
|
|
14
|
+
//# sourceMappingURL=sumBy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sumBy.d.ts","sourceRoot":"","sources":["../../src/_/sumBy.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,CAAC,EACpB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAClC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC,GAAG,MAAM,GAC3C,MAAM,CAER"}
|
package/esm/_/sumBy.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _baseIteratee } from "./_baseIteratee.js";
|
|
33
|
+
import { _baseSum } from "./_baseSum.js";
|
|
34
|
+
/**
|
|
35
|
+
* This method is like `_sum` except that it accepts `iteratee` which is invoked for each element in `array`
|
|
36
|
+
* to generate the value to be summed. The iteratee is invoked with one argument: (value). Values are added
|
|
37
|
+
* with the `+` operator, `undefined` results are skipped, and, as in lodash, an empty or nullish array
|
|
38
|
+
* yields `0` while an array without any defined result yields `undefined`.
|
|
39
|
+
*
|
|
40
|
+
* @param array - The array to iterate over.
|
|
41
|
+
* @param iteratee - The iteratee invoked per element, or a property shorthand.
|
|
42
|
+
* @returns Returns the sum.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export function _sumBy(array, iteratee) {
|
|
46
|
+
return array?.length ? _baseSum(array, _baseIteratee(iteratee)) : 0;
|
|
47
|
+
}
|
package/esm/_/tail.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { _List } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Gets all but the first element of `array` as a new dense array. Nullish input and anything without a
|
|
4
|
+
* truthy `length` yield an empty array.
|
|
5
|
+
*
|
|
6
|
+
* @param array - The array to query.
|
|
7
|
+
* @returns Returns the slice of `array`.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function _tail<T extends unknown[]>(array: readonly [unknown, ...T]): T;
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function _tail<T>(array?: _List<T> | null): T[];
|
|
15
|
+
//# sourceMappingURL=tail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tail.d.ts","sourceRoot":"","sources":["../../src/_/tail.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AAC/E;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC"}
|
package/esm/_/tail.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _baseSlice } from "./_baseSlice.js";
|
|
33
|
+
export function _tail(array) {
|
|
34
|
+
const length = array == null ? 0 : array.length;
|
|
35
|
+
return length ? _baseSlice(array, 1, length) : [];
|
|
36
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Portions of this file are derived from Lodash.
|
|
3
|
+
* https://github.com/lodash/lodash
|
|
4
|
+
*
|
|
5
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
6
|
+
*
|
|
7
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
8
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
9
|
+
*
|
|
10
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
13
|
+
* a copy of this software and associated documentation files (the
|
|
14
|
+
* "Software"), to deal in the Software without restriction, including
|
|
15
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
16
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
17
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
18
|
+
* the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be
|
|
21
|
+
* included in all copies or substantial portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
24
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
25
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
26
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
27
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
28
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
29
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
30
|
+
*/
|
|
31
|
+
import { type _DebouncedFunc, type _DebouncedFuncLeading } from "./debounce.js";
|
|
32
|
+
/**
|
|
33
|
+
* Options of `_throttle`.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export type _ThrottleSettings = {
|
|
38
|
+
/** Invoke on the leading edge of the timeout. Defaults to `true`. */
|
|
39
|
+
leading?: boolean | undefined;
|
|
40
|
+
/** Invoke on the trailing edge of the timeout. Defaults to `true`. */
|
|
41
|
+
trailing?: boolean | undefined;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* {@link _ThrottleSettings} that keep `leading` switched on, which guarantees a result on every call.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export type _ThrottleSettingsLeading = (_ThrottleSettings & {
|
|
49
|
+
leading: true;
|
|
50
|
+
}) | Omit<_ThrottleSettings, "leading">;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a throttled function that only invokes `func` at most once per every `wait` milliseconds. The
|
|
53
|
+
* throttled function comes with a `cancel` method to cancel delayed `func` invocations and a `flush` method
|
|
54
|
+
* to immediately invoke them. Provide `options` to indicate whether `func` should be invoked on the leading
|
|
55
|
+
* and/or trailing edge of the `wait` timeout. The `func` is invoked with the last arguments provided to the
|
|
56
|
+
* throttled function. Subsequent calls to the throttled function return the result of the last `func`
|
|
57
|
+
* invocation.
|
|
58
|
+
*
|
|
59
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked on the trailing edge of the
|
|
60
|
+
* timeout only if the throttled function is invoked more than once during the `wait` timeout.
|
|
61
|
+
*
|
|
62
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred until the next tick, similar to
|
|
63
|
+
* `setTimeout` with a timeout of `0`.
|
|
64
|
+
*
|
|
65
|
+
* @param func - The function to throttle.
|
|
66
|
+
* @param wait - The number of milliseconds to throttle invocations to. Defaults to `0`.
|
|
67
|
+
* @param options - The options object.
|
|
68
|
+
* @returns Returns the new throttled function.
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export declare function _throttle<T extends (...args: any) => any>(func: T, wait?: number, options?: _ThrottleSettingsLeading): _DebouncedFuncLeading<T>;
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export declare function _throttle<T extends (...args: any) => any>(func: T, wait?: number, options?: _ThrottleSettings): _DebouncedFunc<T>;
|
|
76
|
+
//# sourceMappingURL=throttle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../src/_/throttle.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAa,MAAM,eAAe,CAAC;AAG3F;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAC9B,CAAC,iBAAiB,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC,GACvC,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,wBAAgB,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EACrD,IAAI,EAAE,CAAC,EACP,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,wBAAwB,GACnC,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAC5B;;GAEG;AAEH,wBAAgB,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,EACrD,IAAI,EAAE,CAAC,EACP,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,iBAAiB,GAC5B,cAAc,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _debounce } from "./debounce.js";
|
|
33
|
+
import { _isObject } from "./isObject.js";
|
|
34
|
+
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
export function _throttle(func, wait, options) {
|
|
36
|
+
if (typeof func !== "function") {
|
|
37
|
+
throw new TypeError("Expected a function");
|
|
38
|
+
}
|
|
39
|
+
const settings = _isObject(options) ? options : {};
|
|
40
|
+
const leading = "leading" in settings ? !!settings.leading : true;
|
|
41
|
+
const trailing = "trailing" in settings ? !!settings.trailing : true;
|
|
42
|
+
// a throttle is a debounce whose maximum wait equals the wait, so the function is invoked at least once per
|
|
43
|
+
// window while calls keep coming
|
|
44
|
+
return _debounce(func, wait, { leading, maxWait: wait, trailing });
|
|
45
|
+
}
|
package/esm/_/times.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invokes the iteratee `n` times, returning an array of the results of each invocation. The iteratee is
|
|
3
|
+
* invoked with one argument, the index, and anything but a function is replaced by the identity, so the
|
|
4
|
+
* indices are returned. The count is coerced to an integer the way lodash does it; a count below 1 or above
|
|
5
|
+
* the safe integer range yields an empty array.
|
|
6
|
+
*
|
|
7
|
+
* @param n - The number of times to invoke `iteratee`.
|
|
8
|
+
* @param iteratee - The function invoked per iteration.
|
|
9
|
+
* @returns Returns the array of results.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function _times<TResult>(n: number, iteratee: (index: number) => TResult): TResult[];
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function _times(n: number): number[];
|
|
17
|
+
//# sourceMappingURL=times.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"times.d.ts","sourceRoot":"","sources":["../../src/_/times.ts"],"names":[],"mappings":"AAsCA;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,EAAE,CAAC;AAC5F;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC"}
|
package/esm/_/times.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/*!
|
|
3
|
+
* Portions of this file are derived from Lodash.
|
|
4
|
+
* https://github.com/lodash/lodash
|
|
5
|
+
*
|
|
6
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
7
|
+
*
|
|
8
|
+
* Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
9
|
+
* DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
10
|
+
*
|
|
11
|
+
* Modifications Copyright (c) 2026 GoodData Corporation
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the
|
|
15
|
+
* "Software"), to deal in the Software without restriction, including
|
|
16
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
17
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
18
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
19
|
+
* the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be
|
|
22
|
+
* included in all copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
26
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
27
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
28
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
29
|
+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
30
|
+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
import { _toInteger } from "./toInteger.js";
|
|
33
|
+
/** Used as the maximum length of an array. */
|
|
34
|
+
const MAX_ARRAY_LENGTH = 4294967295;
|
|
35
|
+
export function _times(n, iteratee) {
|
|
36
|
+
const count = _toInteger(n);
|
|
37
|
+
if (count < 1 || count > Number.MAX_SAFE_INTEGER) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
const invoke = typeof iteratee === "function" ? iteratee : identity;
|
|
41
|
+
const length = Math.min(count, MAX_ARRAY_LENGTH);
|
|
42
|
+
const result = Array(length);
|
|
43
|
+
for (let index = 0; index < length; index++) {
|
|
44
|
+
result[index] = invoke(index);
|
|
45
|
+
}
|
|
46
|
+
// beyond the maximum array length lodash keeps invoking the iteratee without storing the results, with
|
|
47
|
+
// exactly this arithmetic
|
|
48
|
+
let index = MAX_ARRAY_LENGTH;
|
|
49
|
+
const remaining = count - MAX_ARRAY_LENGTH;
|
|
50
|
+
while (++index < remaining) {
|
|
51
|
+
invoke(index);
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
function identity(index) {
|
|
56
|
+
return index;
|
|
57
|
+
}
|