@depup/remeda 2.33.7-depup.0 → 2.40.0-depup.0
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/README.md +2 -2
- package/changes.json +1 -1
- package/dist/add.cjs +1 -1
- package/dist/add.cjs.map +1 -1
- package/dist/add.js.map +1 -1
- package/dist/addProp.cjs +1 -1
- package/dist/addProp.cjs.map +1 -1
- package/dist/addProp.js.map +1 -1
- package/dist/allPass.cjs +1 -1
- package/dist/allPass.cjs.map +1 -1
- package/dist/allPass.js.map +1 -1
- package/dist/anyPass.cjs +1 -1
- package/dist/anyPass.cjs.map +1 -1
- package/dist/anyPass.js.map +1 -1
- package/dist/{binarySearchCutoffIndex-CalebGhL.js → binarySearchCutoffIndex-CRPy-dOJ.js} +1 -1
- package/dist/{binarySearchCutoffIndex-CalebGhL.js.map → binarySearchCutoffIndex-CRPy-dOJ.js.map} +1 -1
- package/dist/binarySearchCutoffIndex-CdUUMUB1.cjs +2 -0
- package/dist/{binarySearchCutoffIndex-TBknSzI9.cjs.map → binarySearchCutoffIndex-CdUUMUB1.cjs.map} +1 -1
- package/dist/capitalize.cjs +1 -1
- package/dist/capitalize.cjs.map +1 -1
- package/dist/capitalize.js.map +1 -1
- package/dist/ceil.cjs +1 -1
- package/dist/ceil.cjs.map +1 -1
- package/dist/ceil.js +1 -1
- package/dist/ceil.js.map +1 -1
- package/dist/chunk.cjs +1 -1
- package/dist/chunk.cjs.map +1 -1
- package/dist/chunk.js.map +1 -1
- package/dist/clamp.cjs +1 -1
- package/dist/clamp.cjs.map +1 -1
- package/dist/clamp.js.map +1 -1
- package/dist/clone.cjs +1 -1
- package/dist/clone.cjs.map +1 -1
- package/dist/clone.js +1 -1
- package/dist/clone.js.map +1 -1
- package/dist/concat.cjs +1 -1
- package/dist/concat.cjs.map +1 -1
- package/dist/concat.js.map +1 -1
- package/dist/conditional.cjs +2 -1
- package/dist/conditional.cjs.map +1 -0
- package/dist/conditional.js +2 -1
- package/dist/conditional.js.map +1 -0
- package/dist/constant.cjs.map +1 -1
- package/dist/constant.js.map +1 -1
- package/dist/countBy.cjs +1 -1
- package/dist/countBy.cjs.map +1 -1
- package/dist/countBy.js.map +1 -1
- package/dist/debounce.cjs.map +1 -1
- package/dist/debounce.js.map +1 -1
- package/dist/defaultTo.cjs +1 -1
- package/dist/defaultTo.cjs.map +1 -1
- package/dist/defaultTo.js.map +1 -1
- package/dist/difference.cjs +1 -1
- package/dist/difference.cjs.map +1 -1
- package/dist/difference.js +1 -1
- package/dist/difference.js.map +1 -1
- package/dist/differenceWith.cjs +1 -1
- package/dist/differenceWith.cjs.map +1 -1
- package/dist/differenceWith.js +1 -1
- package/dist/differenceWith.js.map +1 -1
- package/dist/divide.cjs +1 -1
- package/dist/divide.cjs.map +1 -1
- package/dist/divide.js.map +1 -1
- package/dist/doNothing.cjs.map +1 -1
- package/dist/doNothing.js.map +1 -1
- package/dist/drop.cjs +1 -1
- package/dist/drop.cjs.map +1 -1
- package/dist/drop.js +1 -1
- package/dist/drop.js.map +1 -1
- package/dist/dropFirstBy.cjs +1 -1
- package/dist/dropFirstBy.cjs.map +1 -1
- package/dist/dropFirstBy.js +1 -1
- package/dist/dropFirstBy.js.map +1 -1
- package/dist/dropLast.cjs +1 -1
- package/dist/dropLast.cjs.map +1 -1
- package/dist/dropLast.js.map +1 -1
- package/dist/dropLastWhile.cjs +1 -1
- package/dist/dropLastWhile.cjs.map +1 -1
- package/dist/dropLastWhile.js.map +1 -1
- package/dist/dropWhile.cjs +1 -1
- package/dist/dropWhile.cjs.map +1 -1
- package/dist/dropWhile.js.map +1 -1
- package/dist/endsWith.cjs +1 -1
- package/dist/endsWith.cjs.map +1 -1
- package/dist/endsWith.js.map +1 -1
- package/dist/entries.cjs +1 -1
- package/dist/entries.cjs.map +1 -1
- package/dist/entries.js.map +1 -1
- package/dist/evolve.cjs +1 -1
- package/dist/evolve.cjs.map +1 -1
- package/dist/evolve.js +1 -1
- package/dist/evolve.js.map +1 -1
- package/dist/filter.cjs +1 -1
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.js +1 -1
- package/dist/filter.js.map +1 -1
- package/dist/find.cjs +1 -1
- package/dist/find.cjs.map +1 -1
- package/dist/find.js +1 -1
- package/dist/find.js.map +1 -1
- package/dist/findIndex.cjs +1 -1
- package/dist/findIndex.cjs.map +1 -1
- package/dist/findIndex.js.map +1 -1
- package/dist/findLast.cjs +1 -1
- package/dist/findLast.cjs.map +1 -1
- package/dist/findLast.js.map +1 -1
- package/dist/findLastIndex.cjs +1 -1
- package/dist/findLastIndex.cjs.map +1 -1
- package/dist/findLastIndex.js.map +1 -1
- package/dist/first.cjs +1 -1
- package/dist/first.cjs.map +1 -1
- package/dist/first.js +1 -1
- package/dist/first.js.map +1 -1
- package/dist/firstBy.cjs +1 -1
- package/dist/firstBy.cjs.map +1 -1
- package/dist/firstBy.js +1 -1
- package/dist/firstBy.js.map +1 -1
- package/dist/flat.cjs +1 -1
- package/dist/flat.cjs.map +1 -1
- package/dist/flat.js +1 -1
- package/dist/flat.js.map +1 -1
- package/dist/flatMap.cjs +1 -1
- package/dist/flatMap.cjs.map +1 -1
- package/dist/flatMap.js.map +1 -1
- package/dist/floor.cjs +1 -1
- package/dist/floor.cjs.map +1 -1
- package/dist/floor.js +1 -1
- package/dist/floor.js.map +1 -1
- package/dist/forEach.cjs +1 -1
- package/dist/forEach.cjs.map +1 -1
- package/dist/forEach.js.map +1 -1
- package/dist/forEachObj.cjs +1 -1
- package/dist/forEachObj.cjs.map +1 -1
- package/dist/forEachObj.js.map +1 -1
- package/dist/fromEntries.cjs +1 -1
- package/dist/fromEntries.cjs.map +1 -1
- package/dist/fromEntries.js.map +1 -1
- package/dist/fromKeys.cjs +1 -1
- package/dist/fromKeys.cjs.map +1 -1
- package/dist/fromKeys.js.map +1 -1
- package/dist/funnel.cjs.map +1 -1
- package/dist/funnel.js.map +1 -1
- package/dist/groupBy.cjs +1 -1
- package/dist/groupBy.cjs.map +1 -1
- package/dist/groupBy.js.map +1 -1
- package/dist/groupByProp.cjs +1 -1
- package/dist/groupByProp.cjs.map +1 -1
- package/dist/groupByProp.js.map +1 -1
- package/dist/hasAtLeast.cjs +1 -1
- package/dist/hasAtLeast.cjs.map +1 -1
- package/dist/hasAtLeast.js.map +1 -1
- package/dist/hasProp.cjs +2 -0
- package/dist/hasProp.cjs.map +1 -0
- package/dist/hasProp.js +2 -0
- package/dist/hasProp.js.map +1 -0
- package/dist/hasSubObject.cjs +1 -1
- package/dist/hasSubObject.cjs.map +1 -1
- package/dist/hasSubObject.js.map +1 -1
- package/dist/{heap-C8XIujMa.js → heap-DX5LMcnX.js} +2 -2
- package/dist/{heap-C8XIujMa.js.map → heap-DX5LMcnX.js.map} +1 -1
- package/dist/heap-wTC6d937.cjs +2 -0
- package/dist/{heap-Ct9W7Bbi.cjs.map → heap-wTC6d937.cjs.map} +1 -1
- package/dist/identity.cjs.map +1 -1
- package/dist/identity.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1288 -785
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1288 -785
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/indexBy.cjs +1 -1
- package/dist/indexBy.cjs.map +1 -1
- package/dist/indexBy.js.map +1 -1
- package/dist/intersection.cjs +1 -1
- package/dist/intersection.cjs.map +1 -1
- package/dist/intersection.js +1 -1
- package/dist/intersection.js.map +1 -1
- package/dist/intersectionWith.cjs +1 -1
- package/dist/intersectionWith.cjs.map +1 -1
- package/dist/intersectionWith.js +1 -1
- package/dist/intersectionWith.js.map +1 -1
- package/dist/invert.cjs +1 -1
- package/dist/invert.cjs.map +1 -1
- package/dist/invert.js.map +1 -1
- package/dist/isArray.cjs.map +1 -1
- package/dist/isArray.js.map +1 -1
- package/dist/isBigInt.cjs.map +1 -1
- package/dist/isBigInt.js.map +1 -1
- package/dist/isBoolean.cjs.map +1 -1
- package/dist/isBoolean.js.map +1 -1
- package/dist/isDate.cjs.map +1 -1
- package/dist/isDate.js.map +1 -1
- package/dist/isDeepEqual.cjs +1 -1
- package/dist/isDeepEqual.cjs.map +1 -1
- package/dist/isDeepEqual.js +1 -1
- package/dist/isDeepEqual.js.map +1 -1
- package/dist/isDefined.cjs.map +1 -1
- package/dist/isDefined.js.map +1 -1
- package/dist/isEmpty.cjs.map +1 -1
- package/dist/isEmpty.js.map +1 -1
- package/dist/isEmptyish.cjs +1 -1
- package/dist/isEmptyish.cjs.map +1 -1
- package/dist/isEmptyish.js +1 -1
- package/dist/isEmptyish.js.map +1 -1
- package/dist/isError.cjs.map +1 -1
- package/dist/isError.js.map +1 -1
- package/dist/isIncludedIn.cjs.map +1 -1
- package/dist/isIncludedIn.js.map +1 -1
- package/dist/isNonNull.cjs.map +1 -1
- package/dist/isNonNull.js.map +1 -1
- package/dist/isNonNullish.cjs.map +1 -1
- package/dist/isNonNullish.js.map +1 -1
- package/dist/isNot.cjs.map +1 -1
- package/dist/isNot.js.map +1 -1
- package/dist/isNullish.cjs.map +1 -1
- package/dist/isNullish.js.map +1 -1
- package/dist/isNumber.cjs.map +1 -1
- package/dist/isNumber.js.map +1 -1
- package/dist/isObjectType.cjs.map +1 -1
- package/dist/isObjectType.js.map +1 -1
- package/dist/isPlainObject.cjs.map +1 -1
- package/dist/isPlainObject.js.map +1 -1
- package/dist/isPromise.cjs.map +1 -1
- package/dist/isPromise.js.map +1 -1
- package/dist/isShallowEqual.cjs +1 -1
- package/dist/isShallowEqual.cjs.map +1 -1
- package/dist/isShallowEqual.js +1 -1
- package/dist/isShallowEqual.js.map +1 -1
- package/dist/isStrictEqual.cjs +1 -1
- package/dist/isStrictEqual.cjs.map +1 -1
- package/dist/isStrictEqual.js.map +1 -1
- package/dist/isString.cjs.map +1 -1
- package/dist/isString.js.map +1 -1
- package/dist/isSymbol.cjs.map +1 -1
- package/dist/isSymbol.js.map +1 -1
- package/dist/isTruthy.cjs.map +1 -1
- package/dist/isTruthy.js.map +1 -1
- package/dist/join.cjs +1 -1
- package/dist/join.cjs.map +1 -1
- package/dist/join.js.map +1 -1
- package/dist/keys.cjs +1 -1
- package/dist/keys.cjs.map +1 -1
- package/dist/keys.js.map +1 -1
- package/dist/last.cjs +1 -1
- package/dist/last.cjs.map +1 -1
- package/dist/last.js.map +1 -1
- package/dist/{lazyDataLastImpl-DtF3cihj.js → lazyDataLastImpl--3B10z3s.js} +1 -1
- package/dist/{lazyDataLastImpl-DtF3cihj.js.map → lazyDataLastImpl--3B10z3s.js.map} +1 -1
- package/dist/lazyDataLastImpl-Dd5zjCfU.cjs +2 -0
- package/dist/{lazyDataLastImpl-DdpJofHC.cjs.map → lazyDataLastImpl-Dd5zjCfU.cjs.map} +1 -1
- package/dist/length.cjs +1 -1
- package/dist/length.cjs.map +1 -1
- package/dist/length.js.map +1 -1
- package/dist/map.cjs +1 -1
- package/dist/map.cjs.map +1 -1
- package/dist/map.js.map +1 -1
- package/dist/mapKeys.cjs +1 -1
- package/dist/mapKeys.cjs.map +1 -1
- package/dist/mapKeys.js.map +1 -1
- package/dist/mapToObj.cjs +1 -1
- package/dist/mapToObj.cjs.map +1 -1
- package/dist/mapToObj.js.map +1 -1
- package/dist/mapValues.cjs +1 -1
- package/dist/mapValues.cjs.map +1 -1
- package/dist/mapValues.js.map +1 -1
- package/dist/mapWithFeedback.cjs +1 -1
- package/dist/mapWithFeedback.cjs.map +1 -1
- package/dist/mapWithFeedback.js +1 -1
- package/dist/mapWithFeedback.js.map +1 -1
- package/dist/mean.cjs +1 -1
- package/dist/mean.cjs.map +1 -1
- package/dist/mean.js.map +1 -1
- package/dist/meanBy.cjs +1 -1
- package/dist/meanBy.cjs.map +1 -1
- package/dist/meanBy.js.map +1 -1
- package/dist/median.cjs +1 -1
- package/dist/median.cjs.map +1 -1
- package/dist/median.js.map +1 -1
- package/dist/merge.cjs +1 -1
- package/dist/merge.cjs.map +1 -1
- package/dist/merge.js.map +1 -1
- package/dist/mergeAll.cjs.map +1 -1
- package/dist/mergeAll.js.map +1 -1
- package/dist/mergeDeep.cjs +1 -1
- package/dist/mergeDeep.cjs.map +1 -1
- package/dist/mergeDeep.js +1 -1
- package/dist/mergeDeep.js.map +1 -1
- package/dist/multiply.cjs +1 -1
- package/dist/multiply.cjs.map +1 -1
- package/dist/multiply.js.map +1 -1
- package/dist/{nthBy-BFUrUEqW.cjs → nthBy-BSOwzu3L.cjs} +2 -2
- package/dist/nthBy-BSOwzu3L.cjs.map +1 -0
- package/dist/{nthBy-DCn3SK1l.js → nthBy-brkIHaPi.js} +2 -2
- package/dist/nthBy-brkIHaPi.js.map +1 -0
- package/dist/nthBy.cjs +1 -1
- package/dist/nthBy.js +1 -1
- package/dist/objOf.cjs +1 -1
- package/dist/objOf.cjs.map +1 -1
- package/dist/objOf.js.map +1 -1
- package/dist/omit.cjs +1 -1
- package/dist/omit.cjs.map +1 -1
- package/dist/omit.js.map +1 -1
- package/dist/omitBy.cjs +1 -1
- package/dist/omitBy.cjs.map +1 -1
- package/dist/omitBy.js.map +1 -1
- package/dist/once.cjs.map +1 -1
- package/dist/once.js.map +1 -1
- package/dist/only.cjs +1 -1
- package/dist/only.cjs.map +1 -1
- package/dist/only.js.map +1 -1
- package/dist/partialBind.cjs.map +1 -1
- package/dist/partialBind.js.map +1 -1
- package/dist/partialLastBind.cjs.map +1 -1
- package/dist/partialLastBind.js.map +1 -1
- package/dist/partition.cjs +1 -1
- package/dist/partition.cjs.map +1 -1
- package/dist/partition.js.map +1 -1
- package/dist/pathOr.cjs +1 -1
- package/dist/pathOr.cjs.map +1 -1
- package/dist/pathOr.js.map +1 -1
- package/dist/pick.cjs +1 -1
- package/dist/pick.cjs.map +1 -1
- package/dist/pick.js.map +1 -1
- package/dist/pickBy.cjs +1 -1
- package/dist/pickBy.cjs.map +1 -1
- package/dist/pickBy.js.map +1 -1
- package/dist/pipe.cjs +1 -1
- package/dist/pipe.cjs.map +1 -1
- package/dist/pipe.js +1 -1
- package/dist/pipe.js.map +1 -1
- package/dist/piped.cjs +1 -1
- package/dist/piped.cjs.map +1 -1
- package/dist/piped.js.map +1 -1
- package/dist/product.cjs +1 -1
- package/dist/product.cjs.map +1 -1
- package/dist/product.js.map +1 -1
- package/dist/prop.cjs.map +1 -1
- package/dist/prop.js.map +1 -1
- package/dist/pullObject.cjs +1 -1
- package/dist/pullObject.cjs.map +1 -1
- package/dist/pullObject.js.map +1 -1
- package/dist/purry.cjs +1 -1
- package/dist/purry.cjs.map +1 -1
- package/dist/purry.js +1 -1
- package/dist/purry.js.map +1 -1
- package/dist/{purryFromLazy-DELFL6Wm.js → purryFromLazy-BoPMn2L_.js} +1 -1
- package/dist/{purryFromLazy-DELFL6Wm.js.map → purryFromLazy-BoPMn2L_.js.map} +1 -1
- package/dist/{purryFromLazy-oahp5Ef4.cjs → purryFromLazy-mdjeRP1g.cjs} +2 -2
- package/dist/{purryFromLazy-oahp5Ef4.cjs.map → purryFromLazy-mdjeRP1g.cjs.map} +1 -1
- package/dist/purryOn-Et2NUOHd.js +2 -0
- package/dist/purryOn-Et2NUOHd.js.map +1 -0
- package/dist/purryOn-wBH_q-mO.cjs +2 -0
- package/dist/purryOn-wBH_q-mO.cjs.map +1 -0
- package/dist/purryOrderRules-9xJONRCt.cjs +2 -0
- package/dist/{purryOrderRules-cW1I4C_j.cjs.map → purryOrderRules-9xJONRCt.cjs.map} +1 -1
- package/dist/purryOrderRules-ufWoj2V5.js +2 -0
- package/dist/{purryOrderRules-BaB5mcHH.js.map → purryOrderRules-ufWoj2V5.js.map} +1 -1
- package/dist/randomBigInt.cjs.map +1 -1
- package/dist/randomBigInt.js.map +1 -1
- package/dist/randomInteger.cjs.map +1 -1
- package/dist/randomInteger.js.map +1 -1
- package/dist/randomString.cjs +1 -1
- package/dist/randomString.cjs.map +1 -1
- package/dist/randomString.js.map +1 -1
- package/dist/range.cjs +1 -1
- package/dist/range.cjs.map +1 -1
- package/dist/range.js.map +1 -1
- package/dist/rankBy.cjs +1 -1
- package/dist/rankBy.cjs.map +1 -1
- package/dist/rankBy.js +1 -1
- package/dist/rankBy.js.map +1 -1
- package/dist/reduce.cjs +1 -1
- package/dist/reduce.cjs.map +1 -1
- package/dist/reduce.js.map +1 -1
- package/dist/reverse.cjs +1 -1
- package/dist/reverse.cjs.map +1 -1
- package/dist/reverse.js.map +1 -1
- package/dist/round.cjs +1 -1
- package/dist/round.cjs.map +1 -1
- package/dist/round.js +1 -1
- package/dist/round.js.map +1 -1
- package/dist/sample.cjs +1 -1
- package/dist/sample.cjs.map +1 -1
- package/dist/sample.js.map +1 -1
- package/dist/set.cjs +1 -1
- package/dist/set.cjs.map +1 -1
- package/dist/set.js.map +1 -1
- package/dist/setPath.cjs +1 -1
- package/dist/setPath.cjs.map +1 -1
- package/dist/setPath.js.map +1 -1
- package/dist/shuffle.cjs +1 -1
- package/dist/shuffle.cjs.map +1 -1
- package/dist/shuffle.js.map +1 -1
- package/dist/sliceString.cjs.map +1 -1
- package/dist/sliceString.js.map +1 -1
- package/dist/sort.cjs +1 -1
- package/dist/sort.cjs.map +1 -1
- package/dist/sort.js.map +1 -1
- package/dist/sortBy.cjs +1 -1
- package/dist/sortBy.cjs.map +1 -1
- package/dist/sortBy.js +1 -1
- package/dist/sortBy.js.map +1 -1
- package/dist/sortedIndex.cjs +1 -1
- package/dist/sortedIndex.cjs.map +1 -1
- package/dist/sortedIndex.js +1 -1
- package/dist/sortedIndex.js.map +1 -1
- package/dist/sortedIndexBy.cjs +1 -1
- package/dist/sortedIndexBy.cjs.map +1 -1
- package/dist/sortedIndexBy.js +1 -1
- package/dist/sortedIndexBy.js.map +1 -1
- package/dist/sortedIndexWith.cjs +1 -1
- package/dist/sortedIndexWith.cjs.map +1 -1
- package/dist/sortedIndexWith.js +1 -1
- package/dist/sortedIndexWith.js.map +1 -1
- package/dist/sortedLastIndex.cjs +1 -1
- package/dist/sortedLastIndex.cjs.map +1 -1
- package/dist/sortedLastIndex.js +1 -1
- package/dist/sortedLastIndex.js.map +1 -1
- package/dist/sortedLastIndexBy.cjs +1 -1
- package/dist/sortedLastIndexBy.cjs.map +1 -1
- package/dist/sortedLastIndexBy.js +1 -1
- package/dist/sortedLastIndexBy.js.map +1 -1
- package/dist/splice.cjs +1 -1
- package/dist/splice.cjs.map +1 -1
- package/dist/splice.js +1 -1
- package/dist/splice.js.map +1 -1
- package/dist/split.cjs.map +1 -1
- package/dist/split.js.map +1 -1
- package/dist/splitAt.cjs +1 -1
- package/dist/splitAt.cjs.map +1 -1
- package/dist/splitAt.js.map +1 -1
- package/dist/splitWhen.cjs +1 -1
- package/dist/splitWhen.cjs.map +1 -1
- package/dist/splitWhen.js.map +1 -1
- package/dist/startsWith.cjs +1 -1
- package/dist/startsWith.cjs.map +1 -1
- package/dist/startsWith.js.map +1 -1
- package/dist/stringToPath.cjs.map +1 -1
- package/dist/stringToPath.js.map +1 -1
- package/dist/subtract.cjs +1 -1
- package/dist/subtract.cjs.map +1 -1
- package/dist/subtract.js.map +1 -1
- package/dist/sum.cjs +1 -1
- package/dist/sum.cjs.map +1 -1
- package/dist/sum.js.map +1 -1
- package/dist/sumBy.cjs +1 -1
- package/dist/sumBy.cjs.map +1 -1
- package/dist/sumBy.js +1 -1
- package/dist/sumBy.js.map +1 -1
- package/dist/swapInPlace-CllcD0HG.cjs +2 -0
- package/dist/swapInPlace-CllcD0HG.cjs.map +1 -0
- package/dist/{swapInPlace-Bb1dcddf.js → swapInPlace-ubtnp8en.js} +1 -1
- package/dist/swapInPlace-ubtnp8en.js.map +1 -0
- package/dist/swapIndices.cjs +1 -1
- package/dist/swapIndices.cjs.map +1 -1
- package/dist/swapIndices.js +1 -1
- package/dist/swapIndices.js.map +1 -1
- package/dist/swapProps.cjs +1 -1
- package/dist/swapProps.cjs.map +1 -1
- package/dist/swapProps.js +1 -1
- package/dist/swapProps.js.map +1 -1
- package/dist/take.cjs +1 -1
- package/dist/take.cjs.map +1 -1
- package/dist/take.js +1 -1
- package/dist/take.js.map +1 -1
- package/dist/takeFirstBy.cjs +1 -1
- package/dist/takeFirstBy.cjs.map +1 -1
- package/dist/takeFirstBy.js +1 -1
- package/dist/takeFirstBy.js.map +1 -1
- package/dist/takeLast.cjs +1 -1
- package/dist/takeLast.cjs.map +1 -1
- package/dist/takeLast.js.map +1 -1
- package/dist/takeLastWhile.cjs +1 -1
- package/dist/takeLastWhile.cjs.map +1 -1
- package/dist/takeLastWhile.js.map +1 -1
- package/dist/takeWhile.cjs +1 -1
- package/dist/takeWhile.cjs.map +1 -1
- package/dist/takeWhile.js.map +1 -1
- package/dist/tap.cjs +1 -1
- package/dist/tap.cjs.map +1 -1
- package/dist/tap.js.map +1 -1
- package/dist/times.cjs +1 -1
- package/dist/times.cjs.map +1 -1
- package/dist/times.js +1 -1
- package/dist/times.js.map +1 -1
- package/dist/toCamelCase.cjs +1 -1
- package/dist/toCamelCase.cjs.map +1 -1
- package/dist/toCamelCase.js +1 -1
- package/dist/toCamelCase.js.map +1 -1
- package/dist/toKebabCase.cjs +1 -1
- package/dist/toKebabCase.cjs.map +1 -1
- package/dist/toKebabCase.js +1 -1
- package/dist/toKebabCase.js.map +1 -1
- package/dist/toLowerCase.cjs +1 -1
- package/dist/toLowerCase.cjs.map +1 -1
- package/dist/toLowerCase.js.map +1 -1
- package/dist/toSingle-B-2WPC_O.cjs +2 -0
- package/dist/{toSingle-DMyKrrN-.cjs.map → toSingle-B-2WPC_O.cjs.map} +1 -1
- package/dist/{toSingle-1Si1O88f.js → toSingle-DiQSixar.js} +1 -1
- package/dist/{toSingle-1Si1O88f.js.map → toSingle-DiQSixar.js.map} +1 -1
- package/dist/toSnakeCase.cjs +1 -1
- package/dist/toSnakeCase.cjs.map +1 -1
- package/dist/toSnakeCase.js +1 -1
- package/dist/toSnakeCase.js.map +1 -1
- package/dist/toTitleCase.cjs +1 -1
- package/dist/toTitleCase.cjs.map +1 -1
- package/dist/toTitleCase.js +1 -1
- package/dist/toTitleCase.js.map +1 -1
- package/dist/toUpperCase.cjs +1 -1
- package/dist/toUpperCase.cjs.map +1 -1
- package/dist/toUpperCase.js.map +1 -1
- package/dist/truncate.cjs.map +1 -1
- package/dist/truncate.js.map +1 -1
- package/dist/uncapitalize.cjs +1 -1
- package/dist/uncapitalize.cjs.map +1 -1
- package/dist/uncapitalize.js.map +1 -1
- package/dist/unique.cjs +1 -1
- package/dist/unique.cjs.map +1 -1
- package/dist/unique.js +1 -1
- package/dist/unique.js.map +1 -1
- package/dist/uniqueBy.cjs +1 -1
- package/dist/uniqueBy.cjs.map +1 -1
- package/dist/uniqueBy.js +1 -1
- package/dist/uniqueBy.js.map +1 -1
- package/dist/uniqueWith.cjs +1 -1
- package/dist/uniqueWith.cjs.map +1 -1
- package/dist/uniqueWith.js +1 -1
- package/dist/uniqueWith.js.map +1 -1
- package/dist/utilityEvaluators-Cn_nNk4V.cjs +2 -0
- package/dist/{utilityEvaluators-1duvUKJ-.cjs.map → utilityEvaluators-Cn_nNk4V.cjs.map} +1 -1
- package/dist/{utilityEvaluators-Cb8x6-JZ.js → utilityEvaluators-IxVD3t2o.js} +1 -1
- package/dist/{utilityEvaluators-Cb8x6-JZ.js.map → utilityEvaluators-IxVD3t2o.js.map} +1 -1
- package/dist/values.cjs +1 -1
- package/dist/values.cjs.map +1 -1
- package/dist/values.js.map +1 -1
- package/dist/when.cjs.map +1 -1
- package/dist/when.js.map +1 -1
- package/dist/withPrecision-DPE-pG3p.cjs +2 -0
- package/dist/withPrecision-DPE-pG3p.cjs.map +1 -0
- package/dist/withPrecision-DXRugSn5.js +2 -0
- package/dist/withPrecision-DXRugSn5.js.map +1 -0
- package/dist/words-Cr8hSj8M.js +3 -0
- package/dist/words-Cr8hSj8M.js.map +1 -0
- package/dist/words-NxKaCJX2.cjs +3 -0
- package/dist/words-NxKaCJX2.cjs.map +1 -0
- package/dist/zip.cjs +1 -1
- package/dist/zip.cjs.map +1 -1
- package/dist/zip.js.map +1 -1
- package/dist/zipWith.cjs +1 -1
- package/dist/zipWith.cjs.map +1 -1
- package/dist/zipWith.js +1 -1
- package/dist/zipWith.js.map +1 -1
- package/package.json +28 -25
- package/dist/binarySearchCutoffIndex-TBknSzI9.cjs +0 -2
- package/dist/conditional-3wcaMG9k.cjs +0 -2
- package/dist/conditional-3wcaMG9k.cjs.map +0 -1
- package/dist/conditional-CTEJD5TX.js +0 -2
- package/dist/conditional-CTEJD5TX.js.map +0 -1
- package/dist/heap-Ct9W7Bbi.cjs +0 -2
- package/dist/lazyDataLastImpl-DdpJofHC.cjs +0 -2
- package/dist/nthBy-BFUrUEqW.cjs.map +0 -1
- package/dist/nthBy-DCn3SK1l.js.map +0 -1
- package/dist/purryOrderRules-BaB5mcHH.js +0 -2
- package/dist/purryOrderRules-cW1I4C_j.cjs +0 -2
- package/dist/swapInPlace-Bb1dcddf.js.map +0 -1
- package/dist/swapInPlace-Wglp6T7K.cjs +0 -2
- package/dist/swapInPlace-Wglp6T7K.cjs.map +0 -1
- package/dist/toSingle-DMyKrrN-.cjs +0 -2
- package/dist/utilityEvaluators-1duvUKJ-.cjs +0 -2
- package/dist/withPrecision-7nvi8hnb.js +0 -2
- package/dist/withPrecision-7nvi8hnb.js.map +0 -1
- package/dist/withPrecision-L0Ri7wjG.cjs +0 -2
- package/dist/withPrecision-L0Ri7wjG.cjs.map +0 -1
- package/dist/words-Daigshpc.cjs +0 -3
- package/dist/words-Daigshpc.cjs.map +0 -1
- package/dist/words-OcG39_Hp.js +0 -3
- package/dist/words-OcG39_Hp.js.map +0 -1
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/remeda
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [remeda](https://www.npmjs.com/package/remeda) @ 2.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [remeda](https://www.npmjs.com/package/remeda) @ 2.40.0 |
|
|
17
|
+
| Processed | 2026-08-16 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 0 |
|
|
20
20
|
|
package/changes.json
CHANGED
package/dist/add.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purry.cjs");function t(...t){return e.purry(n,t)}const n=(e,t)=>e+t;exports.add=t;
|
|
2
2
|
//# sourceMappingURL=add.cjs.map
|
package/dist/add.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.cjs","names":["purry"],"sources":["../src/add.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\n/**\n * Adds two numbers.\n *\n * @param value - The number.\n * @param addend - The number to add to the value.\n * @signature\n * add(value, addend);\n * @example\n * add(10, 5) // => 15\n * add(10, -5) // => 5\n * @dataFirst\n * @category Number\n */\nexport function add(value: bigint, addend: bigint): bigint;\nexport function add(value: number, addend: number): number;\n\n/**\n * Adds two numbers.\n *\n * @param addend - The number to add to the value.\n * @signature\n * add(addend)(value);\n * @example\n * add(5)(10) // => 15\n * add(-5)(10) // => 5\n * map([1, 2, 3, 4], add(1)) // => [2, 3, 4, 5]\n * @dataLast\n * @category Number\n */\nexport function add(addend: bigint): (value: bigint) => bigint;\nexport function add(addend: number): (value: number) => number;\n\nexport function add(...args: readonly unknown[]): unknown {\n return purry(addImplementation, args);\n}\n\n// The implementation only uses `number` types, but that's just because it's\n// hard to tell typescript that both value and addend would be of the same type.\nconst addImplementation = (value: number, addend: number): number =>\n value + addend;\n"],"mappings":"kGAkCA,SAAgB,EAAI,GAAG,EAAmC,CACxD,OAAOA,EAAAA,MAAM,EAAmB,
|
|
1
|
+
{"version":3,"file":"add.cjs","names":["purry"],"sources":["../src/add.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\n/**\n * Adds two numbers.\n *\n * @param value - The number.\n * @param addend - The number to add to the value.\n * @signature\n * add(value, addend);\n * @example\n * add(10, 5) // => 15\n * add(10, -5) // => 5\n * @dataFirst\n * @category Number\n */\nexport function add(value: bigint, addend: bigint): bigint;\nexport function add(value: number, addend: number): number;\n\n/**\n * Adds two numbers.\n *\n * @param addend - The number to add to the value.\n * @signature\n * add(addend)(value);\n * @example\n * add(5)(10) // => 15\n * add(-5)(10) // => 5\n * map([1, 2, 3, 4], add(1)) // => [2, 3, 4, 5]\n * @dataLast\n * @category Number\n */\nexport function add(addend: bigint): (value: bigint) => bigint;\nexport function add(addend: number): (value: number) => number;\n\nexport function add(...args: readonly unknown[]): unknown {\n return purry(addImplementation, args);\n}\n\n// The implementation only uses `number` types, but that's just because it's\n// hard to tell typescript that both value and addend would be of the same type.\nconst addImplementation = (value: number, addend: number): number =>\n value + addend;\n"],"mappings":"kGAkCA,SAAgB,EAAI,GAAG,EAAmC,CACxD,OAAOA,EAAAA,MAAM,EAAmB,CAAI,CACtC,CAIA,MAAM,GAAqB,EAAe,IACxC,EAAQ"}
|
package/dist/add.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","names":[],"sources":["../src/add.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\n/**\n * Adds two numbers.\n *\n * @param value - The number.\n * @param addend - The number to add to the value.\n * @signature\n * add(value, addend);\n * @example\n * add(10, 5) // => 15\n * add(10, -5) // => 5\n * @dataFirst\n * @category Number\n */\nexport function add(value: bigint, addend: bigint): bigint;\nexport function add(value: number, addend: number): number;\n\n/**\n * Adds two numbers.\n *\n * @param addend - The number to add to the value.\n * @signature\n * add(addend)(value);\n * @example\n * add(5)(10) // => 15\n * add(-5)(10) // => 5\n * map([1, 2, 3, 4], add(1)) // => [2, 3, 4, 5]\n * @dataLast\n * @category Number\n */\nexport function add(addend: bigint): (value: bigint) => bigint;\nexport function add(addend: number): (value: number) => number;\n\nexport function add(...args: readonly unknown[]): unknown {\n return purry(addImplementation, args);\n}\n\n// The implementation only uses `number` types, but that's just because it's\n// hard to tell typescript that both value and addend would be of the same type.\nconst addImplementation = (value: number, addend: number): number =>\n value + addend;\n"],"mappings":"mCAkCA,SAAgB,EAAI,GAAG,EAAmC,CACxD,OAAO,EAAM,EAAmB,
|
|
1
|
+
{"version":3,"file":"add.js","names":[],"sources":["../src/add.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\n/**\n * Adds two numbers.\n *\n * @param value - The number.\n * @param addend - The number to add to the value.\n * @signature\n * add(value, addend);\n * @example\n * add(10, 5) // => 15\n * add(10, -5) // => 5\n * @dataFirst\n * @category Number\n */\nexport function add(value: bigint, addend: bigint): bigint;\nexport function add(value: number, addend: number): number;\n\n/**\n * Adds two numbers.\n *\n * @param addend - The number to add to the value.\n * @signature\n * add(addend)(value);\n * @example\n * add(5)(10) // => 15\n * add(-5)(10) // => 5\n * map([1, 2, 3, 4], add(1)) // => [2, 3, 4, 5]\n * @dataLast\n * @category Number\n */\nexport function add(addend: bigint): (value: bigint) => bigint;\nexport function add(addend: number): (value: number) => number;\n\nexport function add(...args: readonly unknown[]): unknown {\n return purry(addImplementation, args);\n}\n\n// The implementation only uses `number` types, but that's just because it's\n// hard to tell typescript that both value and addend would be of the same type.\nconst addImplementation = (value: number, addend: number): number =>\n value + addend;\n"],"mappings":"mCAkCA,SAAgB,EAAI,GAAG,EAAmC,CACxD,OAAO,EAAM,EAAmB,CAAI,CACtC,CAIA,MAAM,GAAqB,EAAe,IACxC,EAAQ"}
|
package/dist/addProp.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purry.cjs");function t(...t){return e.purry(n,t)}const n=(e,t,n)=>({...e,[t]:n});exports.addProp=t;
|
|
2
2
|
//# sourceMappingURL=addProp.cjs.map
|
package/dist/addProp.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addProp.cjs","names":["purry"],"sources":["../src/addProp.ts"],"sourcesContent":["import type { UpsertProp } from \"./internal/types/UpsertProp\";\nimport { purry } from \"./purry\";\n\n/**\n * Add a new property to an object.\n *\n * The function doesn't do any checks on the input object. If the property\n * already exists it will be overwritten, and the type of the new value is not\n * checked against the previous type.\n *\n * Use `set` to override values explicitly with better protections.\n *\n * @param obj - The target object.\n * @param prop - The property name.\n * @param value - The property value.\n * @signature\n * addProp(obj, prop, value)\n * @example\n * addProp({firstName: 'john'}, 'lastName', 'doe') // => {firstName: 'john', lastName: 'doe'}\n * @dataFirst\n * @category Object\n */\nexport function addProp<T, K extends PropertyKey, V>(\n obj: T,\n prop: K,\n value: V,\n): UpsertProp<T, K, V>;\n\n/**\n * Add a new property to an object.\n *\n * The function doesn't do any checks on the input object. If the property\n * already exists it will be overwritten, and the type of the new value is not\n * checked against the previous type.\n *\n * Use `set` to override values explicitly with better protections.\n *\n * @param prop - The property name.\n * @param value - The property value.\n * @signature\n * addProp(prop, value)(obj)\n * @example\n * addProp('lastName', 'doe')({firstName: 'john'}) // => {firstName: 'john', lastName: 'doe'}\n * @dataLast\n * @category Object\n */\nexport function addProp<T, K extends PropertyKey, V>(\n prop: K,\n value: V,\n): (obj: T) => UpsertProp<T, K, V>;\n\nexport function addProp(...args: readonly unknown[]): unknown {\n return purry(addPropImplementation, args);\n}\n\nconst addPropImplementation = <T, K extends PropertyKey, V>(\n obj: T,\n prop: K,\n value: V,\n): UpsertProp<T, K, V> =>\n // @ts-expect-error [ts2322] - Hard to type...\n ({ ...obj, [prop]: value });\n"],"mappings":"kGAmDA,SAAgB,EAAQ,GAAG,EAAmC,CAC5D,OAAOA,EAAAA,MAAM,EAAuB,
|
|
1
|
+
{"version":3,"file":"addProp.cjs","names":["purry"],"sources":["../src/addProp.ts"],"sourcesContent":["import type { UpsertProp } from \"./internal/types/UpsertProp\";\nimport { purry } from \"./purry\";\n\n/**\n * Add a new property to an object.\n *\n * The function doesn't do any checks on the input object. If the property\n * already exists it will be overwritten, and the type of the new value is not\n * checked against the previous type.\n *\n * Use `set` to override values explicitly with better protections.\n *\n * @param obj - The target object.\n * @param prop - The property name.\n * @param value - The property value.\n * @signature\n * addProp(obj, prop, value)\n * @example\n * addProp({firstName: 'john'}, 'lastName', 'doe') // => {firstName: 'john', lastName: 'doe'}\n * @dataFirst\n * @category Object\n */\nexport function addProp<T, K extends PropertyKey, V>(\n obj: T,\n prop: K,\n value: V,\n): UpsertProp<T, K, V>;\n\n/**\n * Add a new property to an object.\n *\n * The function doesn't do any checks on the input object. If the property\n * already exists it will be overwritten, and the type of the new value is not\n * checked against the previous type.\n *\n * Use `set` to override values explicitly with better protections.\n *\n * @param prop - The property name.\n * @param value - The property value.\n * @signature\n * addProp(prop, value)(obj)\n * @example\n * addProp('lastName', 'doe')({firstName: 'john'}) // => {firstName: 'john', lastName: 'doe'}\n * @dataLast\n * @category Object\n */\nexport function addProp<T, K extends PropertyKey, V>(\n prop: K,\n value: V,\n): (obj: T) => UpsertProp<T, K, V>;\n\nexport function addProp(...args: readonly unknown[]): unknown {\n return purry(addPropImplementation, args);\n}\n\nconst addPropImplementation = <T, K extends PropertyKey, V>(\n obj: T,\n prop: K,\n value: V,\n): UpsertProp<T, K, V> =>\n // @ts-expect-error [ts2322] - Hard to type...\n ({ ...obj, [prop]: value });\n"],"mappings":"kGAmDA,SAAgB,EAAQ,GAAG,EAAmC,CAC5D,OAAOA,EAAAA,MAAM,EAAuB,CAAI,CAC1C,CAEA,MAAM,GACJ,EACA,EACA,KAGC,CAAE,GAAG,GAAM,GAAO,CAAM"}
|
package/dist/addProp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addProp.js","names":[],"sources":["../src/addProp.ts"],"sourcesContent":["import type { UpsertProp } from \"./internal/types/UpsertProp\";\nimport { purry } from \"./purry\";\n\n/**\n * Add a new property to an object.\n *\n * The function doesn't do any checks on the input object. If the property\n * already exists it will be overwritten, and the type of the new value is not\n * checked against the previous type.\n *\n * Use `set` to override values explicitly with better protections.\n *\n * @param obj - The target object.\n * @param prop - The property name.\n * @param value - The property value.\n * @signature\n * addProp(obj, prop, value)\n * @example\n * addProp({firstName: 'john'}, 'lastName', 'doe') // => {firstName: 'john', lastName: 'doe'}\n * @dataFirst\n * @category Object\n */\nexport function addProp<T, K extends PropertyKey, V>(\n obj: T,\n prop: K,\n value: V,\n): UpsertProp<T, K, V>;\n\n/**\n * Add a new property to an object.\n *\n * The function doesn't do any checks on the input object. If the property\n * already exists it will be overwritten, and the type of the new value is not\n * checked against the previous type.\n *\n * Use `set` to override values explicitly with better protections.\n *\n * @param prop - The property name.\n * @param value - The property value.\n * @signature\n * addProp(prop, value)(obj)\n * @example\n * addProp('lastName', 'doe')({firstName: 'john'}) // => {firstName: 'john', lastName: 'doe'}\n * @dataLast\n * @category Object\n */\nexport function addProp<T, K extends PropertyKey, V>(\n prop: K,\n value: V,\n): (obj: T) => UpsertProp<T, K, V>;\n\nexport function addProp(...args: readonly unknown[]): unknown {\n return purry(addPropImplementation, args);\n}\n\nconst addPropImplementation = <T, K extends PropertyKey, V>(\n obj: T,\n prop: K,\n value: V,\n): UpsertProp<T, K, V> =>\n // @ts-expect-error [ts2322] - Hard to type...\n ({ ...obj, [prop]: value });\n"],"mappings":"mCAmDA,SAAgB,EAAQ,GAAG,EAAmC,CAC5D,OAAO,EAAM,EAAuB,
|
|
1
|
+
{"version":3,"file":"addProp.js","names":[],"sources":["../src/addProp.ts"],"sourcesContent":["import type { UpsertProp } from \"./internal/types/UpsertProp\";\nimport { purry } from \"./purry\";\n\n/**\n * Add a new property to an object.\n *\n * The function doesn't do any checks on the input object. If the property\n * already exists it will be overwritten, and the type of the new value is not\n * checked against the previous type.\n *\n * Use `set` to override values explicitly with better protections.\n *\n * @param obj - The target object.\n * @param prop - The property name.\n * @param value - The property value.\n * @signature\n * addProp(obj, prop, value)\n * @example\n * addProp({firstName: 'john'}, 'lastName', 'doe') // => {firstName: 'john', lastName: 'doe'}\n * @dataFirst\n * @category Object\n */\nexport function addProp<T, K extends PropertyKey, V>(\n obj: T,\n prop: K,\n value: V,\n): UpsertProp<T, K, V>;\n\n/**\n * Add a new property to an object.\n *\n * The function doesn't do any checks on the input object. If the property\n * already exists it will be overwritten, and the type of the new value is not\n * checked against the previous type.\n *\n * Use `set` to override values explicitly with better protections.\n *\n * @param prop - The property name.\n * @param value - The property value.\n * @signature\n * addProp(prop, value)(obj)\n * @example\n * addProp('lastName', 'doe')({firstName: 'john'}) // => {firstName: 'john', lastName: 'doe'}\n * @dataLast\n * @category Object\n */\nexport function addProp<T, K extends PropertyKey, V>(\n prop: K,\n value: V,\n): (obj: T) => UpsertProp<T, K, V>;\n\nexport function addProp(...args: readonly unknown[]): unknown {\n return purry(addPropImplementation, args);\n}\n\nconst addPropImplementation = <T, K extends PropertyKey, V>(\n obj: T,\n prop: K,\n value: V,\n): UpsertProp<T, K, V> =>\n // @ts-expect-error [ts2322] - Hard to type...\n ({ ...obj, [prop]: value });\n"],"mappings":"mCAmDA,SAAgB,EAAQ,GAAG,EAAmC,CAC5D,OAAO,EAAM,EAAuB,CAAI,CAC1C,CAEA,MAAM,GACJ,EACA,EACA,KAGC,CAAE,GAAG,GAAM,GAAO,CAAM"}
|
package/dist/allPass.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purry.cjs");function t(...t){return e.purry(n,t)}const n=(e,t)=>t.every(t=>t(e));exports.allPass=t;
|
|
2
2
|
//# sourceMappingURL=allPass.cjs.map
|
package/dist/allPass.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"allPass.cjs","names":["purry"],"sources":["../src/allPass.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"allPass.cjs","names":["purry"],"sources":["../src/allPass.ts"],"sourcesContent":["/* eslint-disable unicorn/consistent-boolean-name --\n * TODO [>2] -- This rule is on-point! The function's name should communicate\n * more clearly that it returns a boolean value.\n */\n\nimport { purry } from \"./purry\";\n\n/**\n * Determines whether all predicates return true for the input data.\n *\n * @param data - The input data for predicates.\n * @param fns - The list of predicates.\n * @signature\n * allPass(data, fns)\n * @example\n * const isDivisibleBy3 = (x: number) => x % 3 === 0\n * const isDivisibleBy4 = (x: number) => x % 4 === 0\n * const fns = [isDivisibleBy3, isDivisibleBy4]\n * allPass(12, fns) // => true\n * allPass(8, fns) // => false\n * @dataFirst\n * @category Array\n */\nexport function allPass<T>(\n data: T,\n fns: readonly ((data: T) => boolean)[],\n): boolean;\n\n/**\n * Determines whether all predicates return true for the input data.\n *\n * @param fns - The list of predicates.\n * @signature\n * allPass(fns)(data)\n * @example\n * const isDivisibleBy3 = (x: number) => x % 3 === 0\n * const isDivisibleBy4 = (x: number) => x % 4 === 0\n * const fns = [isDivisibleBy3, isDivisibleBy4]\n * allPass(fns)(12) // => true\n * allPass(fns)(8) // => false\n * @dataLast\n * @category Array\n */\nexport function allPass<T>(\n fns: readonly ((data: T) => boolean)[],\n): (data: T) => boolean;\n\nexport function allPass(...args: readonly unknown[]): unknown {\n return purry(allPassImplementation, args);\n}\n\nconst allPassImplementation = <T>(\n data: T,\n fns: readonly ((data: T) => boolean)[],\n): boolean => fns.every((fn) => fn(data));\n"],"mappings":"kGA+CA,SAAgB,EAAQ,GAAG,EAAmC,CAC5D,OAAOA,EAAAA,MAAM,EAAuB,CAAI,CAC1C,CAEA,MAAM,GACJ,EACA,IACY,EAAI,MAAO,GAAO,EAAG,CAAI,CAAC"}
|
package/dist/allPass.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"allPass.js","names":[],"sources":["../src/allPass.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"allPass.js","names":[],"sources":["../src/allPass.ts"],"sourcesContent":["/* eslint-disable unicorn/consistent-boolean-name --\n * TODO [>2] -- This rule is on-point! The function's name should communicate\n * more clearly that it returns a boolean value.\n */\n\nimport { purry } from \"./purry\";\n\n/**\n * Determines whether all predicates return true for the input data.\n *\n * @param data - The input data for predicates.\n * @param fns - The list of predicates.\n * @signature\n * allPass(data, fns)\n * @example\n * const isDivisibleBy3 = (x: number) => x % 3 === 0\n * const isDivisibleBy4 = (x: number) => x % 4 === 0\n * const fns = [isDivisibleBy3, isDivisibleBy4]\n * allPass(12, fns) // => true\n * allPass(8, fns) // => false\n * @dataFirst\n * @category Array\n */\nexport function allPass<T>(\n data: T,\n fns: readonly ((data: T) => boolean)[],\n): boolean;\n\n/**\n * Determines whether all predicates return true for the input data.\n *\n * @param fns - The list of predicates.\n * @signature\n * allPass(fns)(data)\n * @example\n * const isDivisibleBy3 = (x: number) => x % 3 === 0\n * const isDivisibleBy4 = (x: number) => x % 4 === 0\n * const fns = [isDivisibleBy3, isDivisibleBy4]\n * allPass(fns)(12) // => true\n * allPass(fns)(8) // => false\n * @dataLast\n * @category Array\n */\nexport function allPass<T>(\n fns: readonly ((data: T) => boolean)[],\n): (data: T) => boolean;\n\nexport function allPass(...args: readonly unknown[]): unknown {\n return purry(allPassImplementation, args);\n}\n\nconst allPassImplementation = <T>(\n data: T,\n fns: readonly ((data: T) => boolean)[],\n): boolean => fns.every((fn) => fn(data));\n"],"mappings":"mCA+CA,SAAgB,EAAQ,GAAG,EAAmC,CAC5D,OAAO,EAAM,EAAuB,CAAI,CAC1C,CAEA,MAAM,GACJ,EACA,IACY,EAAI,MAAO,GAAO,EAAG,CAAI,CAAC"}
|
package/dist/anyPass.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purry.cjs");function t(...t){return e.purry(n,t)}const n=(e,t)=>t.some(t=>t(e));exports.anyPass=t;
|
|
2
2
|
//# sourceMappingURL=anyPass.cjs.map
|
package/dist/anyPass.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anyPass.cjs","names":["purry"],"sources":["../src/anyPass.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"anyPass.cjs","names":["purry"],"sources":["../src/anyPass.ts"],"sourcesContent":["/* eslint-disable unicorn/consistent-boolean-name --\n * TODO [>2] -- This rule is on-point! The function's name should communicate\n * more clearly that it returns a boolean value.\n */\n\nimport { purry } from \"./purry\";\n\n/**\n * Determines whether any predicate returns true for the input data.\n *\n * @param data - The input data for predicates.\n * @param fns - The list of predicates.\n * @signature\n * anyPass(data, fns)\n * @example\n * const isDivisibleBy3 = (x: number) => x % 3 === 0\n * const isDivisibleBy4 = (x: number) => x % 4 === 0\n * const fns = [isDivisibleBy3, isDivisibleBy4]\n * anyPass(8, fns) // => true\n * anyPass(11, fns) // => false\n * @dataFirst\n * @category Array\n */\nexport function anyPass<T>(\n data: T,\n fns: readonly ((data: T) => boolean)[],\n): boolean;\n\n/**\n * Determines whether any predicate returns true for the input data.\n *\n * @param fns - The list of predicates.\n * @signature\n * anyPass(fns)(data)\n * @example\n * const isDivisibleBy3 = (x: number) => x % 3 === 0\n * const isDivisibleBy4 = (x: number) => x % 4 === 0\n * const fns = [isDivisibleBy3, isDivisibleBy4]\n * anyPass(fns)(8) // => true\n * anyPass(fns)(11) // => false\n * @dataLast\n * @category Array\n */\nexport function anyPass<T>(\n fns: readonly ((data: T) => boolean)[],\n): (data: T) => boolean;\n\nexport function anyPass(...args: readonly unknown[]): unknown {\n return purry(anyPassImplementation, args);\n}\n\nconst anyPassImplementation = <T>(\n data: T,\n fns: readonly ((data: T) => boolean)[],\n): boolean => fns.some((fn) => fn(data));\n"],"mappings":"kGA+CA,SAAgB,EAAQ,GAAG,EAAmC,CAC5D,OAAOA,EAAAA,MAAM,EAAuB,CAAI,CAC1C,CAEA,MAAM,GACJ,EACA,IACY,EAAI,KAAM,GAAO,EAAG,CAAI,CAAC"}
|
package/dist/anyPass.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anyPass.js","names":[],"sources":["../src/anyPass.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"anyPass.js","names":[],"sources":["../src/anyPass.ts"],"sourcesContent":["/* eslint-disable unicorn/consistent-boolean-name --\n * TODO [>2] -- This rule is on-point! The function's name should communicate\n * more clearly that it returns a boolean value.\n */\n\nimport { purry } from \"./purry\";\n\n/**\n * Determines whether any predicate returns true for the input data.\n *\n * @param data - The input data for predicates.\n * @param fns - The list of predicates.\n * @signature\n * anyPass(data, fns)\n * @example\n * const isDivisibleBy3 = (x: number) => x % 3 === 0\n * const isDivisibleBy4 = (x: number) => x % 4 === 0\n * const fns = [isDivisibleBy3, isDivisibleBy4]\n * anyPass(8, fns) // => true\n * anyPass(11, fns) // => false\n * @dataFirst\n * @category Array\n */\nexport function anyPass<T>(\n data: T,\n fns: readonly ((data: T) => boolean)[],\n): boolean;\n\n/**\n * Determines whether any predicate returns true for the input data.\n *\n * @param fns - The list of predicates.\n * @signature\n * anyPass(fns)(data)\n * @example\n * const isDivisibleBy3 = (x: number) => x % 3 === 0\n * const isDivisibleBy4 = (x: number) => x % 4 === 0\n * const fns = [isDivisibleBy3, isDivisibleBy4]\n * anyPass(fns)(8) // => true\n * anyPass(fns)(11) // => false\n * @dataLast\n * @category Array\n */\nexport function anyPass<T>(\n fns: readonly ((data: T) => boolean)[],\n): (data: T) => boolean;\n\nexport function anyPass(...args: readonly unknown[]): unknown {\n return purry(anyPassImplementation, args);\n}\n\nconst anyPassImplementation = <T>(\n data: T,\n fns: readonly ((data: T) => boolean)[],\n): boolean => fns.some((fn) => fn(data));\n"],"mappings":"mCA+CA,SAAgB,EAAQ,GAAG,EAAmC,CAC5D,OAAO,EAAM,EAAuB,CAAI,CAC1C,CAEA,MAAM,GACJ,EACA,IACY,EAAI,KAAM,GAAO,EAAG,CAAI,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function e(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1,a=e[i];t(a,i,e)?n=i+1:r=i}return r}export{e as t};
|
|
2
|
-
//# sourceMappingURL=binarySearchCutoffIndex-
|
|
2
|
+
//# sourceMappingURL=binarySearchCutoffIndex-CRPy-dOJ.js.map
|
package/dist/{binarySearchCutoffIndex-CalebGhL.js.map → binarySearchCutoffIndex-CRPy-dOJ.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binarySearchCutoffIndex-
|
|
1
|
+
{"version":3,"file":"binarySearchCutoffIndex-CRPy-dOJ.js","names":[],"sources":["../src/internal/binarySearchCutoffIndex.ts"],"sourcesContent":["/**\n * A binary search implementation that finds the index at which `predicate`\n * stops returning `true` and starts returning `false` (consistently) when run\n * on the items of the array. It **assumes** that mapping the array via the\n * predicate results in the shape `[...true[], ...false[]]`. *For any other case\n * the result is unpredictable*.\n *\n * This is the base implementation of the `sortedIndex` functions which define\n * the predicate for the user, for common use-cases.\n *\n * It is similar to `findIndex`, but runs at O(logN), whereas the latter is\n * general purpose function which runs on any array and predicate, but runs at\n * O(N) time.\n */\nexport function binarySearchCutoffIndex<T>(\n array: readonly T[],\n predicate: (value: T, index: number, data: readonly T[]) => boolean,\n): number {\n let lowIndex = 0;\n let highIndex = array.length;\n\n while (lowIndex < highIndex) {\n // eslint-disable-next-line no-bitwise -- We use bitwise operator here as a way to find the mid-point and round it down using the same operation.\n const pivotIndex = (lowIndex + highIndex) >>> 1;\n const pivot = array[pivotIndex]!;\n\n if (predicate(pivot, pivotIndex, array)) {\n lowIndex = pivotIndex + 1;\n } else {\n highIndex = pivotIndex;\n }\n }\n\n return highIndex;\n}\n"],"mappings":"AAcA,SAAgB,EACd,EACA,EACQ,CACR,IAAI,EAAW,EACX,EAAY,EAAM,OAEtB,KAAO,EAAW,GAAW,CAE3B,IAAM,EAAc,EAAW,IAAe,EACxC,EAAQ,EAAM,GAEhB,EAAU,EAAO,EAAY,CAAK,EACpC,EAAW,EAAa,EAExB,EAAY,CAEhB,CAEA,OAAO,CACT"}
|
package/dist/{binarySearchCutoffIndex-TBknSzI9.cjs.map → binarySearchCutoffIndex-CdUUMUB1.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binarySearchCutoffIndex-
|
|
1
|
+
{"version":3,"file":"binarySearchCutoffIndex-CdUUMUB1.cjs","names":[],"sources":["../src/internal/binarySearchCutoffIndex.ts"],"sourcesContent":["/**\n * A binary search implementation that finds the index at which `predicate`\n * stops returning `true` and starts returning `false` (consistently) when run\n * on the items of the array. It **assumes** that mapping the array via the\n * predicate results in the shape `[...true[], ...false[]]`. *For any other case\n * the result is unpredictable*.\n *\n * This is the base implementation of the `sortedIndex` functions which define\n * the predicate for the user, for common use-cases.\n *\n * It is similar to `findIndex`, but runs at O(logN), whereas the latter is\n * general purpose function which runs on any array and predicate, but runs at\n * O(N) time.\n */\nexport function binarySearchCutoffIndex<T>(\n array: readonly T[],\n predicate: (value: T, index: number, data: readonly T[]) => boolean,\n): number {\n let lowIndex = 0;\n let highIndex = array.length;\n\n while (lowIndex < highIndex) {\n // eslint-disable-next-line no-bitwise -- We use bitwise operator here as a way to find the mid-point and round it down using the same operation.\n const pivotIndex = (lowIndex + highIndex) >>> 1;\n const pivot = array[pivotIndex]!;\n\n if (predicate(pivot, pivotIndex, array)) {\n lowIndex = pivotIndex + 1;\n } else {\n highIndex = pivotIndex;\n }\n }\n\n return highIndex;\n}\n"],"mappings":"AAcA,SAAgB,EACd,EACA,EACQ,CACR,IAAI,EAAW,EACX,EAAY,EAAM,OAEtB,KAAO,EAAW,GAAW,CAE3B,IAAM,EAAc,EAAW,IAAe,EACxC,EAAQ,EAAM,GAEhB,EAAU,EAAO,EAAY,CAAK,EACpC,EAAW,EAAa,EAExB,EAAY,CAEhB,CAEA,OAAO,CACT"}
|
package/dist/capitalize.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purry.cjs");function t(...t){return e.purry(n,t)}const n=e=>`${e[0]?.toUpperCase()??``}${e.slice(1)}`;exports.capitalize=t;
|
|
2
2
|
//# sourceMappingURL=capitalize.cjs.map
|
package/dist/capitalize.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capitalize.cjs","names":["purry"],"sources":["../src/capitalize.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\n/**\n * Makes the first character of a string uppercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * for the runtime and the built-in [`Capitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#capitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: uppercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#uppercase)\n * to capitalize it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * capitalize(data);\n * @example\n * capitalize(\"hello world\"); // \"Hello world\"\n * @dataFirst\n * @category String\n */\nexport function capitalize<T extends string>(data: T): Capitalize<T>;\n\n/**\n * Makes the first character of a string uppercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * for the runtime and the built-in [`Capitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#capitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: uppercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#uppercase)\n * to capitalize it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * capitalize()(data);\n * @example\n * pipe(\"hello world\", capitalize()); // \"Hello world\"\n * @dataLast\n * @category String\n */\nexport function capitalize(): <T extends string>(data: T) => Capitalize<T>;\n\nexport function capitalize(...args: readonly unknown[]): unknown {\n return purry(capitalizeImplementation, args);\n}\n\nconst capitalizeImplementation = <T extends string>(data: T): Capitalize<T> =>\n `${data[0]?.toUpperCase() ?? \"\"}${data.slice(1)}` as Capitalize<T>;\n"],"mappings":"kGAqDA,SAAgB,EAAW,GAAG,EAAmC,CAC/D,OAAOA,EAAAA,MAAM,EAA0B,
|
|
1
|
+
{"version":3,"file":"capitalize.cjs","names":["purry"],"sources":["../src/capitalize.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\n/**\n * Makes the first character of a string uppercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * for the runtime and the built-in [`Capitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#capitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: uppercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#uppercase)\n * to capitalize it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * capitalize(data);\n * @example\n * capitalize(\"hello world\"); // \"Hello world\"\n * @dataFirst\n * @category String\n */\nexport function capitalize<T extends string>(data: T): Capitalize<T>;\n\n/**\n * Makes the first character of a string uppercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * for the runtime and the built-in [`Capitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#capitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: uppercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#uppercase)\n * to capitalize it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * capitalize()(data);\n * @example\n * pipe(\"hello world\", capitalize()); // \"Hello world\"\n * @dataLast\n * @category String\n */\nexport function capitalize(): <T extends string>(data: T) => Capitalize<T>;\n\nexport function capitalize(...args: readonly unknown[]): unknown {\n return purry(capitalizeImplementation, args);\n}\n\nconst capitalizeImplementation = <T extends string>(data: T): Capitalize<T> =>\n `${data[0]?.toUpperCase() ?? \"\"}${data.slice(1)}` as Capitalize<T>;\n"],"mappings":"kGAqDA,SAAgB,EAAW,GAAG,EAAmC,CAC/D,OAAOA,EAAAA,MAAM,EAA0B,CAAI,CAC7C,CAEA,MAAM,EAA8C,GAClD,GAAG,EAAK,EAAE,EAAE,YAAY,GAAK,KAAK,EAAK,MAAM,CAAC"}
|
package/dist/capitalize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capitalize.js","names":[],"sources":["../src/capitalize.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\n/**\n * Makes the first character of a string uppercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * for the runtime and the built-in [`Capitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#capitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: uppercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#uppercase)\n * to capitalize it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * capitalize(data);\n * @example\n * capitalize(\"hello world\"); // \"Hello world\"\n * @dataFirst\n * @category String\n */\nexport function capitalize<T extends string>(data: T): Capitalize<T>;\n\n/**\n * Makes the first character of a string uppercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * for the runtime and the built-in [`Capitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#capitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: uppercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#uppercase)\n * to capitalize it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * capitalize()(data);\n * @example\n * pipe(\"hello world\", capitalize()); // \"Hello world\"\n * @dataLast\n * @category String\n */\nexport function capitalize(): <T extends string>(data: T) => Capitalize<T>;\n\nexport function capitalize(...args: readonly unknown[]): unknown {\n return purry(capitalizeImplementation, args);\n}\n\nconst capitalizeImplementation = <T extends string>(data: T): Capitalize<T> =>\n `${data[0]?.toUpperCase() ?? \"\"}${data.slice(1)}` as Capitalize<T>;\n"],"mappings":"mCAqDA,SAAgB,EAAW,GAAG,EAAmC,CAC/D,OAAO,EAAM,EAA0B,
|
|
1
|
+
{"version":3,"file":"capitalize.js","names":[],"sources":["../src/capitalize.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\n/**\n * Makes the first character of a string uppercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * for the runtime and the built-in [`Capitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#capitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: uppercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#uppercase)\n * to capitalize it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @param data - A string.\n * @signature\n * capitalize(data);\n * @example\n * capitalize(\"hello world\"); // \"Hello world\"\n * @dataFirst\n * @category String\n */\nexport function capitalize<T extends string>(data: T): Capitalize<T>;\n\n/**\n * Makes the first character of a string uppercase while leaving the rest\n * unchanged.\n *\n * It uses the built-in [`String.prototype.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\n * for the runtime and the built-in [`Capitalize`](https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html#capitalizestringtype)\n * utility type for typing and thus shares their _[locale inaccuracies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase#description)_.\n *\n * For display purposes, prefer using the CSS pseudo-element [`::first-letter`](https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter) to target\n * just the first letter of the word, and [`text-transform: uppercase`](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform#uppercase)\n * to capitalize it. This transformation **is** locale-aware.\n *\n * For other case manipulations see: `toUpperCase`, `toLowerCase`,\n * `uncapitalize`, `toCamelCase`, `toKebabCase`, `toSnakeCase`, and\n * `toTitleCase`.\n *\n * @signature\n * capitalize()(data);\n * @example\n * pipe(\"hello world\", capitalize()); // \"Hello world\"\n * @dataLast\n * @category String\n */\nexport function capitalize(): <T extends string>(data: T) => Capitalize<T>;\n\nexport function capitalize(...args: readonly unknown[]): unknown {\n return purry(capitalizeImplementation, args);\n}\n\nconst capitalizeImplementation = <T extends string>(data: T): Capitalize<T> =>\n `${data[0]?.toUpperCase() ?? \"\"}${data.slice(1)}` as Capitalize<T>;\n"],"mappings":"mCAqDA,SAAgB,EAAW,GAAG,EAAmC,CAC/D,OAAO,EAAM,EAA0B,CAAI,CAC7C,CAEA,MAAM,EAA8C,GAClD,GAAG,EAAK,EAAE,EAAE,YAAY,GAAK,KAAK,EAAK,MAAM,CAAC"}
|
package/dist/ceil.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purry.cjs"),t=require("./withPrecision-DPE-pG3p.cjs");function n(...n){return e.purry(t.t(Math.ceil),n)}exports.ceil=n;
|
|
2
2
|
//# sourceMappingURL=ceil.cjs.map
|
package/dist/ceil.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ceil.cjs","names":["purry","withPrecision"],"sources":["../src/ceil.ts"],"sourcesContent":["import { withPrecision } from \"./internal/withPrecision\";\nimport { purry } from \"./purry\";\n\n/**\n * Rounds up a given number to a specific precision.\n * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.ceil` instead, as it won't incur the additional library overhead.\n *\n * @param value - The number to round up.\n * @param precision - The precision to round up to. Must be an integer between -15 and 15.\n * @signature\n * ceil(value, precision);\n * @example\n * ceil(123.9876, 3) // => 123.988\n * ceil(483.22243, 1) // => 483.3\n * ceil(8541, -1) // => 8550\n * ceil(456789, -3) // => 457000\n * @dataFirst\n * @category Number\n */\nexport function ceil(value: number, precision: number): number;\n\n/**\n * Rounds up a given number to a specific precision.\n * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.ceil` instead, as it won't incur the additional library overhead.\n *\n * @param precision - The precision to round up to. Must be an integer between -15 and 15.\n * @signature\n * ceil(precision)(value);\n * @example\n * ceil(3)(123.9876) // => 123.988\n * ceil(1)(483.22243) // => 483.3\n * ceil(-1)(8541) // => 8550\n * ceil(-3)(456789) // => 457000\n * @dataLast\n * @category Number\n */\nexport function ceil(precision: number): (value: number) => number;\n\nexport function ceil(...args: readonly unknown[]): unknown {\n return purry(withPrecision(Math.ceil), args);\n}\n"],"mappings":"4IAwCA,SAAgB,EAAK,GAAG,EAAmC,CACzD,OAAOA,EAAAA,MAAMC,EAAAA,EAAc,KAAK,
|
|
1
|
+
{"version":3,"file":"ceil.cjs","names":["purry","withPrecision"],"sources":["../src/ceil.ts"],"sourcesContent":["import { withPrecision } from \"./internal/withPrecision\";\nimport { purry } from \"./purry\";\n\n/**\n * Rounds up a given number to a specific precision.\n * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.ceil` instead, as it won't incur the additional library overhead.\n *\n * @param value - The number to round up.\n * @param precision - The precision to round up to. Must be an integer between -15 and 15.\n * @signature\n * ceil(value, precision);\n * @example\n * ceil(123.9876, 3) // => 123.988\n * ceil(483.22243, 1) // => 483.3\n * ceil(8541, -1) // => 8550\n * ceil(456789, -3) // => 457000\n * @dataFirst\n * @category Number\n */\nexport function ceil(value: number, precision: number): number;\n\n/**\n * Rounds up a given number to a specific precision.\n * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.ceil` instead, as it won't incur the additional library overhead.\n *\n * @param precision - The precision to round up to. Must be an integer between -15 and 15.\n * @signature\n * ceil(precision)(value);\n * @example\n * ceil(3)(123.9876) // => 123.988\n * ceil(1)(483.22243) // => 483.3\n * ceil(-1)(8541) // => 8550\n * ceil(-3)(456789) // => 457000\n * @dataLast\n * @category Number\n */\nexport function ceil(precision: number): (value: number) => number;\n\nexport function ceil(...args: readonly unknown[]): unknown {\n return purry(withPrecision(Math.ceil), args);\n}\n"],"mappings":"4IAwCA,SAAgB,EAAK,GAAG,EAAmC,CACzD,OAAOA,EAAAA,MAAMC,EAAAA,EAAc,KAAK,IAAI,EAAG,CAAI,CAC7C"}
|
package/dist/ceil.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{purry as e}from"./purry.js";import{t}from"./withPrecision-
|
|
1
|
+
import{purry as e}from"./purry.js";import{t}from"./withPrecision-DXRugSn5.js";function n(...n){return e(t(Math.ceil),n)}export{n as ceil};
|
|
2
2
|
//# sourceMappingURL=ceil.js.map
|
package/dist/ceil.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ceil.js","names":[],"sources":["../src/ceil.ts"],"sourcesContent":["import { withPrecision } from \"./internal/withPrecision\";\nimport { purry } from \"./purry\";\n\n/**\n * Rounds up a given number to a specific precision.\n * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.ceil` instead, as it won't incur the additional library overhead.\n *\n * @param value - The number to round up.\n * @param precision - The precision to round up to. Must be an integer between -15 and 15.\n * @signature\n * ceil(value, precision);\n * @example\n * ceil(123.9876, 3) // => 123.988\n * ceil(483.22243, 1) // => 483.3\n * ceil(8541, -1) // => 8550\n * ceil(456789, -3) // => 457000\n * @dataFirst\n * @category Number\n */\nexport function ceil(value: number, precision: number): number;\n\n/**\n * Rounds up a given number to a specific precision.\n * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.ceil` instead, as it won't incur the additional library overhead.\n *\n * @param precision - The precision to round up to. Must be an integer between -15 and 15.\n * @signature\n * ceil(precision)(value);\n * @example\n * ceil(3)(123.9876) // => 123.988\n * ceil(1)(483.22243) // => 483.3\n * ceil(-1)(8541) // => 8550\n * ceil(-3)(456789) // => 457000\n * @dataLast\n * @category Number\n */\nexport function ceil(precision: number): (value: number) => number;\n\nexport function ceil(...args: readonly unknown[]): unknown {\n return purry(withPrecision(Math.ceil), args);\n}\n"],"mappings":"8EAwCA,SAAgB,EAAK,GAAG,EAAmC,CACzD,OAAO,EAAM,EAAc,KAAK,
|
|
1
|
+
{"version":3,"file":"ceil.js","names":[],"sources":["../src/ceil.ts"],"sourcesContent":["import { withPrecision } from \"./internal/withPrecision\";\nimport { purry } from \"./purry\";\n\n/**\n * Rounds up a given number to a specific precision.\n * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.ceil` instead, as it won't incur the additional library overhead.\n *\n * @param value - The number to round up.\n * @param precision - The precision to round up to. Must be an integer between -15 and 15.\n * @signature\n * ceil(value, precision);\n * @example\n * ceil(123.9876, 3) // => 123.988\n * ceil(483.22243, 1) // => 483.3\n * ceil(8541, -1) // => 8550\n * ceil(456789, -3) // => 457000\n * @dataFirst\n * @category Number\n */\nexport function ceil(value: number, precision: number): number;\n\n/**\n * Rounds up a given number to a specific precision.\n * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),\n * use `Math.ceil` instead, as it won't incur the additional library overhead.\n *\n * @param precision - The precision to round up to. Must be an integer between -15 and 15.\n * @signature\n * ceil(precision)(value);\n * @example\n * ceil(3)(123.9876) // => 123.988\n * ceil(1)(483.22243) // => 483.3\n * ceil(-1)(8541) // => 8550\n * ceil(-3)(456789) // => 457000\n * @dataLast\n * @category Number\n */\nexport function ceil(precision: number): (value: number) => number;\n\nexport function ceil(...args: readonly unknown[]): unknown {\n return purry(withPrecision(Math.ceil), args);\n}\n"],"mappings":"8EAwCA,SAAgB,EAAK,GAAG,EAAmC,CACzD,OAAO,EAAM,EAAc,KAAK,IAAI,EAAG,CAAI,CAC7C"}
|
package/dist/chunk.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purry.cjs");function t(...t){return e.purry(n,t)}function n(e,t){if(t<1)throw RangeError(`chunk: A chunk size of '${t.toString()}' would result in an infinite array`);if(e.length===0)return[];if(t>=e.length)return[[...e]];let n=Math.ceil(e.length/t),r=Array(n);if(t===1)for(let[t,n]of e.entries())r[t]=[n];else for(let i=0;i<n;i+=1){let n=i*t;r[i]=e.slice(n,n+t)}return r}exports.chunk=t;
|
|
2
2
|
//# sourceMappingURL=chunk.cjs.map
|
package/dist/chunk.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.cjs","names":["purry"],"sources":["../src/chunk.ts"],"sourcesContent":["import type {\n IntRange,\n IsNever,\n IsNumericLiteral,\n LessThan,\n Subtract,\n ValueOf,\n} from \"type-fest\";\nimport type { IntRangeInclusive } from \"./internal/types/IntRangeInclusive\";\nimport type { IterableContainer } from \"./internal/types/IterableContainer\";\nimport type { NTuple } from \"./internal/types/NTuple\";\nimport type { NonEmptyArray } from \"./internal/types/NonEmptyArray\";\nimport type { PartialArray } from \"./internal/types/PartialArray\";\nimport type { TupleParts } from \"./internal/types/TupleParts\";\nimport { purry } from \"./purry\";\n\n// This prevents typescript from failing on complex arrays and large chunks. It\n// allows the typing to remain useful even when very large chunks are needed,\n// without loosing fidelity on smaller ones. It was chosen by trial-and-error,\n// and given some more wiggle room because the complexity of the array also\n// plays a role in when typescript fails to recurse.\n// See the type tests for an example.\ntype MAX_LITERAL_SIZE = 350;\n\ntype Chunk<\n T extends IterableContainer,\n N extends number,\n> = T extends readonly []\n ? []\n : IsNumericLiteral<N> extends true\n ? LessThan<N, 1> extends true\n ? never\n : LessThan<N, MAX_LITERAL_SIZE> extends true\n ? // The spread here is used as a form of \"Simplify\" for arrays; without\n // it our return type isn't useful.\n [...LiteralChunk<T, N>]\n : GenericChunk<T>\n : GenericChunk<T>;\n\ntype LiteralChunk<T extends IterableContainer, N extends number> =\n | ChunkRestElement<\n // Our result will always have the prefix tuple chunked the same way, so\n // we compute it once here and send it to the main logic below\n ChunkFixedTuple<TuplePrefix<T>, N>,\n TupleParts<T>[\"item\"],\n TupleParts<T>[\"suffix\"],\n N\n >\n // If both the prefix and suffix tuples are empty then our input is a simple\n // array of the form `Item[]`. This means it could also be empty, so we\n // need to add the empty output to our return type.\n | ([...TuplePrefix<T>, ...TupleParts<T>[\"suffix\"]] extends readonly []\n ? []\n : never);\n\n/**\n * This type **only** works if the input array `T` is a fixed tuple. For these\n * inputs the chunked output could be computed as literal finite tuples too.\n */\ntype ChunkFixedTuple<\n T,\n N extends number,\n // Important! Result is initialized with an empty array (and not `[[]]`)\n // because the result of `chunk` on an empty array is `[]` and not `[[]]`.\n Result = [],\n> = T extends readonly [infer Head, ...infer Rest]\n ? // We continue consuming the input tuple recursively item by item.\n ChunkFixedTuple<\n Rest,\n N,\n Result extends [\n ...infer Previous extends unknown[][],\n infer Current extends unknown[],\n ]\n ? // We take a look at the last chunk in the result, this is the\n // \"current\" chunk where new items would be added, all chunks before\n // it are already full.\n Current[\"length\"] extends N\n ? // The current chunk is full, create a new chunk and put Head in it.\n [...Previous, Current, [Head]]\n : // The current chunk is not full yet, so we add Head to it.\n [...Previous, [...Current, Head]]\n : // This would only happen on the first iteration, when result is\n // still empty. In this case we create the first chunk and put Head\n // in it.\n [[Head]]\n >\n : // We know T is a finite tuple, so the only case where we would reach this\n // is when T is empty, and in that case our results array contains the whole\n // input chunked by N.\n Result;\n\n/**\n * Here lies the main complexity of building the chunk type. It takes the prefix\n * chunks, the rest param item type, and the suffix (not chunked!) and it\n * creates all possible combinations of adding items to the prefix and suffix\n * for all possible scenarios for how many items the rest param \"represents\".\n */\ntype ChunkRestElement<\n PrefixChunks,\n Item,\n Suffix extends unknown[],\n N extends number,\n> =\n IsNever<Item> extends true\n ? // The rest param is never when there is no rest param, the whole array is\n // a finite tuple and is represented already by the prefix chunks. Suffix\n // is assumed to be empty in this case.\n PrefixChunks\n : PrefixChunks extends [\n ...infer PrefixFullChunks extends unknown[][],\n infer LastPrefixChunk extends unknown[],\n ]\n ? // When our prefix chunks are not empty it means we need to look at all\n // combinations of mixing the prefix, the suffix, and different counts\n // of the rest param until we cover all possible scenarios.\n | ValueOf<{\n // We want to iterate over all possible padding sizes we can add\n // to the last prefix chunk until we reach N\n // (`0..N-LastPrefixChunk.length`). We need to do this because\n // until the last prefix chunk is full, we need to consider the\n // suffix being part of it too...\n [Padding in IntRangeInclusive<\n 0,\n Subtract<N, LastPrefixChunk[\"length\"]>\n >]: [\n ...PrefixFullChunks,\n ...ChunkFixedTuple<\n // Create a new array that would **not** contain a rest param\n // (so it's finite) made of the last prefix chunk, padding\n // from the rest param, and the suffix.\n [...LastPrefixChunk, ...NTuple<Item, Padding>, ...Suffix],\n N\n >,\n ];\n }>\n // Additionally, we need to consider the case where the last prefix\n // chunk **is** full, and follow it with an array of chunks of the\n // rest param (and only them), and then followed by all possible\n // variations of the suffix chunks.\n | [\n ...PrefixFullChunks,\n [\n // Fully padded last prefix chunk\n ...LastPrefixChunk,\n ...NTuple<Item, Subtract<N, LastPrefixChunk[\"length\"]>>,\n ],\n ...NTuple<Item, N>[],\n ...SuffixChunk<Suffix, Item, N>,\n ]\n : // When our prefix chunks are empty we only need to handle the suffix\n [...NTuple<Item, N>[], ...SuffixChunk<Suffix, Item, N>];\n\n/**\n * This type assumes it takes a finite tuple that represents the suffix of our\n * input array. It builds all possible combinations of adding items to the\n * **head** of the suffix in order to pad the suffix until the last chunk is\n * full.\n */\ntype SuffixChunk<\n T extends unknown[],\n Item,\n N extends number,\n> = T extends readonly []\n ? // If we don't have a suffix we simply create a single chunk with all\n // possible non-empty sub-arrays of `Item` up to size `N`.\n [ValueOf<{ [K in IntRangeInclusive<1, N>]: NTuple<Item, K> }>]\n : ValueOf<{\n // When suffix isn't empty we pad the head of the suffix and compute it's\n // chunks for all possible padding sizes.\n [Padding in IntRange<0, N>]: ChunkFixedTuple<\n [...NTuple<Item, Padding>, ...T],\n N\n >;\n }>;\n\n/**\n * This is the legacy type used when we don't know what N is. We can only adjust\n * our output based on if we know for sure that the array is empty or not.\n */\ntype GenericChunk<T extends IterableContainer> = T extends\n | readonly [...unknown[], unknown]\n | readonly [unknown, ...unknown[]]\n ? NonEmptyArray<NonEmptyArray<T[number]>>\n : NonEmptyArray<T[number]>[];\n\n// TODO: Chunk was built before we handled optional elements correctly. It needs to be fixed to handle these correctly, specifically in regard to optional elements creating whole chunks that themselves need to be optional, but that their items themselves should not be optional, except the last chunk...\ntype TuplePrefix<T extends IterableContainer> = [\n ...TupleParts<T>[\"required\"],\n ...PartialArray<TupleParts<T>[\"optional\"]>,\n];\n\n/**\n * Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.\n *\n * @param array - The array.\n * @param size - The length of the chunk.\n * @signature\n * chunk(array, size)\n * @example\n * chunk(['a', 'b', 'c', 'd'], 2) // => [['a', 'b'], ['c', 'd']]\n * chunk(['a', 'b', 'c', 'd'], 3) // => [['a', 'b', 'c'], ['d']]\n * @dataFirst\n * @category Array\n */\nexport function chunk<T extends IterableContainer, N extends number>(\n array: T,\n size: N,\n): Chunk<T, N>;\n\n/**\n * Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.\n *\n * @param size - The length of the chunk.\n * @signature\n * chunk(size)(array)\n * @example\n * chunk(2)(['a', 'b', 'c', 'd']) // => [['a', 'b'], ['c', 'd']]\n * chunk(3)(['a', 'b', 'c', 'd']) // => [['a', 'b', 'c'], ['d']]\n * @dataLast\n * @category Array\n */\nexport function chunk<N extends number>(\n size: N,\n): <T extends IterableContainer>(array: T) => Chunk<T, N>;\n\nexport function chunk(...args: readonly unknown[]): unknown {\n return purry(chunkImplementation, args);\n}\n\nfunction chunkImplementation<T>(data: readonly T[], size: number): T[][] {\n if (size < 1) {\n throw new RangeError(\n `chunk: A chunk size of '${size.toString()}' would result in an infinite array`,\n );\n }\n\n if (data.length === 0) {\n return [];\n }\n\n if (size >= data.length) {\n // Optimized for when there is only one chunk.\n return [[...data]];\n }\n\n const chunks = Math.ceil(data.length / size);\n\n // eslint-disable-next-line unicorn/no-new-array -- This is OK, a sparse array allows us to handle very large arrays more efficiently.\n const result = new Array<T[]>(chunks);\n\n if (size === 1) {\n // Optimized for when we don't need slice.\n for (const [index, item] of data.entries()) {\n result[index] = [item];\n }\n } else {\n for (let index = 0; index < chunks; index += 1) {\n const start = index * size;\n result[index] = data.slice(start, start + size);\n }\n }\n\n return result;\n}\n"],"mappings":"kGAkOA,SAAgB,EAAM,GAAG,EAAmC,CAC1D,OAAOA,EAAAA,MAAM,EAAqB,EAAK,CAGzC,SAAS,EAAuB,EAAoB,EAAqB,CACvE,GAAI,EAAO,EACT,MAAU,WACR,2BAA2B,EAAK,UAAU,CAAC,qCAC5C,CAGH,GAAI,EAAK,SAAW,EAClB,MAAO,EAAE,CAGX,GAAI,GAAQ,EAAK,OAEf,MAAO,CAAC,CAAC,GAAG,EAAK,CAAC,CAGpB,IAAM,EAAS,KAAK,KAAK,EAAK,OAAS,EAAK,CAGtC,EAAa,MAAW,EAAO,CAErC,GAAI,IAAS,EAEX,IAAK,GAAM,CAAC,EAAO,KAAS,EAAK,SAAS,CACxC,EAAO,GAAS,CAAC,EAAK,MAGxB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAQ,GAAS,EAAG,CAC9C,IAAM,EAAQ,EAAQ,EACtB,EAAO,GAAS,EAAK,MAAM,EAAO,EAAQ,EAAK,CAInD,OAAO"}
|
|
1
|
+
{"version":3,"file":"chunk.cjs","names":["purry"],"sources":["../src/chunk.ts"],"sourcesContent":["import type {\n IntRange,\n IsNever,\n IsNumericLiteral,\n LessThan,\n Subtract,\n ValueOf,\n} from \"type-fest\";\nimport type { IntRangeInclusive } from \"./internal/types/IntRangeInclusive\";\nimport type { IterableContainer } from \"./internal/types/IterableContainer\";\nimport type { NTuple } from \"./internal/types/NTuple\";\nimport type { NonEmptyArray } from \"./internal/types/NonEmptyArray\";\nimport type { PartialArray } from \"./internal/types/PartialArray\";\nimport type { TupleParts } from \"./internal/types/TupleParts\";\nimport { purry } from \"./purry\";\n\n// This prevents typescript from failing on complex arrays and large chunks. It\n// allows the typing to remain useful even when very large chunks are needed,\n// without loosing fidelity on smaller ones. It was chosen by trial-and-error,\n// and given some more wiggle room because the complexity of the array also\n// plays a role in when typescript fails to recurse.\n// See the type tests for an example.\ntype MAX_LITERAL_SIZE = 350;\n\ntype Chunk<\n T extends IterableContainer,\n N extends number,\n> = T extends readonly []\n ? []\n : IsNumericLiteral<N> extends true\n ? LessThan<N, 1> extends true\n ? never\n : LessThan<N, MAX_LITERAL_SIZE> extends true\n ? // The spread here is used as a form of \"Simplify\" for arrays; without\n // it our return type isn't useful.\n [...LiteralChunk<T, N>]\n : GenericChunk<T>\n : GenericChunk<T>;\n\ntype LiteralChunk<T extends IterableContainer, N extends number> =\n | ChunkRestElement<\n // Our result will always have the prefix tuple chunked the same way, so\n // we compute it once here and send it to the main logic below\n ChunkFixedTuple<TuplePrefix<T>, N>,\n TupleParts<T>[\"item\"],\n TupleParts<T>[\"suffix\"],\n N\n >\n // If both the prefix and suffix tuples are empty then our input is a simple\n // array of the form `Item[]`. This means it could also be empty, so we\n // need to add the empty output to our return type.\n | ([...TuplePrefix<T>, ...TupleParts<T>[\"suffix\"]] extends readonly []\n ? []\n : never);\n\n/**\n * This type **only** works if the input array `T` is a fixed tuple. For these\n * inputs the chunked output could be computed as literal finite tuples too.\n */\ntype ChunkFixedTuple<\n T,\n N extends number,\n // Important! Result is initialized with an empty array (and not `[[]]`)\n // because the result of `chunk` on an empty array is `[]` and not `[[]]`.\n Result = [],\n> = T extends readonly [infer Head, ...infer Rest]\n ? // We continue consuming the input tuple recursively item by item.\n ChunkFixedTuple<\n Rest,\n N,\n Result extends [\n ...infer Previous extends unknown[][],\n infer Current extends unknown[],\n ]\n ? // We take a look at the last chunk in the result, this is the\n // \"current\" chunk where new items would be added, all chunks before\n // it are already full.\n Current[\"length\"] extends N\n ? // The current chunk is full, create a new chunk and put Head in it.\n [...Previous, Current, [Head]]\n : // The current chunk is not full yet, so we add Head to it.\n [...Previous, [...Current, Head]]\n : // This would only happen on the first iteration, when result is\n // still empty. In this case we create the first chunk and put Head\n // in it.\n [[Head]]\n >\n : // We know T is a finite tuple, so the only case where we would reach this\n // is when T is empty, and in that case our results array contains the whole\n // input chunked by N.\n Result;\n\n/**\n * Here lies the main complexity of building the chunk type. It takes the prefix\n * chunks, the rest param item type, and the suffix (not chunked!) and it\n * creates all possible combinations of adding items to the prefix and suffix\n * for all possible scenarios for how many items the rest param \"represents\".\n */\ntype ChunkRestElement<\n PrefixChunks,\n Item,\n Suffix extends unknown[],\n N extends number,\n> =\n IsNever<Item> extends true\n ? // The rest param is never when there is no rest param, the whole array is\n // a finite tuple and is represented already by the prefix chunks. Suffix\n // is assumed to be empty in this case.\n PrefixChunks\n : PrefixChunks extends [\n ...infer PrefixFullChunks extends unknown[][],\n infer LastPrefixChunk extends unknown[],\n ]\n ? // When our prefix chunks are not empty it means we need to look at all\n // combinations of mixing the prefix, the suffix, and different counts\n // of the rest param until we cover all possible scenarios.\n | ValueOf<{\n // We want to iterate over all possible padding sizes we can add\n // to the last prefix chunk until we reach N\n // (`0..N-LastPrefixChunk.length`). We need to do this because\n // until the last prefix chunk is full, we need to consider the\n // suffix being part of it too...\n [Padding in IntRangeInclusive<\n 0,\n Subtract<N, LastPrefixChunk[\"length\"]>\n >]: [\n ...PrefixFullChunks,\n ...ChunkFixedTuple<\n // Create a new array that would **not** contain a rest param\n // (so it's finite) made of the last prefix chunk, padding\n // from the rest param, and the suffix.\n [...LastPrefixChunk, ...NTuple<Item, Padding>, ...Suffix],\n N\n >,\n ];\n }>\n // Additionally, we need to consider the case where the last prefix\n // chunk **is** full, and follow it with an array of chunks of the\n // rest param (and only them), and then followed by all possible\n // variations of the suffix chunks.\n | [\n ...PrefixFullChunks,\n [\n // Fully padded last prefix chunk\n ...LastPrefixChunk,\n ...NTuple<Item, Subtract<N, LastPrefixChunk[\"length\"]>>,\n ],\n ...NTuple<Item, N>[],\n ...SuffixChunk<Suffix, Item, N>,\n ]\n : // When our prefix chunks are empty we only need to handle the suffix\n [...NTuple<Item, N>[], ...SuffixChunk<Suffix, Item, N>];\n\n/**\n * This type assumes it takes a finite tuple that represents the suffix of our\n * input array. It builds all possible combinations of adding items to the\n * **head** of the suffix in order to pad the suffix until the last chunk is\n * full.\n */\ntype SuffixChunk<\n T extends unknown[],\n Item,\n N extends number,\n> = T extends readonly []\n ? // If we don't have a suffix we simply create a single chunk with all\n // possible non-empty sub-arrays of `Item` up to size `N`.\n [ValueOf<{ [K in IntRangeInclusive<1, N>]: NTuple<Item, K> }>]\n : ValueOf<{\n // When suffix isn't empty we pad the head of the suffix and compute it's\n // chunks for all possible padding sizes.\n [Padding in IntRange<0, N>]: ChunkFixedTuple<\n [...NTuple<Item, Padding>, ...T],\n N\n >;\n }>;\n\n/**\n * This is the legacy type used when we don't know what N is. We can only adjust\n * our output based on if we know for sure that the array is empty or not.\n */\ntype GenericChunk<T extends IterableContainer> = T extends\n | readonly [...unknown[], unknown]\n | readonly [unknown, ...unknown[]]\n ? NonEmptyArray<NonEmptyArray<T[number]>>\n : NonEmptyArray<T[number]>[];\n\n// TODO: Chunk was built before we handled optional elements correctly. It needs to be fixed to handle these correctly, specifically in regard to optional elements creating whole chunks that themselves need to be optional, but that their items themselves should not be optional, except the last chunk...\ntype TuplePrefix<T extends IterableContainer> = [\n ...TupleParts<T>[\"required\"],\n ...PartialArray<TupleParts<T>[\"optional\"]>,\n];\n\n/**\n * Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.\n *\n * @param array - The array.\n * @param size - The length of the chunk.\n * @signature\n * chunk(array, size)\n * @example\n * chunk(['a', 'b', 'c', 'd'], 2) // => [['a', 'b'], ['c', 'd']]\n * chunk(['a', 'b', 'c', 'd'], 3) // => [['a', 'b', 'c'], ['d']]\n * @dataFirst\n * @category Array\n */\nexport function chunk<T extends IterableContainer, N extends number>(\n array: T,\n size: N,\n): Chunk<T, N>;\n\n/**\n * Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.\n *\n * @param size - The length of the chunk.\n * @signature\n * chunk(size)(array)\n * @example\n * chunk(2)(['a', 'b', 'c', 'd']) // => [['a', 'b'], ['c', 'd']]\n * chunk(3)(['a', 'b', 'c', 'd']) // => [['a', 'b', 'c'], ['d']]\n * @dataLast\n * @category Array\n */\nexport function chunk<N extends number>(\n size: N,\n): <T extends IterableContainer>(array: T) => Chunk<T, N>;\n\nexport function chunk(...args: readonly unknown[]): unknown {\n return purry(chunkImplementation, args);\n}\n\nfunction chunkImplementation<T>(data: readonly T[], size: number): T[][] {\n if (size < 1) {\n throw new RangeError(\n `chunk: A chunk size of '${size.toString()}' would result in an infinite array`,\n );\n }\n\n if (data.length === 0) {\n return [];\n }\n\n if (size >= data.length) {\n // Optimized for when there is only one chunk.\n return [[...data]];\n }\n\n const chunks = Math.ceil(data.length / size);\n\n // eslint-disable-next-line unicorn/no-new-array -- This is OK, a sparse array allows us to handle very large arrays more efficiently.\n const result = new Array<T[]>(chunks);\n\n if (size === 1) {\n // Optimized for when we don't need slice.\n for (const [index, item] of data.entries()) {\n result[index] = [item];\n }\n } else {\n for (let index = 0; index < chunks; index += 1) {\n const start = index * size;\n result[index] = data.slice(start, start + size);\n }\n }\n\n return result;\n}\n"],"mappings":"kGAkOA,SAAgB,EAAM,GAAG,EAAmC,CAC1D,OAAOA,EAAAA,MAAM,EAAqB,CAAI,CACxC,CAEA,SAAS,EAAuB,EAAoB,EAAqB,CACvE,GAAI,EAAO,EACT,MAAU,WACR,2BAA2B,EAAK,SAAS,EAAE,oCAC7C,EAGF,GAAI,EAAK,SAAW,EAClB,MAAO,CAAC,EAGV,GAAI,GAAQ,EAAK,OAEf,MAAO,CAAC,CAAC,GAAG,CAAI,CAAC,EAGnB,IAAM,EAAS,KAAK,KAAK,EAAK,OAAS,CAAI,EAGrC,EAAa,MAAW,CAAM,EAEpC,GAAI,IAAS,EAEX,IAAK,GAAM,CAAC,EAAO,KAAS,EAAK,QAAQ,EACvC,EAAO,GAAS,CAAC,CAAI,OAGvB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAQ,GAAS,EAAG,CAC9C,IAAM,EAAQ,EAAQ,EACtB,EAAO,GAAS,EAAK,MAAM,EAAO,EAAQ,CAAI,CAChD,CAGF,OAAO,CACT"}
|
package/dist/chunk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.js","names":[],"sources":["../src/chunk.ts"],"sourcesContent":["import type {\n IntRange,\n IsNever,\n IsNumericLiteral,\n LessThan,\n Subtract,\n ValueOf,\n} from \"type-fest\";\nimport type { IntRangeInclusive } from \"./internal/types/IntRangeInclusive\";\nimport type { IterableContainer } from \"./internal/types/IterableContainer\";\nimport type { NTuple } from \"./internal/types/NTuple\";\nimport type { NonEmptyArray } from \"./internal/types/NonEmptyArray\";\nimport type { PartialArray } from \"./internal/types/PartialArray\";\nimport type { TupleParts } from \"./internal/types/TupleParts\";\nimport { purry } from \"./purry\";\n\n// This prevents typescript from failing on complex arrays and large chunks. It\n// allows the typing to remain useful even when very large chunks are needed,\n// without loosing fidelity on smaller ones. It was chosen by trial-and-error,\n// and given some more wiggle room because the complexity of the array also\n// plays a role in when typescript fails to recurse.\n// See the type tests for an example.\ntype MAX_LITERAL_SIZE = 350;\n\ntype Chunk<\n T extends IterableContainer,\n N extends number,\n> = T extends readonly []\n ? []\n : IsNumericLiteral<N> extends true\n ? LessThan<N, 1> extends true\n ? never\n : LessThan<N, MAX_LITERAL_SIZE> extends true\n ? // The spread here is used as a form of \"Simplify\" for arrays; without\n // it our return type isn't useful.\n [...LiteralChunk<T, N>]\n : GenericChunk<T>\n : GenericChunk<T>;\n\ntype LiteralChunk<T extends IterableContainer, N extends number> =\n | ChunkRestElement<\n // Our result will always have the prefix tuple chunked the same way, so\n // we compute it once here and send it to the main logic below\n ChunkFixedTuple<TuplePrefix<T>, N>,\n TupleParts<T>[\"item\"],\n TupleParts<T>[\"suffix\"],\n N\n >\n // If both the prefix and suffix tuples are empty then our input is a simple\n // array of the form `Item[]`. This means it could also be empty, so we\n // need to add the empty output to our return type.\n | ([...TuplePrefix<T>, ...TupleParts<T>[\"suffix\"]] extends readonly []\n ? []\n : never);\n\n/**\n * This type **only** works if the input array `T` is a fixed tuple. For these\n * inputs the chunked output could be computed as literal finite tuples too.\n */\ntype ChunkFixedTuple<\n T,\n N extends number,\n // Important! Result is initialized with an empty array (and not `[[]]`)\n // because the result of `chunk` on an empty array is `[]` and not `[[]]`.\n Result = [],\n> = T extends readonly [infer Head, ...infer Rest]\n ? // We continue consuming the input tuple recursively item by item.\n ChunkFixedTuple<\n Rest,\n N,\n Result extends [\n ...infer Previous extends unknown[][],\n infer Current extends unknown[],\n ]\n ? // We take a look at the last chunk in the result, this is the\n // \"current\" chunk where new items would be added, all chunks before\n // it are already full.\n Current[\"length\"] extends N\n ? // The current chunk is full, create a new chunk and put Head in it.\n [...Previous, Current, [Head]]\n : // The current chunk is not full yet, so we add Head to it.\n [...Previous, [...Current, Head]]\n : // This would only happen on the first iteration, when result is\n // still empty. In this case we create the first chunk and put Head\n // in it.\n [[Head]]\n >\n : // We know T is a finite tuple, so the only case where we would reach this\n // is when T is empty, and in that case our results array contains the whole\n // input chunked by N.\n Result;\n\n/**\n * Here lies the main complexity of building the chunk type. It takes the prefix\n * chunks, the rest param item type, and the suffix (not chunked!) and it\n * creates all possible combinations of adding items to the prefix and suffix\n * for all possible scenarios for how many items the rest param \"represents\".\n */\ntype ChunkRestElement<\n PrefixChunks,\n Item,\n Suffix extends unknown[],\n N extends number,\n> =\n IsNever<Item> extends true\n ? // The rest param is never when there is no rest param, the whole array is\n // a finite tuple and is represented already by the prefix chunks. Suffix\n // is assumed to be empty in this case.\n PrefixChunks\n : PrefixChunks extends [\n ...infer PrefixFullChunks extends unknown[][],\n infer LastPrefixChunk extends unknown[],\n ]\n ? // When our prefix chunks are not empty it means we need to look at all\n // combinations of mixing the prefix, the suffix, and different counts\n // of the rest param until we cover all possible scenarios.\n | ValueOf<{\n // We want to iterate over all possible padding sizes we can add\n // to the last prefix chunk until we reach N\n // (`0..N-LastPrefixChunk.length`). We need to do this because\n // until the last prefix chunk is full, we need to consider the\n // suffix being part of it too...\n [Padding in IntRangeInclusive<\n 0,\n Subtract<N, LastPrefixChunk[\"length\"]>\n >]: [\n ...PrefixFullChunks,\n ...ChunkFixedTuple<\n // Create a new array that would **not** contain a rest param\n // (so it's finite) made of the last prefix chunk, padding\n // from the rest param, and the suffix.\n [...LastPrefixChunk, ...NTuple<Item, Padding>, ...Suffix],\n N\n >,\n ];\n }>\n // Additionally, we need to consider the case where the last prefix\n // chunk **is** full, and follow it with an array of chunks of the\n // rest param (and only them), and then followed by all possible\n // variations of the suffix chunks.\n | [\n ...PrefixFullChunks,\n [\n // Fully padded last prefix chunk\n ...LastPrefixChunk,\n ...NTuple<Item, Subtract<N, LastPrefixChunk[\"length\"]>>,\n ],\n ...NTuple<Item, N>[],\n ...SuffixChunk<Suffix, Item, N>,\n ]\n : // When our prefix chunks are empty we only need to handle the suffix\n [...NTuple<Item, N>[], ...SuffixChunk<Suffix, Item, N>];\n\n/**\n * This type assumes it takes a finite tuple that represents the suffix of our\n * input array. It builds all possible combinations of adding items to the\n * **head** of the suffix in order to pad the suffix until the last chunk is\n * full.\n */\ntype SuffixChunk<\n T extends unknown[],\n Item,\n N extends number,\n> = T extends readonly []\n ? // If we don't have a suffix we simply create a single chunk with all\n // possible non-empty sub-arrays of `Item` up to size `N`.\n [ValueOf<{ [K in IntRangeInclusive<1, N>]: NTuple<Item, K> }>]\n : ValueOf<{\n // When suffix isn't empty we pad the head of the suffix and compute it's\n // chunks for all possible padding sizes.\n [Padding in IntRange<0, N>]: ChunkFixedTuple<\n [...NTuple<Item, Padding>, ...T],\n N\n >;\n }>;\n\n/**\n * This is the legacy type used when we don't know what N is. We can only adjust\n * our output based on if we know for sure that the array is empty or not.\n */\ntype GenericChunk<T extends IterableContainer> = T extends\n | readonly [...unknown[], unknown]\n | readonly [unknown, ...unknown[]]\n ? NonEmptyArray<NonEmptyArray<T[number]>>\n : NonEmptyArray<T[number]>[];\n\n// TODO: Chunk was built before we handled optional elements correctly. It needs to be fixed to handle these correctly, specifically in regard to optional elements creating whole chunks that themselves need to be optional, but that their items themselves should not be optional, except the last chunk...\ntype TuplePrefix<T extends IterableContainer> = [\n ...TupleParts<T>[\"required\"],\n ...PartialArray<TupleParts<T>[\"optional\"]>,\n];\n\n/**\n * Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.\n *\n * @param array - The array.\n * @param size - The length of the chunk.\n * @signature\n * chunk(array, size)\n * @example\n * chunk(['a', 'b', 'c', 'd'], 2) // => [['a', 'b'], ['c', 'd']]\n * chunk(['a', 'b', 'c', 'd'], 3) // => [['a', 'b', 'c'], ['d']]\n * @dataFirst\n * @category Array\n */\nexport function chunk<T extends IterableContainer, N extends number>(\n array: T,\n size: N,\n): Chunk<T, N>;\n\n/**\n * Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.\n *\n * @param size - The length of the chunk.\n * @signature\n * chunk(size)(array)\n * @example\n * chunk(2)(['a', 'b', 'c', 'd']) // => [['a', 'b'], ['c', 'd']]\n * chunk(3)(['a', 'b', 'c', 'd']) // => [['a', 'b', 'c'], ['d']]\n * @dataLast\n * @category Array\n */\nexport function chunk<N extends number>(\n size: N,\n): <T extends IterableContainer>(array: T) => Chunk<T, N>;\n\nexport function chunk(...args: readonly unknown[]): unknown {\n return purry(chunkImplementation, args);\n}\n\nfunction chunkImplementation<T>(data: readonly T[], size: number): T[][] {\n if (size < 1) {\n throw new RangeError(\n `chunk: A chunk size of '${size.toString()}' would result in an infinite array`,\n );\n }\n\n if (data.length === 0) {\n return [];\n }\n\n if (size >= data.length) {\n // Optimized for when there is only one chunk.\n return [[...data]];\n }\n\n const chunks = Math.ceil(data.length / size);\n\n // eslint-disable-next-line unicorn/no-new-array -- This is OK, a sparse array allows us to handle very large arrays more efficiently.\n const result = new Array<T[]>(chunks);\n\n if (size === 1) {\n // Optimized for when we don't need slice.\n for (const [index, item] of data.entries()) {\n result[index] = [item];\n }\n } else {\n for (let index = 0; index < chunks; index += 1) {\n const start = index * size;\n result[index] = data.slice(start, start + size);\n }\n }\n\n return result;\n}\n"],"mappings":"mCAkOA,SAAgB,EAAM,GAAG,EAAmC,CAC1D,OAAO,EAAM,EAAqB,EAAK,CAGzC,SAAS,EAAuB,EAAoB,EAAqB,CACvE,GAAI,EAAO,EACT,MAAU,WACR,2BAA2B,EAAK,UAAU,CAAC,qCAC5C,CAGH,GAAI,EAAK,SAAW,EAClB,MAAO,EAAE,CAGX,GAAI,GAAQ,EAAK,OAEf,MAAO,CAAC,CAAC,GAAG,EAAK,CAAC,CAGpB,IAAM,EAAS,KAAK,KAAK,EAAK,OAAS,EAAK,CAGtC,EAAa,MAAW,EAAO,CAErC,GAAI,IAAS,EAEX,IAAK,GAAM,CAAC,EAAO,KAAS,EAAK,SAAS,CACxC,EAAO,GAAS,CAAC,EAAK,MAGxB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAQ,GAAS,EAAG,CAC9C,IAAM,EAAQ,EAAQ,EACtB,EAAO,GAAS,EAAK,MAAM,EAAO,EAAQ,EAAK,CAInD,OAAO"}
|
|
1
|
+
{"version":3,"file":"chunk.js","names":[],"sources":["../src/chunk.ts"],"sourcesContent":["import type {\n IntRange,\n IsNever,\n IsNumericLiteral,\n LessThan,\n Subtract,\n ValueOf,\n} from \"type-fest\";\nimport type { IntRangeInclusive } from \"./internal/types/IntRangeInclusive\";\nimport type { IterableContainer } from \"./internal/types/IterableContainer\";\nimport type { NTuple } from \"./internal/types/NTuple\";\nimport type { NonEmptyArray } from \"./internal/types/NonEmptyArray\";\nimport type { PartialArray } from \"./internal/types/PartialArray\";\nimport type { TupleParts } from \"./internal/types/TupleParts\";\nimport { purry } from \"./purry\";\n\n// This prevents typescript from failing on complex arrays and large chunks. It\n// allows the typing to remain useful even when very large chunks are needed,\n// without loosing fidelity on smaller ones. It was chosen by trial-and-error,\n// and given some more wiggle room because the complexity of the array also\n// plays a role in when typescript fails to recurse.\n// See the type tests for an example.\ntype MAX_LITERAL_SIZE = 350;\n\ntype Chunk<\n T extends IterableContainer,\n N extends number,\n> = T extends readonly []\n ? []\n : IsNumericLiteral<N> extends true\n ? LessThan<N, 1> extends true\n ? never\n : LessThan<N, MAX_LITERAL_SIZE> extends true\n ? // The spread here is used as a form of \"Simplify\" for arrays; without\n // it our return type isn't useful.\n [...LiteralChunk<T, N>]\n : GenericChunk<T>\n : GenericChunk<T>;\n\ntype LiteralChunk<T extends IterableContainer, N extends number> =\n | ChunkRestElement<\n // Our result will always have the prefix tuple chunked the same way, so\n // we compute it once here and send it to the main logic below\n ChunkFixedTuple<TuplePrefix<T>, N>,\n TupleParts<T>[\"item\"],\n TupleParts<T>[\"suffix\"],\n N\n >\n // If both the prefix and suffix tuples are empty then our input is a simple\n // array of the form `Item[]`. This means it could also be empty, so we\n // need to add the empty output to our return type.\n | ([...TuplePrefix<T>, ...TupleParts<T>[\"suffix\"]] extends readonly []\n ? []\n : never);\n\n/**\n * This type **only** works if the input array `T` is a fixed tuple. For these\n * inputs the chunked output could be computed as literal finite tuples too.\n */\ntype ChunkFixedTuple<\n T,\n N extends number,\n // Important! Result is initialized with an empty array (and not `[[]]`)\n // because the result of `chunk` on an empty array is `[]` and not `[[]]`.\n Result = [],\n> = T extends readonly [infer Head, ...infer Rest]\n ? // We continue consuming the input tuple recursively item by item.\n ChunkFixedTuple<\n Rest,\n N,\n Result extends [\n ...infer Previous extends unknown[][],\n infer Current extends unknown[],\n ]\n ? // We take a look at the last chunk in the result, this is the\n // \"current\" chunk where new items would be added, all chunks before\n // it are already full.\n Current[\"length\"] extends N\n ? // The current chunk is full, create a new chunk and put Head in it.\n [...Previous, Current, [Head]]\n : // The current chunk is not full yet, so we add Head to it.\n [...Previous, [...Current, Head]]\n : // This would only happen on the first iteration, when result is\n // still empty. In this case we create the first chunk and put Head\n // in it.\n [[Head]]\n >\n : // We know T is a finite tuple, so the only case where we would reach this\n // is when T is empty, and in that case our results array contains the whole\n // input chunked by N.\n Result;\n\n/**\n * Here lies the main complexity of building the chunk type. It takes the prefix\n * chunks, the rest param item type, and the suffix (not chunked!) and it\n * creates all possible combinations of adding items to the prefix and suffix\n * for all possible scenarios for how many items the rest param \"represents\".\n */\ntype ChunkRestElement<\n PrefixChunks,\n Item,\n Suffix extends unknown[],\n N extends number,\n> =\n IsNever<Item> extends true\n ? // The rest param is never when there is no rest param, the whole array is\n // a finite tuple and is represented already by the prefix chunks. Suffix\n // is assumed to be empty in this case.\n PrefixChunks\n : PrefixChunks extends [\n ...infer PrefixFullChunks extends unknown[][],\n infer LastPrefixChunk extends unknown[],\n ]\n ? // When our prefix chunks are not empty it means we need to look at all\n // combinations of mixing the prefix, the suffix, and different counts\n // of the rest param until we cover all possible scenarios.\n | ValueOf<{\n // We want to iterate over all possible padding sizes we can add\n // to the last prefix chunk until we reach N\n // (`0..N-LastPrefixChunk.length`). We need to do this because\n // until the last prefix chunk is full, we need to consider the\n // suffix being part of it too...\n [Padding in IntRangeInclusive<\n 0,\n Subtract<N, LastPrefixChunk[\"length\"]>\n >]: [\n ...PrefixFullChunks,\n ...ChunkFixedTuple<\n // Create a new array that would **not** contain a rest param\n // (so it's finite) made of the last prefix chunk, padding\n // from the rest param, and the suffix.\n [...LastPrefixChunk, ...NTuple<Item, Padding>, ...Suffix],\n N\n >,\n ];\n }>\n // Additionally, we need to consider the case where the last prefix\n // chunk **is** full, and follow it with an array of chunks of the\n // rest param (and only them), and then followed by all possible\n // variations of the suffix chunks.\n | [\n ...PrefixFullChunks,\n [\n // Fully padded last prefix chunk\n ...LastPrefixChunk,\n ...NTuple<Item, Subtract<N, LastPrefixChunk[\"length\"]>>,\n ],\n ...NTuple<Item, N>[],\n ...SuffixChunk<Suffix, Item, N>,\n ]\n : // When our prefix chunks are empty we only need to handle the suffix\n [...NTuple<Item, N>[], ...SuffixChunk<Suffix, Item, N>];\n\n/**\n * This type assumes it takes a finite tuple that represents the suffix of our\n * input array. It builds all possible combinations of adding items to the\n * **head** of the suffix in order to pad the suffix until the last chunk is\n * full.\n */\ntype SuffixChunk<\n T extends unknown[],\n Item,\n N extends number,\n> = T extends readonly []\n ? // If we don't have a suffix we simply create a single chunk with all\n // possible non-empty sub-arrays of `Item` up to size `N`.\n [ValueOf<{ [K in IntRangeInclusive<1, N>]: NTuple<Item, K> }>]\n : ValueOf<{\n // When suffix isn't empty we pad the head of the suffix and compute it's\n // chunks for all possible padding sizes.\n [Padding in IntRange<0, N>]: ChunkFixedTuple<\n [...NTuple<Item, Padding>, ...T],\n N\n >;\n }>;\n\n/**\n * This is the legacy type used when we don't know what N is. We can only adjust\n * our output based on if we know for sure that the array is empty or not.\n */\ntype GenericChunk<T extends IterableContainer> = T extends\n | readonly [...unknown[], unknown]\n | readonly [unknown, ...unknown[]]\n ? NonEmptyArray<NonEmptyArray<T[number]>>\n : NonEmptyArray<T[number]>[];\n\n// TODO: Chunk was built before we handled optional elements correctly. It needs to be fixed to handle these correctly, specifically in regard to optional elements creating whole chunks that themselves need to be optional, but that their items themselves should not be optional, except the last chunk...\ntype TuplePrefix<T extends IterableContainer> = [\n ...TupleParts<T>[\"required\"],\n ...PartialArray<TupleParts<T>[\"optional\"]>,\n];\n\n/**\n * Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.\n *\n * @param array - The array.\n * @param size - The length of the chunk.\n * @signature\n * chunk(array, size)\n * @example\n * chunk(['a', 'b', 'c', 'd'], 2) // => [['a', 'b'], ['c', 'd']]\n * chunk(['a', 'b', 'c', 'd'], 3) // => [['a', 'b', 'c'], ['d']]\n * @dataFirst\n * @category Array\n */\nexport function chunk<T extends IterableContainer, N extends number>(\n array: T,\n size: N,\n): Chunk<T, N>;\n\n/**\n * Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.\n *\n * @param size - The length of the chunk.\n * @signature\n * chunk(size)(array)\n * @example\n * chunk(2)(['a', 'b', 'c', 'd']) // => [['a', 'b'], ['c', 'd']]\n * chunk(3)(['a', 'b', 'c', 'd']) // => [['a', 'b', 'c'], ['d']]\n * @dataLast\n * @category Array\n */\nexport function chunk<N extends number>(\n size: N,\n): <T extends IterableContainer>(array: T) => Chunk<T, N>;\n\nexport function chunk(...args: readonly unknown[]): unknown {\n return purry(chunkImplementation, args);\n}\n\nfunction chunkImplementation<T>(data: readonly T[], size: number): T[][] {\n if (size < 1) {\n throw new RangeError(\n `chunk: A chunk size of '${size.toString()}' would result in an infinite array`,\n );\n }\n\n if (data.length === 0) {\n return [];\n }\n\n if (size >= data.length) {\n // Optimized for when there is only one chunk.\n return [[...data]];\n }\n\n const chunks = Math.ceil(data.length / size);\n\n // eslint-disable-next-line unicorn/no-new-array -- This is OK, a sparse array allows us to handle very large arrays more efficiently.\n const result = new Array<T[]>(chunks);\n\n if (size === 1) {\n // Optimized for when we don't need slice.\n for (const [index, item] of data.entries()) {\n result[index] = [item];\n }\n } else {\n for (let index = 0; index < chunks; index += 1) {\n const start = index * size;\n result[index] = data.slice(start, start + size);\n }\n }\n\n return result;\n}\n"],"mappings":"mCAkOA,SAAgB,EAAM,GAAG,EAAmC,CAC1D,OAAO,EAAM,EAAqB,CAAI,CACxC,CAEA,SAAS,EAAuB,EAAoB,EAAqB,CACvE,GAAI,EAAO,EACT,MAAU,WACR,2BAA2B,EAAK,SAAS,EAAE,oCAC7C,EAGF,GAAI,EAAK,SAAW,EAClB,MAAO,CAAC,EAGV,GAAI,GAAQ,EAAK,OAEf,MAAO,CAAC,CAAC,GAAG,CAAI,CAAC,EAGnB,IAAM,EAAS,KAAK,KAAK,EAAK,OAAS,CAAI,EAGrC,EAAa,MAAW,CAAM,EAEpC,GAAI,IAAS,EAEX,IAAK,GAAM,CAAC,EAAO,KAAS,EAAK,QAAQ,EACvC,EAAO,GAAS,CAAC,CAAI,OAGvB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAQ,GAAS,EAAG,CAC9C,IAAM,EAAQ,EAAQ,EACtB,EAAO,GAAS,EAAK,MAAM,EAAO,EAAQ,CAAI,CAChD,CAGF,OAAO,CACT"}
|
package/dist/clamp.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purry.cjs");function t(...t){return e.purry(n,t)}const n=(e,{min:t,max:n})=>t!==void 0&&e<t?t:n!==void 0&&e>n?n:e;exports.clamp=t;
|
|
2
2
|
//# sourceMappingURL=clamp.cjs.map
|
package/dist/clamp.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clamp.cjs","names":["purry"],"sources":["../src/clamp.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\ntype Limits = {\n readonly min?: number;\n readonly max?: number;\n};\n\n/**\n * Clamp the given value within the inclusive min and max bounds.\n *\n * @param value - The number.\n * @param limits - The bounds limits.\n * @signature\n * clamp(value, { min, max });\n * @example\n * clamp(10, { min: 20 }) // => 20\n * clamp(10, { max: 5 }) // => 5\n * clamp(10, { max: 20, min: 5 }) // => 10\n * @dataFirst\n * @category Number\n */\nexport function clamp(value: number, limits: Limits): number;\n\n/**\n * Clamp the given value within the inclusive min and max bounds.\n *\n * @param limits - The bounds limits.\n * @signature\n * clamp({ min, max })(value);\n * @example\n * clamp({ min: 20 })(10) // => 20\n * clamp({ max: 5 })(10) // => 5\n * clamp({ max: 20, min: 5 })(10) // => 10\n * @dataLast\n * @category Number\n */\nexport function clamp(limits: Limits): (value: number) => number;\n\nexport function clamp(...args: readonly unknown[]): unknown {\n return purry(clampImplementation, args);\n}\n\nconst clampImplementation = (value: number, { min, max }: Limits): number =>\n min !== undefined && value < min\n ? min\n : max !== undefined && value > max\n ? max\n : value;\n"],"mappings":"kGAsCA,SAAgB,EAAM,GAAG,EAAmC,CAC1D,OAAOA,EAAAA,MAAM,EAAqB,
|
|
1
|
+
{"version":3,"file":"clamp.cjs","names":["purry"],"sources":["../src/clamp.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\ntype Limits = {\n readonly min?: number;\n readonly max?: number;\n};\n\n/**\n * Clamp the given value within the inclusive min and max bounds.\n *\n * @param value - The number.\n * @param limits - The bounds limits.\n * @signature\n * clamp(value, { min, max });\n * @example\n * clamp(10, { min: 20 }) // => 20\n * clamp(10, { max: 5 }) // => 5\n * clamp(10, { max: 20, min: 5 }) // => 10\n * @dataFirst\n * @category Number\n */\nexport function clamp(value: number, limits: Limits): number;\n\n/**\n * Clamp the given value within the inclusive min and max bounds.\n *\n * @param limits - The bounds limits.\n * @signature\n * clamp({ min, max })(value);\n * @example\n * clamp({ min: 20 })(10) // => 20\n * clamp({ max: 5 })(10) // => 5\n * clamp({ max: 20, min: 5 })(10) // => 10\n * @dataLast\n * @category Number\n */\nexport function clamp(limits: Limits): (value: number) => number;\n\nexport function clamp(...args: readonly unknown[]): unknown {\n return purry(clampImplementation, args);\n}\n\nconst clampImplementation = (value: number, { min, max }: Limits): number =>\n min !== undefined && value < min\n ? min\n : max !== undefined && value > max\n ? max\n : value;\n"],"mappings":"kGAsCA,SAAgB,EAAM,GAAG,EAAmC,CAC1D,OAAOA,EAAAA,MAAM,EAAqB,CAAI,CACxC,CAEA,MAAM,GAAuB,EAAe,CAAE,MAAK,SACjD,IAAQ,IAAA,IAAa,EAAQ,EACzB,EACA,IAAQ,IAAA,IAAa,EAAQ,EAC3B,EACA"}
|
package/dist/clamp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clamp.js","names":[],"sources":["../src/clamp.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\ntype Limits = {\n readonly min?: number;\n readonly max?: number;\n};\n\n/**\n * Clamp the given value within the inclusive min and max bounds.\n *\n * @param value - The number.\n * @param limits - The bounds limits.\n * @signature\n * clamp(value, { min, max });\n * @example\n * clamp(10, { min: 20 }) // => 20\n * clamp(10, { max: 5 }) // => 5\n * clamp(10, { max: 20, min: 5 }) // => 10\n * @dataFirst\n * @category Number\n */\nexport function clamp(value: number, limits: Limits): number;\n\n/**\n * Clamp the given value within the inclusive min and max bounds.\n *\n * @param limits - The bounds limits.\n * @signature\n * clamp({ min, max })(value);\n * @example\n * clamp({ min: 20 })(10) // => 20\n * clamp({ max: 5 })(10) // => 5\n * clamp({ max: 20, min: 5 })(10) // => 10\n * @dataLast\n * @category Number\n */\nexport function clamp(limits: Limits): (value: number) => number;\n\nexport function clamp(...args: readonly unknown[]): unknown {\n return purry(clampImplementation, args);\n}\n\nconst clampImplementation = (value: number, { min, max }: Limits): number =>\n min !== undefined && value < min\n ? min\n : max !== undefined && value > max\n ? max\n : value;\n"],"mappings":"mCAsCA,SAAgB,EAAM,GAAG,EAAmC,CAC1D,OAAO,EAAM,EAAqB,
|
|
1
|
+
{"version":3,"file":"clamp.js","names":[],"sources":["../src/clamp.ts"],"sourcesContent":["import { purry } from \"./purry\";\n\ntype Limits = {\n readonly min?: number;\n readonly max?: number;\n};\n\n/**\n * Clamp the given value within the inclusive min and max bounds.\n *\n * @param value - The number.\n * @param limits - The bounds limits.\n * @signature\n * clamp(value, { min, max });\n * @example\n * clamp(10, { min: 20 }) // => 20\n * clamp(10, { max: 5 }) // => 5\n * clamp(10, { max: 20, min: 5 }) // => 10\n * @dataFirst\n * @category Number\n */\nexport function clamp(value: number, limits: Limits): number;\n\n/**\n * Clamp the given value within the inclusive min and max bounds.\n *\n * @param limits - The bounds limits.\n * @signature\n * clamp({ min, max })(value);\n * @example\n * clamp({ min: 20 })(10) // => 20\n * clamp({ max: 5 })(10) // => 5\n * clamp({ max: 20, min: 5 })(10) // => 10\n * @dataLast\n * @category Number\n */\nexport function clamp(limits: Limits): (value: number) => number;\n\nexport function clamp(...args: readonly unknown[]): unknown {\n return purry(clampImplementation, args);\n}\n\nconst clampImplementation = (value: number, { min, max }: Limits): number =>\n min !== undefined && value < min\n ? min\n : max !== undefined && value > max\n ? max\n : value;\n"],"mappings":"mCAsCA,SAAgB,EAAM,GAAG,EAAmC,CAC1D,OAAO,EAAM,EAAqB,CAAI,CACxC,CAEA,MAAM,GAAuB,EAAe,CAAE,MAAK,SACjD,IAAQ,IAAA,IAAa,EAAQ,EACzB,EACA,IAAQ,IAAA,IAAa,EAAQ,EAC3B,EACA"}
|
package/dist/clone.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purry.cjs");function t(...t){return e.purry(n,t)}function n(e,t=[],n=[]){if(typeof e==`function`)return e;if(typeof e!=`object`||!e)return structuredClone(e);let a=Object.getPrototypeOf(e);if(a!==null&&a!==Object.prototype&&!Array.isArray(e))return structuredClone(e);let o=t.indexOf(e);return o===-1?(t.push(e),Array.isArray(e)?i(e,t,n):r(e,t,n)):n[o]}function r(e,t,r){let i={};r.push(i);for(let[a,o]of Object.entries(e))i[a]=n(o,t,r);return i}function i(e,t,r){let i=[];r.push(i);for(let[a,o]of e.entries())i[a]=n(o,t,r);return i}exports.clone=t;
|
|
2
2
|
//# sourceMappingURL=clone.cjs.map
|
package/dist/clone.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clone.cjs","names":["purry"],"sources":["../src/clone.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types --\n * The state needed to compute the clone is passed by reference via mutable\n * arrays.\n */\n\nimport { purry } from \"./purry\";\n\n/**\n * Creates a deep copy of the value. Supported types: [plain objects](#isPlainObject),\n * `Array`, `number`, `string`, `boolean`, `Date`, and `RegExp`. Functions are\n * assigned by reference rather than copied. Class instances or any other\n * built-in type that isn't mentioned above are not supported (but might\n * work).\n *\n * @param data - The object to clone.\n * @signature\n * clone(data)\n * @example\n * clone({foo: 'bar'}) // {foo: 'bar'}\n * @dataFirst\n * @category Object\n */\nexport function clone<T>(data: T): T;\n\n/**\n * Creates a deep copy of the value. Supported types: [plain objects](#isPlainObject),\n * `Array`, `number`, `string`, `boolean`, `Date`, and `RegExp`. Functions are\n * assigned by reference rather than copied. Class instances or any other\n * built-in type that isn't mentioned above are not supported (but might\n * work).\n *\n * @signature\n * clone()(data)\n * @example\n * pipe({foo: 'bar'}, clone()) // {foo: 'bar'}\n * @dataLast\n * @category Object\n */\nexport function clone(): <T>(data: T) => T;\n\nexport function clone(...args: readonly unknown[]): unknown {\n return purry(cloneImplementation, args);\n}\n\nfunction cloneImplementation<T>(\n value: T,\n refFrom: unknown[] = [],\n refTo: unknown[] = [],\n): T {\n if (typeof value === \"function\") {\n // Functions aren't cloned, we return the same instance.\n return value;\n }\n\n if (typeof value !== \"object\" || value === null) {\n // Only objects are interesting when cloning, everything else can use\n // whatever JS does by default.\n return structuredClone(value);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const prototype = Object.getPrototypeOf(value);\n if (\n
|
|
1
|
+
{"version":3,"file":"clone.cjs","names":["purry"],"sources":["../src/clone.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types --\n * The state needed to compute the clone is passed by reference via mutable\n * arrays.\n */\n\nimport { purry } from \"./purry\";\n\n/**\n * Creates a deep copy of the value. Supported types: [plain objects](#isPlainObject),\n * `Array`, `number`, `string`, `boolean`, `Date`, and `RegExp`. Functions are\n * assigned by reference rather than copied. Class instances or any other\n * built-in type that isn't mentioned above are not supported (but might\n * work).\n *\n * @param data - The object to clone.\n * @signature\n * clone(data)\n * @example\n * clone({foo: 'bar'}) // {foo: 'bar'}\n * @dataFirst\n * @category Object\n */\nexport function clone<T>(data: T): T;\n\n/**\n * Creates a deep copy of the value. Supported types: [plain objects](#isPlainObject),\n * `Array`, `number`, `string`, `boolean`, `Date`, and `RegExp`. Functions are\n * assigned by reference rather than copied. Class instances or any other\n * built-in type that isn't mentioned above are not supported (but might\n * work).\n *\n * @signature\n * clone()(data)\n * @example\n * pipe({foo: 'bar'}, clone()) // {foo: 'bar'}\n * @dataLast\n * @category Object\n */\nexport function clone(): <T>(data: T) => T;\n\nexport function clone(...args: readonly unknown[]): unknown {\n return purry(cloneImplementation, args);\n}\n\nfunction cloneImplementation<T>(\n value: T,\n refFrom: unknown[] = [],\n refTo: unknown[] = [],\n): T {\n if (typeof value === \"function\") {\n // Functions aren't cloned, we return the same instance.\n return value;\n }\n\n if (typeof value !== \"object\" || value === null) {\n // Only objects are interesting when cloning, everything else can use\n // whatever JS does by default.\n return structuredClone(value);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const prototype = Object.getPrototypeOf(value);\n if (\n // Keep this check in sync with the same check in the impl of\n // `isPlainObject`.\n prototype !== null &&\n prototype !== Object.prototype &&\n !Array.isArray(value)\n ) {\n // Our cloning logic is only designed for plain objects and arrays; other\n // object types (like `Date`, `RegExp`, `File`, and user-defined classes)\n // wouldn't clone properly. We fallback to the native cloning for them.\n return structuredClone(value);\n }\n\n // In order to support cyclic/self-referential structures, and to support\n // functions _within_ objects, we need to have our own cloning logic.\n\n // First we check if we've already cloned this value.\n const idx = refFrom.indexOf(value);\n if (idx !== -1) {\n return refTo[idx] as T;\n }\n // And if we haven't, we add it to our list of seen values so that it is kept\n // and clone the deep structure.\n refFrom.push(value);\n return Array.isArray(value)\n ? deepCloneArray(value, refFrom, refTo)\n : deepCloneObject(value, refFrom, refTo);\n}\n\nfunction deepCloneObject<T extends object>(\n value: T,\n refFrom: unknown[],\n refTo: unknown[],\n): T {\n const copiedValue: Record<PropertyKey, unknown> = {};\n\n // It's important to first push the cloned ref so that it's index is kept in\n // sync with the ref to the original value in refFrom.\n refTo.push(copiedValue);\n\n for (const [k, v] of Object.entries(value)) {\n copiedValue[k] = cloneImplementation(v, refFrom, refTo);\n }\n\n return copiedValue as T;\n}\n\nfunction deepCloneArray<T extends readonly unknown[]>(\n value: T,\n refFrom: unknown[],\n refTo: unknown[],\n): T {\n const copiedValue: unknown[] = [];\n\n // It's important to first push the cloned ref so that it's index is kept in\n // sync with the ref to the original value in refFrom.\n refTo.push(copiedValue);\n\n for (const [index, item] of value.entries()) {\n copiedValue[index] = cloneImplementation(item, refFrom, refTo);\n }\n\n return copiedValue as unknown as T;\n}\n"],"mappings":"kGAwCA,SAAgB,EAAM,GAAG,EAAmC,CAC1D,OAAOA,EAAAA,MAAM,EAAqB,CAAI,CACxC,CAEA,SAAS,EACP,EACA,EAAqB,CAAC,EACtB,EAAmB,CAAC,EACjB,CACH,GAAI,OAAO,GAAU,WAEnB,OAAO,EAGT,GAAI,OAAO,GAAU,WAAY,EAG/B,OAAO,gBAAgB,CAAK,EAI9B,IAAM,EAAY,OAAO,eAAe,CAAK,EAC7C,GAGE,IAAc,MACd,IAAc,OAAO,WACrB,CAAC,MAAM,QAAQ,CAAK,EAKpB,OAAO,gBAAgB,CAAK,EAO9B,IAAM,EAAM,EAAQ,QAAQ,CAAK,EAOjC,OANI,IAAQ,IAKZ,EAAQ,KAAK,CAAK,EACX,MAAM,QAAQ,CAAK,EACtB,EAAe,EAAO,EAAS,CAAK,EACpC,EAAgB,EAAO,EAAS,CAAK,GAPhC,EAAM,EAQjB,CAEA,SAAS,EACP,EACA,EACA,EACG,CACH,IAAM,EAA4C,CAAC,EAInD,EAAM,KAAK,CAAW,EAEtB,IAAK,GAAM,CAAC,EAAG,KAAM,OAAO,QAAQ,CAAK,EACvC,EAAY,GAAK,EAAoB,EAAG,EAAS,CAAK,EAGxD,OAAO,CACT,CAEA,SAAS,EACP,EACA,EACA,EACG,CACH,IAAM,EAAyB,CAAC,EAIhC,EAAM,KAAK,CAAW,EAEtB,IAAK,GAAM,CAAC,EAAO,KAAS,EAAM,QAAQ,EACxC,EAAY,GAAS,EAAoB,EAAM,EAAS,CAAK,EAG/D,OAAO,CACT"}
|
package/dist/clone.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{purry as e}from"./purry.js";function t(...t){return e(n,t)}function n(e,t=[],n=[]){if(typeof e==`function`)return e;if(typeof e!=`object`||!e)return structuredClone(e);let a=Object.getPrototypeOf(e);if(
|
|
1
|
+
import{purry as e}from"./purry.js";function t(...t){return e(n,t)}function n(e,t=[],n=[]){if(typeof e==`function`)return e;if(typeof e!=`object`||!e)return structuredClone(e);let a=Object.getPrototypeOf(e);if(a!==null&&a!==Object.prototype&&!Array.isArray(e))return structuredClone(e);let o=t.indexOf(e);return o===-1?(t.push(e),Array.isArray(e)?i(e,t,n):r(e,t,n)):n[o]}function r(e,t,r){let i={};r.push(i);for(let[a,o]of Object.entries(e))i[a]=n(o,t,r);return i}function i(e,t,r){let i=[];r.push(i);for(let[a,o]of e.entries())i[a]=n(o,t,r);return i}export{t as clone};
|
|
2
2
|
//# sourceMappingURL=clone.js.map
|
package/dist/clone.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clone.js","names":[],"sources":["../src/clone.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types --\n * The state needed to compute the clone is passed by reference via mutable\n * arrays.\n */\n\nimport { purry } from \"./purry\";\n\n/**\n * Creates a deep copy of the value. Supported types: [plain objects](#isPlainObject),\n * `Array`, `number`, `string`, `boolean`, `Date`, and `RegExp`. Functions are\n * assigned by reference rather than copied. Class instances or any other\n * built-in type that isn't mentioned above are not supported (but might\n * work).\n *\n * @param data - The object to clone.\n * @signature\n * clone(data)\n * @example\n * clone({foo: 'bar'}) // {foo: 'bar'}\n * @dataFirst\n * @category Object\n */\nexport function clone<T>(data: T): T;\n\n/**\n * Creates a deep copy of the value. Supported types: [plain objects](#isPlainObject),\n * `Array`, `number`, `string`, `boolean`, `Date`, and `RegExp`. Functions are\n * assigned by reference rather than copied. Class instances or any other\n * built-in type that isn't mentioned above are not supported (but might\n * work).\n *\n * @signature\n * clone()(data)\n * @example\n * pipe({foo: 'bar'}, clone()) // {foo: 'bar'}\n * @dataLast\n * @category Object\n */\nexport function clone(): <T>(data: T) => T;\n\nexport function clone(...args: readonly unknown[]): unknown {\n return purry(cloneImplementation, args);\n}\n\nfunction cloneImplementation<T>(\n value: T,\n refFrom: unknown[] = [],\n refTo: unknown[] = [],\n): T {\n if (typeof value === \"function\") {\n // Functions aren't cloned, we return the same instance.\n return value;\n }\n\n if (typeof value !== \"object\" || value === null) {\n // Only objects are interesting when cloning, everything else can use\n // whatever JS does by default.\n return structuredClone(value);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const prototype = Object.getPrototypeOf(value);\n if (\n
|
|
1
|
+
{"version":3,"file":"clone.js","names":[],"sources":["../src/clone.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types --\n * The state needed to compute the clone is passed by reference via mutable\n * arrays.\n */\n\nimport { purry } from \"./purry\";\n\n/**\n * Creates a deep copy of the value. Supported types: [plain objects](#isPlainObject),\n * `Array`, `number`, `string`, `boolean`, `Date`, and `RegExp`. Functions are\n * assigned by reference rather than copied. Class instances or any other\n * built-in type that isn't mentioned above are not supported (but might\n * work).\n *\n * @param data - The object to clone.\n * @signature\n * clone(data)\n * @example\n * clone({foo: 'bar'}) // {foo: 'bar'}\n * @dataFirst\n * @category Object\n */\nexport function clone<T>(data: T): T;\n\n/**\n * Creates a deep copy of the value. Supported types: [plain objects](#isPlainObject),\n * `Array`, `number`, `string`, `boolean`, `Date`, and `RegExp`. Functions are\n * assigned by reference rather than copied. Class instances or any other\n * built-in type that isn't mentioned above are not supported (but might\n * work).\n *\n * @signature\n * clone()(data)\n * @example\n * pipe({foo: 'bar'}, clone()) // {foo: 'bar'}\n * @dataLast\n * @category Object\n */\nexport function clone(): <T>(data: T) => T;\n\nexport function clone(...args: readonly unknown[]): unknown {\n return purry(cloneImplementation, args);\n}\n\nfunction cloneImplementation<T>(\n value: T,\n refFrom: unknown[] = [],\n refTo: unknown[] = [],\n): T {\n if (typeof value === \"function\") {\n // Functions aren't cloned, we return the same instance.\n return value;\n }\n\n if (typeof value !== \"object\" || value === null) {\n // Only objects are interesting when cloning, everything else can use\n // whatever JS does by default.\n return structuredClone(value);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const prototype = Object.getPrototypeOf(value);\n if (\n // Keep this check in sync with the same check in the impl of\n // `isPlainObject`.\n prototype !== null &&\n prototype !== Object.prototype &&\n !Array.isArray(value)\n ) {\n // Our cloning logic is only designed for plain objects and arrays; other\n // object types (like `Date`, `RegExp`, `File`, and user-defined classes)\n // wouldn't clone properly. We fallback to the native cloning for them.\n return structuredClone(value);\n }\n\n // In order to support cyclic/self-referential structures, and to support\n // functions _within_ objects, we need to have our own cloning logic.\n\n // First we check if we've already cloned this value.\n const idx = refFrom.indexOf(value);\n if (idx !== -1) {\n return refTo[idx] as T;\n }\n // And if we haven't, we add it to our list of seen values so that it is kept\n // and clone the deep structure.\n refFrom.push(value);\n return Array.isArray(value)\n ? deepCloneArray(value, refFrom, refTo)\n : deepCloneObject(value, refFrom, refTo);\n}\n\nfunction deepCloneObject<T extends object>(\n value: T,\n refFrom: unknown[],\n refTo: unknown[],\n): T {\n const copiedValue: Record<PropertyKey, unknown> = {};\n\n // It's important to first push the cloned ref so that it's index is kept in\n // sync with the ref to the original value in refFrom.\n refTo.push(copiedValue);\n\n for (const [k, v] of Object.entries(value)) {\n copiedValue[k] = cloneImplementation(v, refFrom, refTo);\n }\n\n return copiedValue as T;\n}\n\nfunction deepCloneArray<T extends readonly unknown[]>(\n value: T,\n refFrom: unknown[],\n refTo: unknown[],\n): T {\n const copiedValue: unknown[] = [];\n\n // It's important to first push the cloned ref so that it's index is kept in\n // sync with the ref to the original value in refFrom.\n refTo.push(copiedValue);\n\n for (const [index, item] of value.entries()) {\n copiedValue[index] = cloneImplementation(item, refFrom, refTo);\n }\n\n return copiedValue as unknown as T;\n}\n"],"mappings":"mCAwCA,SAAgB,EAAM,GAAG,EAAmC,CAC1D,OAAO,EAAM,EAAqB,CAAI,CACxC,CAEA,SAAS,EACP,EACA,EAAqB,CAAC,EACtB,EAAmB,CAAC,EACjB,CACH,GAAI,OAAO,GAAU,WAEnB,OAAO,EAGT,GAAI,OAAO,GAAU,WAAY,EAG/B,OAAO,gBAAgB,CAAK,EAI9B,IAAM,EAAY,OAAO,eAAe,CAAK,EAC7C,GAGE,IAAc,MACd,IAAc,OAAO,WACrB,CAAC,MAAM,QAAQ,CAAK,EAKpB,OAAO,gBAAgB,CAAK,EAO9B,IAAM,EAAM,EAAQ,QAAQ,CAAK,EAOjC,OANI,IAAQ,IAKZ,EAAQ,KAAK,CAAK,EACX,MAAM,QAAQ,CAAK,EACtB,EAAe,EAAO,EAAS,CAAK,EACpC,EAAgB,EAAO,EAAS,CAAK,GAPhC,EAAM,EAQjB,CAEA,SAAS,EACP,EACA,EACA,EACG,CACH,IAAM,EAA4C,CAAC,EAInD,EAAM,KAAK,CAAW,EAEtB,IAAK,GAAM,CAAC,EAAG,KAAM,OAAO,QAAQ,CAAK,EACvC,EAAY,GAAK,EAAoB,EAAG,EAAS,CAAK,EAGxD,OAAO,CACT,CAEA,SAAS,EACP,EACA,EACA,EACG,CACH,IAAM,EAAyB,CAAC,EAIhC,EAAM,KAAK,CAAW,EAEtB,IAAK,GAAM,CAAC,EAAO,KAAS,EAAM,QAAQ,EACxC,EAAY,GAAS,EAAoB,EAAM,EAAS,CAAK,EAG/D,OAAO,CACT"}
|
package/dist/concat.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purry.cjs");function t(...t){return e.purry(n,t)}const n=(e,t)=>[...e,...t];exports.concat=t;
|
|
2
2
|
//# sourceMappingURL=concat.cjs.map
|
package/dist/concat.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concat.cjs","names":["purry"],"sources":["../src/concat.ts"],"sourcesContent":["import type { IterableContainer } from \"./internal/types/IterableContainer\";\nimport { purry } from \"./purry\";\n\n/**\n * Merge two or more arrays. This method does not change the existing arrays,\n * but instead returns a new array, even if the other array is empty.\n *\n * @param data - The first items, these would be at the beginning of the new\n * array.\n * @param other - The remaining items, these would be at the end of the new\n * array.\n * @returns A new array with the items of the first array followed by the items\n * of the second array.\n * @signature\n * concat(data, other);\n * @example\n * concat([1, 2, 3], ['a']) // [1, 2, 3, 'a']\n * @dataFirst\n * @category Array\n */\nexport function concat<\n T1 extends IterableContainer,\n T2 extends IterableContainer,\n>(data: T1, other: T2): [...T1, ...T2];\n\n/**\n * Merge two or more arrays. This method does not change the existing arrays,\n * but instead returns a new array, even if the other array is empty.\n *\n * @param other - The remaining items, these would be at the end of the new\n * array.\n * @returns A new array with the items of the first array followed by the items\n * of the second array.\n * @signature\n * concat(arr2)(arr1);\n * @example\n * concat(['a'])([1, 2, 3]) // [1, 2, 3, 'a']\n * @dataLast\n * @category Array\n */\nexport function concat<T2 extends IterableContainer>(\n other: T2,\n): <T1 extends IterableContainer>(data: T1) => [...T1, ...T2];\n\nexport function concat(...args: readonly unknown[]): unknown {\n return purry(concatImplementation, args);\n}\n\nconst concatImplementation = <\n T1 extends IterableContainer,\n T2 extends IterableContainer,\n>(\n arr1: T1,\n arr2: T2,\n): [...T1, ...T2] => [...arr1, ...arr2];\n"],"mappings":"kGA4CA,SAAgB,EAAO,GAAG,EAAmC,CAC3D,OAAOA,EAAAA,MAAM,EAAsB,
|
|
1
|
+
{"version":3,"file":"concat.cjs","names":["purry"],"sources":["../src/concat.ts"],"sourcesContent":["import type { IterableContainer } from \"./internal/types/IterableContainer\";\nimport { purry } from \"./purry\";\n\n/**\n * Merge two or more arrays. This method does not change the existing arrays,\n * but instead returns a new array, even if the other array is empty.\n *\n * @param data - The first items, these would be at the beginning of the new\n * array.\n * @param other - The remaining items, these would be at the end of the new\n * array.\n * @returns A new array with the items of the first array followed by the items\n * of the second array.\n * @signature\n * concat(data, other);\n * @example\n * concat([1, 2, 3], ['a']) // [1, 2, 3, 'a']\n * @dataFirst\n * @category Array\n */\nexport function concat<\n T1 extends IterableContainer,\n T2 extends IterableContainer,\n>(data: T1, other: T2): [...T1, ...T2];\n\n/**\n * Merge two or more arrays. This method does not change the existing arrays,\n * but instead returns a new array, even if the other array is empty.\n *\n * @param other - The remaining items, these would be at the end of the new\n * array.\n * @returns A new array with the items of the first array followed by the items\n * of the second array.\n * @signature\n * concat(arr2)(arr1);\n * @example\n * concat(['a'])([1, 2, 3]) // [1, 2, 3, 'a']\n * @dataLast\n * @category Array\n */\nexport function concat<T2 extends IterableContainer>(\n other: T2,\n): <T1 extends IterableContainer>(data: T1) => [...T1, ...T2];\n\nexport function concat(...args: readonly unknown[]): unknown {\n return purry(concatImplementation, args);\n}\n\nconst concatImplementation = <\n T1 extends IterableContainer,\n T2 extends IterableContainer,\n>(\n arr1: T1,\n arr2: T2,\n): [...T1, ...T2] => [...arr1, ...arr2];\n"],"mappings":"kGA4CA,SAAgB,EAAO,GAAG,EAAmC,CAC3D,OAAOA,EAAAA,MAAM,EAAsB,CAAI,CACzC,CAEA,MAAM,GAIJ,EACA,IACmB,CAAC,GAAG,EAAM,GAAG,CAAI"}
|
package/dist/concat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concat.js","names":[],"sources":["../src/concat.ts"],"sourcesContent":["import type { IterableContainer } from \"./internal/types/IterableContainer\";\nimport { purry } from \"./purry\";\n\n/**\n * Merge two or more arrays. This method does not change the existing arrays,\n * but instead returns a new array, even if the other array is empty.\n *\n * @param data - The first items, these would be at the beginning of the new\n * array.\n * @param other - The remaining items, these would be at the end of the new\n * array.\n * @returns A new array with the items of the first array followed by the items\n * of the second array.\n * @signature\n * concat(data, other);\n * @example\n * concat([1, 2, 3], ['a']) // [1, 2, 3, 'a']\n * @dataFirst\n * @category Array\n */\nexport function concat<\n T1 extends IterableContainer,\n T2 extends IterableContainer,\n>(data: T1, other: T2): [...T1, ...T2];\n\n/**\n * Merge two or more arrays. This method does not change the existing arrays,\n * but instead returns a new array, even if the other array is empty.\n *\n * @param other - The remaining items, these would be at the end of the new\n * array.\n * @returns A new array with the items of the first array followed by the items\n * of the second array.\n * @signature\n * concat(arr2)(arr1);\n * @example\n * concat(['a'])([1, 2, 3]) // [1, 2, 3, 'a']\n * @dataLast\n * @category Array\n */\nexport function concat<T2 extends IterableContainer>(\n other: T2,\n): <T1 extends IterableContainer>(data: T1) => [...T1, ...T2];\n\nexport function concat(...args: readonly unknown[]): unknown {\n return purry(concatImplementation, args);\n}\n\nconst concatImplementation = <\n T1 extends IterableContainer,\n T2 extends IterableContainer,\n>(\n arr1: T1,\n arr2: T2,\n): [...T1, ...T2] => [...arr1, ...arr2];\n"],"mappings":"mCA4CA,SAAgB,EAAO,GAAG,EAAmC,CAC3D,OAAO,EAAM,EAAsB,
|
|
1
|
+
{"version":3,"file":"concat.js","names":[],"sources":["../src/concat.ts"],"sourcesContent":["import type { IterableContainer } from \"./internal/types/IterableContainer\";\nimport { purry } from \"./purry\";\n\n/**\n * Merge two or more arrays. This method does not change the existing arrays,\n * but instead returns a new array, even if the other array is empty.\n *\n * @param data - The first items, these would be at the beginning of the new\n * array.\n * @param other - The remaining items, these would be at the end of the new\n * array.\n * @returns A new array with the items of the first array followed by the items\n * of the second array.\n * @signature\n * concat(data, other);\n * @example\n * concat([1, 2, 3], ['a']) // [1, 2, 3, 'a']\n * @dataFirst\n * @category Array\n */\nexport function concat<\n T1 extends IterableContainer,\n T2 extends IterableContainer,\n>(data: T1, other: T2): [...T1, ...T2];\n\n/**\n * Merge two or more arrays. This method does not change the existing arrays,\n * but instead returns a new array, even if the other array is empty.\n *\n * @param other - The remaining items, these would be at the end of the new\n * array.\n * @returns A new array with the items of the first array followed by the items\n * of the second array.\n * @signature\n * concat(arr2)(arr1);\n * @example\n * concat(['a'])([1, 2, 3]) // [1, 2, 3, 'a']\n * @dataLast\n * @category Array\n */\nexport function concat<T2 extends IterableContainer>(\n other: T2,\n): <T1 extends IterableContainer>(data: T1) => [...T1, ...T2];\n\nexport function concat(...args: readonly unknown[]): unknown {\n return purry(concatImplementation, args);\n}\n\nconst concatImplementation = <\n T1 extends IterableContainer,\n T2 extends IterableContainer,\n>(\n arr1: T1,\n arr2: T2,\n): [...T1, ...T2] => [...arr1, ...arr2];\n"],"mappings":"mCA4CA,SAAgB,EAAO,GAAG,EAAmC,CAC3D,OAAO,EAAM,EAAsB,CAAI,CACzC,CAEA,MAAM,GAIJ,EACA,IACmB,CAAC,GAAG,EAAM,GAAG,CAAI"}
|
package/dist/conditional.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./purryOn-wBH_q-mO.cjs");function t(...t){return e.t(r,n,t)}function n(e,...t){for(let n of t){if(typeof n==`function`)return n(e);let[t,r]=n;if(t(e))return r(e)}throw Error(`conditional: data failed for all cases`)}function r(e){if(!Array.isArray(e))return!1;let[t,n,...r]=e;return typeof t==`function`&&t.length<=1&&typeof n==`function`&&n.length<=1&&r.length===0}exports.conditional=t;
|
|
2
|
+
//# sourceMappingURL=conditional.cjs.map
|