@zelgadis87/utils-core 4.5.0 → 4.6.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/esbuild/index.cjs +149 -249
- package/esbuild/{index.mjs → index.js} +147 -262
- package/esbuild/package.json +39 -0
- package/package.json +14 -102
- package/src/async/Semaphore.ts +8 -6
- package/src/time/TimeDuration.ts +22 -11
- package/src/time/TimeInstant.ts +38 -21
- package/src/utils/arrays/groupBy.ts +11 -11
- package/src/utils/random.ts +9 -3
- package/src/utils/records.ts +12 -0
- package/dist/Logger.d.ts +0 -21
- package/dist/Optional.d.ts +0 -70
- package/dist/async/CancelableDeferred.d.ts +0 -17
- package/dist/async/Deferred.d.ts +0 -34
- package/dist/async/RateThrottler.d.ts +0 -13
- package/dist/async/Semaphore.d.ts +0 -14
- package/dist/async/index.d.ts +0 -4
- package/dist/index.d.ts +0 -8
- package/dist/lazy/Lazy.d.ts +0 -22
- package/dist/lazy/LazyAsync.d.ts +0 -24
- package/dist/lazy/index.d.ts +0 -2
- package/dist/sorting/ComparisonChain.d.ts +0 -57
- package/dist/sorting/Sorter.d.ts +0 -100
- package/dist/sorting/index.d.ts +0 -4
- package/dist/sorting/types.d.ts +0 -5
- package/dist/time/RandomTimeDuration.d.ts +0 -9
- package/dist/time/TimeBase.d.ts +0 -38
- package/dist/time/TimeDuration.d.ts +0 -79
- package/dist/time/TimeFrequency.d.ts +0 -10
- package/dist/time/TimeInstant.d.ts +0 -171
- package/dist/time/TimeInstantBuilder.d.ts +0 -77
- package/dist/time/TimeRange.d.ts +0 -11
- package/dist/time/TimeUnit.d.ts +0 -17
- package/dist/time/index.d.ts +0 -7
- package/dist/time/types.d.ts +0 -26
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/upgrade/DataUpgrader.d.ts +0 -22
- package/dist/upgrade/errors.d.ts +0 -12
- package/dist/upgrade/getTransitionsPath.d.ts +0 -3
- package/dist/upgrade/index.d.ts +0 -2
- package/dist/upgrade/types.d.ts +0 -31
- package/dist/utils/arrays/groupBy.d.ts +0 -9
- package/dist/utils/arrays/indexBy.d.ts +0 -7
- package/dist/utils/arrays/statistics.d.ts +0 -8
- package/dist/utils/arrays/uniqBy.d.ts +0 -4
- package/dist/utils/arrays.d.ts +0 -57
- package/dist/utils/booleans.d.ts +0 -2
- package/dist/utils/empties.d.ts +0 -17
- package/dist/utils/errors/withTryCatch.d.ts +0 -3
- package/dist/utils/errors.d.ts +0 -3
- package/dist/utils/functions/constant.d.ts +0 -10
- package/dist/utils/functions/iff.d.ts +0 -8
- package/dist/utils/functions.d.ts +0 -31
- package/dist/utils/index.d.ts +0 -13
- package/dist/utils/json.d.ts +0 -11
- package/dist/utils/nulls.d.ts +0 -8
- package/dist/utils/numbers/round.d.ts +0 -8
- package/dist/utils/numbers.d.ts +0 -34
- package/dist/utils/primitives.d.ts +0 -3
- package/dist/utils/promises.d.ts +0 -6
- package/dist/utils/random.d.ts +0 -2
- package/dist/utils/records/entries.d.ts +0 -4
- package/dist/utils/records.d.ts +0 -21
- package/dist/utils/strings/StringParts.d.ts +0 -32
- package/dist/utils/strings.d.ts +0 -17
package/dist/time/types.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { TDigit, TDigit1_9, TNumber0_1000, TParseableInt } from "../utils";
|
|
2
|
-
export type TOneDigit = `${TDigit}`;
|
|
3
|
-
export type TTwoDigits = `${TDigit}${TDigit}`;
|
|
4
|
-
export type TThreeDigits = `${TDigit}${TDigit}${TDigit}`;
|
|
5
|
-
export type TFourDigits = `${TDigit}${TDigit}${TDigit}${TDigit}`;
|
|
6
|
-
export type TUpToTwoDigits = TOneDigit | `${TDigit1_9}${TDigit}`;
|
|
7
|
-
export type TUpToThreeDigits = TUpToTwoDigits | `${TDigit1_9}${TDigit}${TDigit}`;
|
|
8
|
-
export type TUpToFourDigits = TUpToThreeDigits | `${TDigit1_9}${TDigit}${TDigit}${TDigit}`;
|
|
9
|
-
export type TTwoDigitsMonth = TTwoDigits & TParseableInt<`0${TDigit1_9}` | '10' | '11' | '12'>;
|
|
10
|
-
export type TTwoDigitsDate = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | `2${TDigit}` | '30' | '31'>;
|
|
11
|
-
export type TTwoDigitsHour = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | '20' | '21' | '22' | '23' | '24'>;
|
|
12
|
-
export type TTwoDigitsMinute = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | `2${TDigit}` | `3${TDigit}` | `4${TDigit}` | `5${TDigit}`>;
|
|
13
|
-
export type TTwoDigitsSecond = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | `2${TDigit}` | `3${TDigit}` | `4${TDigit}` | `5${TDigit}`>;
|
|
14
|
-
export type TThreeDigitsMillisecond = TThreeDigits;
|
|
15
|
-
export type TFourDigitsYear = TFourDigits;
|
|
16
|
-
export type TFourDigitsMillisecond = `${'+' | '-'}${TThreeDigits}`;
|
|
17
|
-
export type TMonth = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
18
|
-
export type TDayOfMonth = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31;
|
|
19
|
-
export type TWeekNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53;
|
|
20
|
-
export type TDayOfWeek = 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
21
|
-
export type THourOfDay = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
|
|
22
|
-
export type TMinuteOfHour = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59;
|
|
23
|
-
export type TSecondOfMinute = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59;
|
|
24
|
-
export type TMillisecondOfSecond = TNumber0_1000;
|
|
25
|
-
export type TIso8601DateString = `${string}-${string}-${string}T${string}:${string}:${string}.${string}${string}`;
|
|
26
|
-
export type TIso8601DateUtcString = `${string}-${string}-${string}T${string}:${string}:${string}.${string}Z`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"fileNames":["../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.6.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/small-date@2.0.1/node_modules/small-date/index.d.ts","../src/utils/functions/constant.ts","../src/sorting/types.ts","../src/sorting/comparisonchain.ts","../src/sorting/sorter.ts","../src/sorting/index.ts","../src/utils/nulls.ts","../src/utils/arrays/groupby.ts","../src/utils/arrays/indexby.ts","../src/utils/arrays/statistics.ts","../src/utils/arrays/uniqby.ts","../src/utils/arrays.ts","../src/utils/booleans.ts","../src/utils/empties.ts","../src/utils/errors/withtrycatch.ts","../src/utils/errors.ts","../src/utils/json.ts","../src/utils/numbers/round.ts","../src/utils/numbers.ts","../src/utils/primitives.ts","../src/time/timeunit.ts","../src/time/timebase.ts","../src/time/timeduration.ts","../src/utils/promises.ts","../src/utils/random.ts","../src/utils/records/entries.ts","../src/utils/records.ts","../src/utils/strings/stringparts.ts","../src/utils/strings.ts","../src/utils/index.ts","../src/utils/functions/iff.ts","../src/utils/functions.ts","../src/async/deferred.ts","../src/time/types.ts","../src/time/timeinstantbuilder.ts","../src/time/timeinstant.ts","../src/logger.ts","../src/optional.ts","../src/async/cancelabledeferred.ts","../src/time/timefrequency.ts","../src/async/ratethrottler.ts","../src/async/semaphore.ts","../src/async/index.ts","../src/lazy/lazy.ts","../src/lazy/lazyasync.ts","../src/lazy/index.ts","../src/time/randomtimeduration.ts","../src/time/timerange.ts","../src/time/index.ts","../src/upgrade/errors.ts","../src/upgrade/types.ts","../src/upgrade/gettransitionspath.ts","../src/upgrade/dataupgrader.ts","../src/upgrade/index.ts","../src/index.ts"],"fileIdsList":[[91],[90],[91,97,99,100],[91,98,113],[91,113],[64,88,95,96,101,104,107,112],[102,103],[88],[65],[88,94],[65,90],[60,61,88],[61,62,63],[79,81,92,94,98,105,106],[79,81,83],[79],[64,79,80,88,91,94],[81,88],[59,64,79,80,81,91,92,93],[65,90,92,94],[94,107],[88,108,109,110],[88,109],[109,111],[64,65,66,67,68,69,90],[70],[73],[74,90],[60,89,90],[65,70,71,72,74,75,77,78,82,83,85,87,90],[74],[65,74,76,90],[81,90],[84],[65,70,86],[65,70,87]],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","impliedFormat":1},{"version":"9e8ca8ed051c2697578c023d9c29d6df689a083561feba5c14aedee895853999","affectsGlobalScope":true,"impliedFormat":1},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"45d8ccb3dfd57355eb29749919142d4321a0aa4df6acdfc54e30433d7176600a","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true,"impliedFormat":1},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true,"impliedFormat":1},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"1a94697425a99354df73d9c8291e2ecd4dddd370aed4023c2d6dee6cccb32666","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3f9fc0ec0b96a9e642f11eda09c0be83a61c7b336977f8b9fdb1e9788e925fe","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"d3d7b04b45033f57351c8434f60b6be1ea71a2dfec2d0a0c3c83badbb0e3e693","affectsGlobalScope":true,"impliedFormat":1},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true,"impliedFormat":1},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true,"impliedFormat":1},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true,"impliedFormat":1},{"version":"15c1c3d7b2e46e0025417ed6d5f03f419e57e6751f87925ca19dc88297053fe6","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"c77f0c58173b1b3364632db5ee4455bac69cbf0c494b5a777bf80ca4aa8c9560","impliedFormat":1},{"version":"2ad39d7999802d47e85e77152fc7b2819f9127b551102ec179b1f78cce242954","signature":"970715547588fa6a8217b5ae2eb62e3960370009390d013270ee5eea694e5c70"},{"version":"d3781289f931d1fd6da732725be3a924271f3126a60a11f738dab07a9de2f7d8","signature":"4d79eeb5415637be3229c2667895b56383253c77b8b33e61549b5128daf9e37a"},{"version":"9dd6c91ad0cc61ccf6cb430400942911c9898cc5cb568f71741821e7e3b26ec6","signature":"318fa1a3aea63a60b7b66160ac98a8b207968e4969cf41bac4453d4f062fc2dc"},{"version":"f81e13545a32f0e905158afc87f5fe966a0a74efbc167ec094b07aea3d12a6ca","signature":"8acbccc69dd0aeca47b8884ba49bf54b2523749862bfe29f0b4f7f402c6f5d3c"},{"version":"1ab20f387ef7fa5cf94272900952596792f583f45bbd58d9adf2d623349d060e","signature":"ec49ec1ca3ddc1fbcdb45f1740ccd72d20fbf450036286c4373d9d13ddf2c4a2"},{"version":"0d578fa07b7e41030f7ad5176898a0a70a092fc45a264ce67498f63e544344e1","signature":"eb96292ecf52597cf826715047ec8411375f0ac8a43d0bd12f87dd3190838a04"},{"version":"de9544e159891685d316ac4161b4f01b58dda06c70c5bed9ec04c094b4ba5015","signature":"ed74ba876a20726b0452cc66a7dd09544a1cc8a72a092d2ca8b19bc269c27da3"},{"version":"e31542b0347f4025457278d7bc3ddc84529991059c1ab2b0b5bcb9b37cc33836","signature":"2f906b8d1966c352311c18c50f04d1fdf57ac78b8e7f4e0ba837253c6a02bf51"},{"version":"065815c5d2b778f409ae78a366079628d6b28c689647b358ee4cb854e92eead2","signature":"8da47ddef220dd11a8a0f431127f8d083ba95b7e2b45b266233812bcf1f13888"},{"version":"2fdcc3f88b19bda7bc74c8c6430b9e2f6eb6d252d812c508f48669a27b680d5f","signature":"e2ab4c29fa06a89dc35759aaf3354bb06cad41d3d6f1bf9e1ce482187cd1fb91"},{"version":"334fbcc8d8c79c7e87a57579cadde8d9b73b4fe6bf35cab40394600353c0bb7d","signature":"283bb26d51b9d0769247b89c21d91503cb3823fdcfda75cabf3a7fcc4d55e270"},{"version":"56571c3f44c6312462e8395ed75d05887dcbcb1581a0ad47dd72bcdbb898ea84","signature":"853de26cb0c4a51d7b511bf303ff4d6680bc18d36b3f2f6d7b8008c8927b58a1"},{"version":"80cfb7f027e1ed06149023ea32ba3d176db0325b675ade827d4cdf2b8cd715fc","signature":"9fc3664a9a2be65e8bf0ca4475f184a16c7a0b03e78c77cabe45e47d78bcd3db"},{"version":"1dddda79911dbd7ebfe881c7978fb4761be7a4d18f4367d2232fee867f1886d1","signature":"0992957d4775ed8a31ed20acbff806cc8f5eb4edd28e3071d36c2f16e6fa277f"},{"version":"2009cccc1fb281cb9233e13b14adb47b87ae0c72f7c73355d4ff0a536ad012b4","signature":"e537516e7b69cd96068554445428fd261d806d54ba92343fb91cac4120ae6017"},{"version":"c8493627adf08b4e0d48ebfb2724b2d1d227d26a71625f09b9f7601f5e847459","signature":"5db98cd7b060f49da05790a11db4314bbf4e7df3459462f37257991217d300b9"},{"version":"d0f71922ce0d6ce8aecef7b85158c6726e0db4d0ef23d71f2b14b9a2e5bef9fb","signature":"a29a11ea1f06a29ebc9d88a8439d78598d2d4977115a70705902c117d2a19e76"},{"version":"f2f9f6b43791f93f0cd2f09a5cee85243eb8ae831650b55a44f8d5b0fee14940","signature":"991a327a79d8b69993ac2ae5a6136cc96fa796d98e76860417061a0133231b68"},{"version":"70a58316dfec322f94bb980c05315faafd93f6fe6c56015efc7f0a4fb87636e2","signature":"d98d28f45f2fd50c72d82ea27d9fb213df06bc2456eb0748c657c6da8e77a1d4"},{"version":"cb6e4d47248ad5cbeed78f4164cf996fb276d54a580ac52e3a7feb92c4336d77","signature":"86463269677354ddc223e39011b4b5f231cdc5d072d08fb0e4b431a915e1f6eb"},{"version":"fe78af98b38dddb04bbf42a17e0ff5d3509ad062a97cd04d08cadbea7425627c","signature":"58686fcfd1c2f6e21d3dd7f52d347e73a9879aa634acd1baafe5f2c2e4c09e9a"},{"version":"607ee1c34e1b33bf42adba23592a8fc9a8a70cf986619222584c3da9a7685543","signature":"7fb8f6ffdd1cd861e0dd217886ef074bef1d4c88356030506615dc48a8121978"},{"version":"d3816328a097970f46726b8e2f34f1e66fab2d95a2463fe0a3a3460308fc06aa","signature":"0cce1783c4c412541b1118f66a401ee1076d2b45f6de005ffa10d7a3138bdbc3"},{"version":"d605a6d77f9547cc60d5563f8e4b43826ecfe67145715e7701443e6c7000f7d8","signature":"59fd76d117c77ac4f8aa2735ac59e07dac3e7f8abf4e8b5b79d7dcb4448215c4"},{"version":"f9b7540997405acdde3ddd1bc98c2a8ff0039f7dfde4dc699445a017c2311ec3","signature":"5d629ce88038b243d9c777e9c53696b49ed3391e2175a9b88dabb31a76079a06"},{"version":"92c49c13b67f8d21faaa1070dd6c5bb51e83098a434c5ea9d732583581385e38","signature":"da2bf0861b5119eeac5446fc8ab6beddfde0618a9c511d5b82147fb373deac15"},{"version":"a12f80b0021d23f5d69f36f2d6aca668500011c39a1700fae1181998fc85b601","signature":"d0858da5bf20118f452fc36ac2e03115b274084215f8246ffb82ad278da00a7d"},{"version":"b1bed90df58555cf322c8db9c2385cde43cb4f51da32ca8ab27e5d9865b59a7d","signature":"cd8c66d55b062af0df39c84f41185885b993048e5c109982e3a315d1789a5f3f"},{"version":"33d19b3cb7117da8dc04e821cd39a8c3e796376139e6aa05bfd822dfa554bfae","signature":"d395782613b270de87b13d6331a397013e9753fc4428b00f2e294cc29e3e8d76"},{"version":"409daaf670e0781555140c48d214d855775841d1a74d74057a2f9c9b23a8ea93","signature":"cd6b7bbe6bdee5e60c4fbee6907d334808ea07a247374df93136231d359b4795"},{"version":"9f7954a3bc4fd40f8b65b54655a3c2e30871499cd2d151ec7e47f40d80035ecc","signature":"65cc505b6d6e6b6f058b49a2c81fde6a1ec806e49261ce71bd4ad8a671712483"},{"version":"d6859319cfab28518e99dba48a2dbb9392e2e112f2dac7911b055a003189b920","signature":"1f0e09320cb86d4f4f26386d828d9b66da11620d331f79073615026f5dbf6978"},{"version":"c3595b97fd7a5a98a6af20b81f87bdea93d963f1c39337739e605281aa964c4a","signature":"d3b1a67f87d6e77f7772bfc777e04387a6bf3d84eb2f18b454f9bd9cefa86afb"},{"version":"3c2ca70abf1d8db31f40785c88b68b356b5fecc93edf626cc31e0c38225f8a4d","signature":"626afa709798521c427847bb617e1379d22b90d6098118ce08e137383dab2965"},{"version":"8a36f4d8f34cebcde784d513a5bc6b6a020cb5f5a78297b2ea92ff5f7f59b183","signature":"9ce8acadf39f2eff3011fb1241b111299e9a3ac144202b12fee6200e6d781027"},{"version":"c4f88d5f3c6e0d1b87efd8d336d6cd4ef457db83c952de20b90d4808187c8450","signature":"ff1690eb4407b18a88ddc918e4311923bc1f787a8a8f678d5b03fe8922048177"},{"version":"f46c11b34a70c1196da95cf77b957469dbd6ec94e00e5074041392626c35fa76","signature":"15884642f06d3093d656d698d814e95599a96ee629468206791b359b5e4d137d"},{"version":"963e90bd6a94bd500329447e92ecb2be1efaab48d53d81e6f143dc63cb2aa76f","signature":"c6eff6bde8066f2980b221de77dc801f3a2a27525a9c3879d37426941b7a413c"},{"version":"1746aab5d9264c85832305e5ac252401199168629595ec2d65daccbb4e1778bd","signature":"655ff771dbe8906922d5081fd4ecffc1b2fe97521c9c400cc4f506b81f048645"},{"version":"141dac9588bca23bfc8a13b99560bae0cf818733218861bba342a5418e55d86f","signature":"3d58a3363bb571062abeb1fdc96e174e8a6a61bcdd3e7491c2bf65dbb5a17750"},{"version":"462708b3fc0067a69af6f9df70229485d8ebccbac2a472314a8306a4ef56779f","signature":"3f2b9bd0340a9cbcdbbfdbd7bf828a49c477dddd3473ed7816310700becf5961"},{"version":"0c244f63637cdd383fd0ba6912244f8146a9169eeaf885b2ef136e4d1baedd01","signature":"86122f878833e22a38a54656b9fe61736ba6c103b6a2fa01dae70458aec4353d"},{"version":"ba7ad8169c4e0cfeab946431d3e9a2def0f86c928580fcd767d0afb09b5c03f5","signature":"1a3a6cd1cc20eddc55d13ce8a54fabc0bebe0069b2d75d2c738e7d8aa94741bc"},{"version":"5253453362b3bb0b2d215c3ae66b850edb6f65bce45daaf4f2530b5292ab905b","signature":"9e7fcd385ecfdfa65958f8c734a2a73bbfd1ffca8f5ab0240629464e94f332a0"},{"version":"776155d42bfa1737a147a7f9ab63f0068b0f12279f86757347d605d8550eae16","signature":"0428da86bb5e41a6da4aedec6af5fb004a74731c9d56bcbe2b6348f1bf44744a"},{"version":"c3d59784aa9468ae61f7f99359eea4b3a9ccc6aec1bb46869aea049c0a0b8812","signature":"975d013c31f48ecb26867d0f98f13d2eaebb4af2bfbe6b5fd9a4d38fdccd5656"},{"version":"f5cb5ee6dfc305bbad84b2990954ce9557db25146764b81e91a22f22b4c650dd","signature":"5022494c36b44f458140adf6060c2f14e107b8984de8596eee5dbcb70cdb9f6b"},{"version":"6f4a74e34595aa6420c4a1df1ff788d1686f7bdfc7259de90d0102f4cf83555f","signature":"12cf7f6e0e2bf8d8e9b8a79d1adae5f8706736dee1e5d25279785ce45c7b0b27"},{"version":"5b2927131599d55e0ee730c7a2afc764ff39199a5d186b510fc3eca82f4ef1ff","signature":"d6fc507f1c2ecd14c0882a0e00a1ba2a580c6e45550a3a5e868d7bee4b1922b6"},{"version":"1beb76f20b97f76d5ac48caa921161255c72c59e93a8571871b069b8dff2bed2","signature":"340b2a38ab87e8aa617f4021a1e4c916453f80cc27d908ab084a1798be18b5c0"},{"version":"2ebd1a1e8ba106bea54bf6cf59f2909a27864c7b35ff1b828d8c7634a6a62179","signature":"f0561579997f9cfd97a6e991d806999dd3b48b6476b03e7d33ca6ea06297b21c"},{"version":"74dc5d77ab2d43e26ae180d7bef1780d7fa0209ef643827ac601c2fdda759321","signature":"c78dfc67b95896fccbc0e65345294a53877ed8e6424c5b8a763c709b68a1c645"},{"version":"22577c900676846354224462f8a6b3e0e5033cd14a501ea46107e67a4ab7863f","signature":"70fd81e903686acf6e994565edb1588cc619b816646ea1a89ac9a47b45d25737"},{"version":"569c58f09117e840594ae628aec2ca65eaa02f3322e8c70cbf5ba8f1115a04b2","signature":"a4321a18e9f87f996672902385e77ad1fd93f251f4e665f849fbdc32bbfb1cdc"}],"root":[[60,113]],"options":{"allowImportingTsExtensions":true,"composite":true,"declaration":true,"emitDeclarationOnly":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"module":7,"noFallthroughCasesInSwitch":true,"noImplicitAny":false,"noImplicitReturns":true,"noImplicitThis":true,"noUnusedLocals":false,"noUnusedParameters":false,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"strictBindCallApply":true,"strictFunctionTypes":true,"strictNullChecks":true,"strictPropertyInitialization":true,"target":9,"tsBuildInfoFile":"./tsconfig.tsbuildinfo"},"referencedMap":[[97,1],[91,2],[101,3],[99,4],[100,5],[113,6],[104,7],[102,8],[103,9],[95,10],[96,11],[62,12],[64,13],[63,12],[61,2],[107,14],[105,15],[80,16],[81,17],[98,18],[94,19],[93,20],[106,21],[92,8],[111,22],[110,23],[112,24],[109,8],[70,25],[66,8],[67,8],[68,26],[69,2],[74,27],[73,28],[90,29],[89,8],[88,30],[75,31],[65,2],[77,32],[82,33],[85,34],[84,8],[87,35],[86,36]],"latestChangedDtsFile":"./utils/arrays.d.ts","version":"5.6.3"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { TJsonSerializable } from "../utils/index.js";
|
|
2
|
-
import { EmptyUpgradeError, UnavailableUpgradeError } from "./errors";
|
|
3
|
-
import { TPossibleFromVersion, TPossibleVersion, TUpgradable, TUpgradeFunction, TVersionMap } from "./types";
|
|
4
|
-
declare const VERSION_FIELD = "$version";
|
|
5
|
-
export interface IDataUpgrader<XStar extends TUpgradable, XLatest extends XStar> {
|
|
6
|
-
upgrade(data: XStar): Promise<XLatest>;
|
|
7
|
-
}
|
|
8
|
-
export declare class DataUpgrader<X extends TUpgradable, XLatest extends X> implements IDataUpgrader<X, XLatest> {
|
|
9
|
-
private latestVersion;
|
|
10
|
-
private transitions;
|
|
11
|
-
private constructor();
|
|
12
|
-
addTransition<XFrom extends TVersionMap<X>[XFromNumber], XTo extends TVersionMap<X>[XToNumber], XFromNumber extends TPossibleFromVersion<X, XLatest>, XToNumber extends Exclude<TPossibleVersion<X>, XFromNumber>>(from: XFromNumber, to: XToNumber, apply: TUpgradeFunction<X, XFrom, XTo>): this;
|
|
13
|
-
upgrade(data: X): Promise<XLatest>;
|
|
14
|
-
isLatestVersion(data: X): data is XLatest;
|
|
15
|
-
static create<X extends TUpgradable, XLatestVersion extends X>(latest: XLatestVersion[typeof VERSION_FIELD]): DataUpgrader<X, XLatestVersion>;
|
|
16
|
-
static Errors: {
|
|
17
|
-
readonly EmptyUpgrade: typeof EmptyUpgradeError;
|
|
18
|
-
readonly UnavailableUpgrade: typeof UnavailableUpgradeError;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export declare function isUpgradable(obj: TJsonSerializable): obj is TUpgradable;
|
|
22
|
-
export default DataUpgrader;
|
package/dist/upgrade/errors.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare class UnavailableUpgradeError<T> extends Error {
|
|
2
|
-
readonly data: T;
|
|
3
|
-
readonly from: number;
|
|
4
|
-
readonly to: number;
|
|
5
|
-
constructor(data: T, from: number, to: number);
|
|
6
|
-
}
|
|
7
|
-
export declare class EmptyUpgradeError<T> extends Error {
|
|
8
|
-
readonly data: T;
|
|
9
|
-
readonly from: number;
|
|
10
|
-
readonly to: number;
|
|
11
|
-
constructor(data: T, from: number, to: number);
|
|
12
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TMaybe } from "../utils";
|
|
2
|
-
import { TTransition, TTransitionMatrix, TUpgradable } from "./types";
|
|
3
|
-
export default function getTransitionsPath<XStar extends TUpgradable, XFromNumber extends XStar["$version"], XToNumber extends XStar["$version"]>(matrix: TTransitionMatrix<XStar>, from: XFromNumber, to: XToNumber): TMaybe<TTransition<XStar, XFromNumber, XToNumber>[]>;
|
package/dist/upgrade/index.d.ts
DELETED
package/dist/upgrade/types.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { TFunction, TJsonObject, TPromisable } from "../utils";
|
|
2
|
-
export type TUpgradable = TJsonObject & {
|
|
3
|
-
$version: number;
|
|
4
|
-
};
|
|
5
|
-
export type TUpgradableAtVersion<XStar extends TUpgradable, N extends XStar["$version"]> = Extract<XStar, {
|
|
6
|
-
$version: N;
|
|
7
|
-
}>;
|
|
8
|
-
export type TVersionMap<XStar extends TUpgradable> = {
|
|
9
|
-
[XVersionNumber in XStar["$version"]]: TUpgradableAtVersion<XStar, XVersionNumber>;
|
|
10
|
-
};
|
|
11
|
-
export type TPossibleVersion<XStar extends TUpgradable> = XStar["$version"] & number;
|
|
12
|
-
export type TPossibleFromVersion<XStar extends TUpgradable, XLatest extends XStar> = Exclude<TPossibleVersion<XStar>, XLatest["$version"]>;
|
|
13
|
-
export type TUpgradeFunction<XStar extends TUpgradable, XFrom extends XStar, XTo extends XStar> = TFunction<Readonly<TVersionMap<XStar>[XFrom["$version"]]>, TPromisable<TVersionMap<XStar>[XTo["$version"]]>>;
|
|
14
|
-
export type TTransition<XStar extends TUpgradable, XFromNumber extends XStar["$version"], XToNumber extends XStar["$version"], XFrom extends Extract<XStar, {
|
|
15
|
-
$version: XFromNumber;
|
|
16
|
-
}> = Extract<XStar, {
|
|
17
|
-
$version: XFromNumber;
|
|
18
|
-
}>, XTo extends Extract<XStar, {
|
|
19
|
-
$version: XToNumber;
|
|
20
|
-
}> = Extract<XStar, {
|
|
21
|
-
$version: XToNumber;
|
|
22
|
-
}>> = {
|
|
23
|
-
from: XFromNumber;
|
|
24
|
-
to: XToNumber;
|
|
25
|
-
apply: TUpgradeFunction<XStar, XFrom, XTo>;
|
|
26
|
-
};
|
|
27
|
-
export type TTransitionMatrix<XStar extends TUpgradable> = Partial<{
|
|
28
|
-
[XTo in XStar["$version"]]: Partial<{
|
|
29
|
-
[XFrom in XStar["$version"]]: TTransition<XStar, XFrom, XTo>;
|
|
30
|
-
}>;
|
|
31
|
-
}>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TFunction, TKeysOfType } from "..";
|
|
2
|
-
export declare function groupByString<V, K extends TKeysOfType<V, string>>(arr: V[], field: K): Record<V[K] & string, V[]>;
|
|
3
|
-
export declare function groupByNumber<V, K extends TKeysOfType<V, number>>(arr: V[], field: K): Record<V[K] & number, V[]>;
|
|
4
|
-
export declare function groupByBoolean<V, K extends TKeysOfType<V, boolean>>(arr: V[], field: K): Record<"true" | "false", V[]>;
|
|
5
|
-
export declare function groupBySymbol<V, K extends TKeysOfType<V, symbol>>(arr: V[], field: K): Record<V[K] & symbol, V[]>;
|
|
6
|
-
export declare function groupByStringWith<V, K extends string>(arr: V[], getter: TFunction<V, K>): Record<K, V[]>;
|
|
7
|
-
export declare function groupByNumberWith<V, K extends number>(arr: V[], getter: TFunction<V, K>): Record<K, V[]>;
|
|
8
|
-
export declare function groupByBooleanWith<V, K extends boolean>(arr: V[], getter: TFunction<V, K>): Record<"true" | "false", V[]>;
|
|
9
|
-
export declare function groupBySymbolWith<V, K extends symbol>(arr: V[], getter: TFunction<V, K>): Record<K, V[]>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TFunction, TKeysOfType } from "..";
|
|
2
|
-
export declare function indexByString<V, K extends TKeysOfType<V, string>>(arr: V[], field: K): Record<V[K] & string, V>;
|
|
3
|
-
export declare function indexByNumber<V, K extends TKeysOfType<V, number>>(arr: V[], field: K): Record<V[K] & number, V>;
|
|
4
|
-
export declare function indexBySymbol<V, K extends TKeysOfType<V, symbol>>(arr: V[], field: K): Record<V[K] & symbol, V>;
|
|
5
|
-
export declare function indexByStringWith<V>(arr: V[], getter: TFunction<V, string>): Record<string, V>;
|
|
6
|
-
export declare function indexByNumberWith<V>(arr: V[], getter: TFunction<V, number>): Record<number, V>;
|
|
7
|
-
export declare function indexBySymbolWith<V>(arr: V[], getter: TFunction<V, symbol>): Record<symbol, V>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { TReadableArray } from "../arrays.js";
|
|
2
|
-
export declare function average(arr: TReadableArray<number>): number;
|
|
3
|
-
export declare function sum(arr: TReadableArray<number>): number;
|
|
4
|
-
export declare function sumBy<T>(arr: TReadableArray<T>, getter: (t: T) => number): number;
|
|
5
|
-
export declare function min(arr: TReadableArray<number>): number;
|
|
6
|
-
export declare function minBy<T>(arr: TReadableArray<T>, getter: (t: T) => number): number;
|
|
7
|
-
export declare function max(arr: TReadableArray<number>): number;
|
|
8
|
-
export declare function maxBy<T>(arr: TReadableArray<T>, getter: (t: T) => number): number;
|
package/dist/utils/arrays.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { TComparisonFunction } from "../sorting/index.js";
|
|
2
|
-
import type { TAccumulator, TBiPredicate, TPredicate, TTransformer } from "./functions.js";
|
|
3
|
-
import { type TMaybe } from "./nulls.js";
|
|
4
|
-
export * from './arrays/groupBy.js';
|
|
5
|
-
export * from './arrays/indexBy.js';
|
|
6
|
-
export * from './arrays/statistics.js';
|
|
7
|
-
export * from './arrays/uniqBy.js';
|
|
8
|
-
export type TReadableArray<T> = Array<T> | ReadonlyArray<T>;
|
|
9
|
-
export type TArrayable<T> = T | T[];
|
|
10
|
-
export type TEmptyArray = [];
|
|
11
|
-
export declare function ensureArray<const T>(t: T | Array<T> | null | undefined): Array<T>;
|
|
12
|
-
export declare function ensureReadableArray<const T>(t: T | Array<T> | ReadonlyArray<T> | null | undefined): TReadableArray<T>;
|
|
13
|
-
export declare function isArray<const T>(t: unknown): t is Array<T>;
|
|
14
|
-
/**
|
|
15
|
-
* Generate a new copy of an array with:
|
|
16
|
-
* - the first instance of an item matching the predicate being replaced with the given argument
|
|
17
|
-
* - the given argument added as last item of the array if the predicate did not produce a match
|
|
18
|
-
* @param arr - the original array of items
|
|
19
|
-
* @param item - the item to insert or update
|
|
20
|
-
* @param predicate - a function that returns true iff an item is equal to the given argument
|
|
21
|
-
* @returns a new copy of the array with the item updated or added in last place
|
|
22
|
-
*/
|
|
23
|
-
export declare function upsert<T>(arr: ReadonlyArray<T>, item: T, isEqual: TBiPredicate<T>): Array<T>;
|
|
24
|
-
export declare function range(start: number, end: number): Array<number>;
|
|
25
|
-
export declare function fill<T>(length: number, value: T): Array<T>;
|
|
26
|
-
export declare function extendArray<T extends Record<string | number | symbol, unknown>, X extends Record<string | number | symbol, unknown>>(arr: TReadableArray<T>, props: X): Array<(T & X)>;
|
|
27
|
-
export declare function extendArrayWith<T extends Record<string | number | symbol, unknown>, X extends Record<string | number | symbol, unknown>>(arr: TReadableArray<T>, propsFn: (t: T) => X): Array<(T & X)>;
|
|
28
|
-
export declare function reverse<T>(arr: TReadableArray<T>): Array<T>;
|
|
29
|
-
export declare function first<T>(arr: TReadableArray<T>, defaultValue?: TMaybe<T>): TMaybe<T>;
|
|
30
|
-
export declare function last<T>(arr: TReadableArray<T>, defaultValue?: TMaybe<T>): TMaybe<T>;
|
|
31
|
-
export declare const head: typeof first;
|
|
32
|
-
export declare function tail<T>(arr: TReadableArray<T>): T[];
|
|
33
|
-
export declare function sortedArray<T>(arr: Array<T>, sortFn?: TComparisonFunction<T> | undefined): Array<T>;
|
|
34
|
-
export declare function sortedArray<T>(arr: ReadonlyArray<T>, sortFn?: TComparisonFunction<T> | undefined): ReadonlyArray<T>;
|
|
35
|
-
/**
|
|
36
|
-
* Custom implementation of includes which allows checking for arbitrary items inside the array.
|
|
37
|
-
*/
|
|
38
|
-
export declare function includes<T>(arr: TReadableArray<T>, item: unknown, fromIndex?: number): boolean;
|
|
39
|
-
export declare function mapTruthys<T, R>(arr: Array<T>, mapper: (value: T, index: number, array: T[]) => R | undefined): Array<R>;
|
|
40
|
-
export declare function flatMapTruthys<T, R>(arr: Array<T>, mapper: (value: T, index: number, array: T[]) => R | undefined): Array<R>;
|
|
41
|
-
export declare function filterMap<T, R>(array: T[], filterFn: TPredicate<T>, mapFn: TTransformer<T, R>): R[];
|
|
42
|
-
export declare function filterMapReduce<T, U, R>(array: T[], filterFn: TPredicate<T>, mapFn: TTransformer<T, U>, reduceFn: TAccumulator<R, U>, initialValue: R): R;
|
|
43
|
-
/**
|
|
44
|
-
* Partitions the given array in two groups, in the first one there will be any and only values of the array that match the given predicate, in the second one there will be any and only values that don't.
|
|
45
|
-
* @param arr the array of items
|
|
46
|
-
* @param predicate the predicate to use to partition the array
|
|
47
|
-
* @returns a tuple, where the first array contains items matching the predicate, and the second array contains items not matching the predicate.
|
|
48
|
-
*/
|
|
49
|
-
export declare function partition<T>(arr: T[], predicate: TPredicate<T>): [T[], T[]];
|
|
50
|
-
/**
|
|
51
|
-
* Maps the first truthy value in the array using the provided mapping function.
|
|
52
|
-
* @param arr - The array of items.
|
|
53
|
-
* @param mapFn - The mapping function.
|
|
54
|
-
* @returns The first truthy value returned by the mapping function, or null if no truthy value is found.
|
|
55
|
-
*/
|
|
56
|
-
export declare function mapFirstTruthy<T, R>(arr: T[], mapFn: TTransformer<T, R>): R | null;
|
|
57
|
-
export declare function makeArrayEmpty(arr: unknown[]): void;
|
package/dist/utils/booleans.d.ts
DELETED
package/dist/utils/empties.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Define a new type that is true if T is the empty object, false otherwise.
|
|
3
|
-
*/
|
|
4
|
-
export type TIsEmptyObject<T> = keyof T extends never ? true : false;
|
|
5
|
-
/**
|
|
6
|
-
* Defines a new type that is the empty array, if T is an empty object, or is the array containing T if T is not the empty object.<br/>
|
|
7
|
-
* This type can be used as function argument, to conditionally require an argument based on type T.<br/>
|
|
8
|
-
* Usage example:
|
|
9
|
-
* ```
|
|
10
|
-
* type TMetadata = { a: {}, b: {}, c: { x: 1 } };
|
|
11
|
-
* function foo<X extends keyof TMetadata>( type: X, metadata: TMetadata[X] ) { ... };
|
|
12
|
-
* export function fooWrapper<X extends keyof TMetadata>( type: X, ...args: TConditionalOptionalType<TMetadata[X]> ) {
|
|
13
|
-
* const bar = foo( type, args.length === 0 ? void 0 : args[ 0 ] );
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export type TConditionalOptionalType<T> = TIsEmptyObject<T> extends true ? [] : [T];
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type TFunction, type TTransformer } from "../functions.js";
|
|
2
|
-
export declare function withTryCatch<R>(fn: TFunction<void, R>, errMapFn?: TTransformer<Error, Error>): [R, undefined] | [undefined, Error];
|
|
3
|
-
export declare function withTryCatchAsync<R>(fn: TFunction<void, Promise<R>>, errMapFn: TTransformer<Error, Error>): Promise<[R, undefined] | [undefined, Error]>;
|
package/dist/utils/errors.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function constant<T>(v: T): () => T;
|
|
2
|
-
export declare function identity<T>(t: T): T;
|
|
3
|
-
export default constant;
|
|
4
|
-
export declare const constantNull: () => null;
|
|
5
|
-
export declare const constantTrue: () => boolean;
|
|
6
|
-
export declare const constantFalse: () => boolean;
|
|
7
|
-
export declare const alwaysTrue: () => boolean;
|
|
8
|
-
export declare const alwaysFalse: () => boolean;
|
|
9
|
-
export declare const constantZero: () => number;
|
|
10
|
-
export declare const constantOne: () => number;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TPredicate } from "..";
|
|
2
|
-
type TBooleanOrPredicate = boolean | TPredicate<void>;
|
|
3
|
-
type TIff<T> = {
|
|
4
|
-
elseIf<R>(pred: TBooleanOrPredicate, valueIfTrue: R): TIff<T | R>;
|
|
5
|
-
otherwise<R>(valueIfElse: R): T | R;
|
|
6
|
-
};
|
|
7
|
-
export declare function iff<T>(firstPredicate: TBooleanOrPredicate, valueIfTrue: T): TIff<T>;
|
|
8
|
-
export default iff;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export * from './functions/constant.js';
|
|
2
|
-
export * from './functions/iff.js';
|
|
3
|
-
export type TFunction<A, R> = (a: A) => R;
|
|
4
|
-
export type TTransformer<A, R> = TFunction<A, R>;
|
|
5
|
-
export type TVoidFunction = TFunction<void, void>;
|
|
6
|
-
export type TProducer<R> = TFunction<void, R>;
|
|
7
|
-
export type TConsumer<T> = TFunction<T, void>;
|
|
8
|
-
export type TPredicate<T> = TFunction<T, boolean>;
|
|
9
|
-
export type TTypePredicate<T, R extends T> = (t: T) => t is R;
|
|
10
|
-
export type TIdentityFunction<T> = TFunction<T, T>;
|
|
11
|
-
export type TBiFunction<A, B, R> = (a: A, b: B) => R;
|
|
12
|
-
export type TBiConsumer<A, B> = TBiFunction<A, B, void>;
|
|
13
|
-
export type TBiPredicate<T> = TBiFunction<T, T, boolean>;
|
|
14
|
-
export type TAccumulator<A, B> = TBiFunction<A, B, A>;
|
|
15
|
-
export type TAsyncFunction<A, R> = TFunction<A, Promise<R>>;
|
|
16
|
-
export type TAsyncVoidFunction = TAsyncFunction<void, void>;
|
|
17
|
-
export type TAsyncProducer<R> = TAsyncFunction<void, R>;
|
|
18
|
-
export type TAsyncConsumer<T> = TAsyncFunction<T, void>;
|
|
19
|
-
export type TAsyncPredicate<T> = TAsyncFunction<T, boolean>;
|
|
20
|
-
export type TAsyncBiFunction<A, B, R> = TBiFunction<A, B, Promise<R>>;
|
|
21
|
-
export type TAsyncBiConsumer<A, B> = TAsyncBiFunction<A, B, void>;
|
|
22
|
-
export type TAsyncBiPredicate<T> = TAsyncBiFunction<T, T, boolean>;
|
|
23
|
-
export type TAnyFunction<R> = (...args: unknown[]) => R;
|
|
24
|
-
export type TAsyncAnyFunction<R> = (...args: unknown[]) => Promise<R>;
|
|
25
|
-
export declare function isFunction(t: unknown): t is Function;
|
|
26
|
-
export declare function noop(): void;
|
|
27
|
-
export declare function filterWithTypePredicate<T, R extends T>(filter: TPredicate<T>): TTypePredicate<T, R>;
|
|
28
|
-
export declare function not<T>(predicate: TPredicate<T>): TPredicate<T>;
|
|
29
|
-
export declare function and<T>(a: TPredicate<T>, b: TPredicate<T>): TPredicate<T>;
|
|
30
|
-
export declare function or<T>(a: TPredicate<T>, b: TPredicate<T>): TPredicate<T>;
|
|
31
|
-
export declare function xor<T>(a: TPredicate<T>, b: TPredicate<T>): TPredicate<T>;
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './arrays.js';
|
|
2
|
-
export * from './booleans.js';
|
|
3
|
-
export * from './empties.js';
|
|
4
|
-
export * from './errors.js';
|
|
5
|
-
export * from './functions.js';
|
|
6
|
-
export * from './json.js';
|
|
7
|
-
export * from './nulls.js';
|
|
8
|
-
export * from './numbers.js';
|
|
9
|
-
export * from './primitives.js';
|
|
10
|
-
export * from './promises.js';
|
|
11
|
-
export * from './random.js';
|
|
12
|
-
export * from './records.js';
|
|
13
|
-
export * from './strings.js';
|
package/dist/utils/json.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export type TJsonPrimitive = string | number | boolean | null | undefined;
|
|
2
|
-
export type TJsonArray = Array<TJsonSerializable> | ReadonlyArray<TJsonSerializable>;
|
|
3
|
-
export type TJsonObject = {
|
|
4
|
-
[key: string]: TJsonSerializable;
|
|
5
|
-
};
|
|
6
|
-
export type TJsonSerializable = TJsonPrimitive | TJsonArray | TJsonObject;
|
|
7
|
-
export declare function tryToParseJson<T extends TJsonSerializable>(jsonContent: string): [T, undefined] | [undefined, Error];
|
|
8
|
-
export declare function jsonCloneDeep<A extends TJsonSerializable>(a: A): A;
|
|
9
|
-
export declare function omitFromJsonObject<T extends TJsonObject, K extends keyof T>(o: T, ...keys: K[]): Omit<T, K>;
|
|
10
|
-
/** @deprecated[2024-12-23]: Use {@link omitFromJsonObject} instead. */
|
|
11
|
-
export declare const omit: typeof omitFromJsonObject;
|
package/dist/utils/nulls.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TConsumer, TFunction } from "./functions.js";
|
|
2
|
-
export type TMaybe<T> = T | null;
|
|
3
|
-
export declare function ensureDefined<T>(v: T, name?: string): T;
|
|
4
|
-
export declare function isDefined<T>(x: T | null | undefined): x is T;
|
|
5
|
-
export declare function isNullOrUndefined(x: unknown): x is null | undefined;
|
|
6
|
-
export declare function ifDefined<R>(source: TMaybe<R>, callback: TConsumer<R>): void;
|
|
7
|
-
export declare function mapDefined<R, S>(source: TMaybe<R>, mapper: TFunction<R, S>): TMaybe<S>;
|
|
8
|
-
export declare function ifNullOrUndefined(source: TMaybe<unknown>, callback: TConsumer<void>): void;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type TRoundMode = 'toNearest' | 'toLower' | 'toUpper' | 'towardsZero' | 'awayFromZero';
|
|
2
|
-
export declare function round(n: number, precision?: number, mode?: TRoundMode): number;
|
|
3
|
-
export default round;
|
|
4
|
-
export declare const roundToNearest: (n: number, precision?: number) => number;
|
|
5
|
-
export declare const roundToLower: (n: number, precision?: number) => number;
|
|
6
|
-
export declare const roundToUpper: (n: number, precision?: number) => number;
|
|
7
|
-
export declare const roundTowardsZero: (n: number, precision?: number) => number;
|
|
8
|
-
export declare const roundAwayFromZero: (n: number, precision?: number) => number;
|
package/dist/utils/numbers.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { TFunction } from "./functions.js";
|
|
2
|
-
export * from './numbers/round.js';
|
|
3
|
-
export type TNumericString = `${number}`;
|
|
4
|
-
export type TNumericFloatingPointString = `${number}.${number}`;
|
|
5
|
-
export type TPositiveNumber = number;
|
|
6
|
-
export type TNegativeNumber = number;
|
|
7
|
-
export type TZero = 0;
|
|
8
|
-
export type TDigit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
9
|
-
export type TDigit1_9 = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
10
|
-
export type TNumber0_100 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100;
|
|
11
|
-
export type TNumber0_1000 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999;
|
|
12
|
-
export type TNumber0_5 = 0 | 1 | 2 | 3 | 4 | 5;
|
|
13
|
-
export type TNumber0_10 = TNumber0_5 | 6 | 7 | 8 | 9 | 10;
|
|
14
|
-
export type TNumber0_15 = TNumber0_10 | 11 | 12 | 13 | 14 | 15;
|
|
15
|
-
export type TNumber0_20 = TNumber0_15 | 16 | 17 | 18 | 19 | 20;
|
|
16
|
-
export type TNumber1_10 = Exclude<TNumber0_10, 0>;
|
|
17
|
-
export type TParseInt<T> = T extends `${infer N extends number}` ? N : never;
|
|
18
|
-
export type TParseableInt<T> = T extends `${number}` ? T : never;
|
|
19
|
-
export declare function ensurePositiveNumber(v: number, name?: string): number;
|
|
20
|
-
export declare function ensureNonNegativeNumber(v: number, name?: string): number;
|
|
21
|
-
export declare function ensureNonPositiveNumber(v: number, name?: string): number;
|
|
22
|
-
export declare function ensureNegativeNumber(v: number, name?: string): number;
|
|
23
|
-
export declare function incrementBy(n: number): TFunction<number, number>;
|
|
24
|
-
export declare function multiplyBy(n: number): TFunction<number, number>;
|
|
25
|
-
export declare function divideBy(n: number): TFunction<number, number>;
|
|
26
|
-
export declare const increment: TFunction<number, number>;
|
|
27
|
-
export declare const decrement: TFunction<number, number>;
|
|
28
|
-
export declare const decrementBy: (n: number) => TFunction<number, number>;
|
|
29
|
-
export declare function isNumber(v: unknown): v is number;
|
|
30
|
-
export declare function isPositiveNumber(v: number): v is TPositiveNumber;
|
|
31
|
-
export declare function isNegativeNumber(v: number): v is TNegativeNumber;
|
|
32
|
-
export declare function isZero(v: number): v is TZero;
|
|
33
|
-
export declare function clamp(n: number, min: number, max: number): number;
|
|
34
|
-
export declare function tryToParseNumber(numberStr: string): [undefined, Error] | [number, undefined];
|
package/dist/utils/promises.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import TimeDuration from "../time/TimeDuration.js";
|
|
2
|
-
import { TAsyncFunction, TFunction } from "./functions.js";
|
|
3
|
-
export type TPromisable<T> = T | Promise<T>;
|
|
4
|
-
export declare function asPromise<T>(promisable: TPromisable<T>): Promise<T>;
|
|
5
|
-
export declare function promiseSequence<R>(...fns: TFunction<void, Promise<R>>[]): TFunction<void, Promise<R[]>>;
|
|
6
|
-
export declare function delayPromise<T>(duration: TimeDuration): TAsyncFunction<T, T>;
|
package/dist/utils/random.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { TFunction } from "..";
|
|
2
|
-
export declare function dictToEntries<V, K extends string = string>(obj: Record<K, V>): [K, V][];
|
|
3
|
-
export declare function entriesToDict<V, K extends string = string>(entries: [K, V][]): Record<K, V>;
|
|
4
|
-
export declare function mapEntries<K1 extends string, V1, K2 extends string, V2>(dict: Record<K1, V1>, mapper: TFunction<[K1, V1], [K2, V2]>): Record<K2, V2>;
|
package/dist/utils/records.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export * from './records/entries.js';
|
|
2
|
-
export type TEmpty = Record<string, never>;
|
|
3
|
-
export type TKeysOfType<T, V> = {
|
|
4
|
-
[K in keyof T]-?: T[K] extends V ? K : never;
|
|
5
|
-
}[keyof T];
|
|
6
|
-
export declare function dictToList<T>(obj: Record<string | number, T>): T[];
|
|
7
|
-
export declare function pick<T extends object, K extends keyof T>(o: T, keys: K[]): Pick<T, K>;
|
|
8
|
-
export type TOptionsWithoutDefaults<T, R> = Partial<T> & Required<Omit<T, keyof R>>;
|
|
9
|
-
export type TOptionalKeysForType<T> = {
|
|
10
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? K : never;
|
|
11
|
-
}[keyof T];
|
|
12
|
-
export type TRequiredKeysForType<T> = Exclude<keyof T, TOptionalKeysForType<T>>;
|
|
13
|
-
export type TAllKeysOptional<T> = TRequiredKeysForType<T> extends never ? true : false;
|
|
14
|
-
export type TConditionalParameter<T> = TAllKeysOptional<T> extends true ? T | undefined : T;
|
|
15
|
-
export type TConditionalParameterOptions<T, R> = TConditionalParameter<TOptionsWithoutDefaults<T, R>>;
|
|
16
|
-
/**
|
|
17
|
-
* Given a type T, replaces all fields of type From to fields of type To.
|
|
18
|
-
*/
|
|
19
|
-
export type TReplaceType<T, From, To> = {
|
|
20
|
-
[K in keyof T]: T[K] extends From ? To : T[K];
|
|
21
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { TReadableArray } from "../arrays.js";
|
|
2
|
-
import { TMaybe } from "../nulls.js";
|
|
3
|
-
export declare class StringParts {
|
|
4
|
-
private readonly _parts;
|
|
5
|
-
private constructor();
|
|
6
|
-
toUpperCase(): StringParts;
|
|
7
|
-
toLowerCase(): StringParts;
|
|
8
|
-
capitalizeFirst(): StringParts;
|
|
9
|
-
capitalizeEach(): StringParts;
|
|
10
|
-
get parts(): string[];
|
|
11
|
-
get tail(): string[];
|
|
12
|
-
get first(): TMaybe<string>;
|
|
13
|
-
get last(): TMaybe<string>;
|
|
14
|
-
get length(): number;
|
|
15
|
-
trim(): StringParts;
|
|
16
|
-
toSnakeCase(): string;
|
|
17
|
-
toCamelCase(): string;
|
|
18
|
-
toKebabCase(): string;
|
|
19
|
-
toPascalCase(): string;
|
|
20
|
-
toHumanCase(): string;
|
|
21
|
-
join(separator: string): string;
|
|
22
|
-
mergeWith({ parts: otherParts }: {
|
|
23
|
-
parts: TReadableArray<string>;
|
|
24
|
-
}): StringParts;
|
|
25
|
-
slice(start: number, end?: number): StringParts;
|
|
26
|
-
splice(start: number, deleteCount: number, ...items: string[]): StringParts;
|
|
27
|
-
push(part: string): StringParts;
|
|
28
|
-
shift(part: string): StringParts;
|
|
29
|
-
reverse(): StringParts;
|
|
30
|
-
static fromString: (s: string, separator?: string | RegExp) => StringParts;
|
|
31
|
-
static fromParts: (...parts: string[]) => StringParts;
|
|
32
|
-
}
|
package/dist/utils/strings.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './strings/StringParts.js';
|
|
2
|
-
export type THtmlString = string;
|
|
3
|
-
export type TUrl = string;
|
|
4
|
-
export type TRelativeUrl = string;
|
|
5
|
-
export declare function hashCode(str: string): number;
|
|
6
|
-
export declare function repeat(char: string, times: number): string;
|
|
7
|
-
export declare function capitalizeWord(word: string): string;
|
|
8
|
-
export declare function splitWords(text: string, regEx?: RegExp): string[];
|
|
9
|
-
export declare function stringToNumber(s: string | null | undefined): number | null;
|
|
10
|
-
export declare function pad(str: string, n: number, char: string, where?: 'left' | 'right'): string;
|
|
11
|
-
export declare function padLeft(str: string, n: number, char: string): string;
|
|
12
|
-
export declare function padRight(str: string, n: number, char: string): string;
|
|
13
|
-
export declare function ellipsis(str: string, maxLength: number): string;
|
|
14
|
-
export declare function pluralize(n: number, singular: string, plural?: string): string;
|
|
15
|
-
export declare function wrapWithString(str: string, delimiter: string): string;
|
|
16
|
-
/** @deprecated[2024-12-23]: Use {@link wrapWithString} instead. */
|
|
17
|
-
export declare const wrap: typeof wrapWithString;
|