@duplojs/utils 1.6.1 → 1.6.3
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/dist/array/types/createTuple.d.ts +1 -1
- package/dist/clean/constraint/base.cjs +7 -0
- package/dist/clean/constraint/base.d.ts +26 -6
- package/dist/clean/constraint/base.mjs +7 -0
- package/dist/clean/constraint/cast.cjs +18 -0
- package/dist/clean/constraint/cast.d.ts +29 -0
- package/dist/clean/constraint/cast.mjs +16 -0
- package/dist/clean/constraint/defaultConstraint/number.cjs +2 -10
- package/dist/clean/constraint/defaultConstraint/number.d.ts +12 -37
- package/dist/clean/constraint/defaultConstraint/number.mjs +3 -10
- package/dist/clean/constraint/defaultConstraint/string.d.ts +9 -5
- package/dist/clean/constraint/index.d.ts +1 -0
- package/dist/clean/constraint/set.cjs +7 -1
- package/dist/clean/constraint/set.d.ts +25 -5
- package/dist/clean/constraint/set.mjs +7 -1
- package/dist/clean/entity/index.cjs +14 -4
- package/dist/clean/entity/index.d.ts +11 -1
- package/dist/clean/entity/index.mjs +15 -6
- package/dist/clean/index.cjs +5 -1
- package/dist/clean/index.d.ts +1 -0
- package/dist/clean/index.mjs +4 -2
- package/dist/clean/newType.cjs +6 -1
- package/dist/clean/newType.d.ts +20 -5
- package/dist/clean/newType.mjs +6 -1
- package/dist/clean/primitive/operations/equal.cjs +3 -0
- package/dist/clean/primitive/operations/equal.d.ts +2 -2
- package/dist/clean/primitive/operations/equal.mjs +3 -0
- package/dist/clean/toMapDataParser.cjs +52 -0
- package/dist/clean/toMapDataParser.d.ts +53 -0
- package/dist/clean/toMapDataParser.mjs +50 -0
- package/dist/common/asserts.cjs +12 -0
- package/dist/common/asserts.d.ts +26 -0
- package/dist/common/asserts.mjs +12 -1
- package/dist/common/callThen.cjs +14 -0
- package/dist/common/callThen.d.ts +35 -0
- package/dist/common/callThen.mjs +12 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/printer.cjs +73 -0
- package/dist/common/printer.d.ts +139 -0
- package/dist/common/printer.mjs +73 -0
- package/dist/common/queue.cjs +90 -0
- package/dist/common/queue.d.ts +46 -0
- package/dist/common/queue.mjs +87 -0
- package/dist/common/types/and.d.ts +1 -2
- package/dist/common/types/or.d.ts +1 -2
- package/dist/dataParser/base.cjs +12 -35
- package/dist/dataParser/base.d.ts +6 -9
- package/dist/dataParser/base.mjs +8 -30
- package/dist/dataParser/error.cjs +39 -21
- package/dist/dataParser/error.d.ts +19 -19
- package/dist/dataParser/error.mjs +37 -18
- package/dist/dataParser/extended/index.cjs +3 -4
- package/dist/dataParser/extended/index.mjs +1 -1
- package/dist/dataParser/identifier.d.ts +6 -6
- package/dist/dataParser/index.cjs +3 -6
- package/dist/dataParser/index.mjs +2 -2
- package/dist/dataParser/parsers/array/checkers/max.cjs +3 -6
- package/dist/dataParser/parsers/array/checkers/max.mjs +4 -7
- package/dist/dataParser/parsers/array/checkers/min.cjs +3 -6
- package/dist/dataParser/parsers/array/checkers/min.mjs +4 -7
- package/dist/dataParser/parsers/array/index.cjs +8 -8
- package/dist/dataParser/parsers/array/index.mjs +4 -4
- package/dist/dataParser/parsers/bigint/checkers/max.cjs +2 -2
- package/dist/dataParser/parsers/bigint/checkers/max.mjs +3 -3
- package/dist/dataParser/parsers/bigint/checkers/min.cjs +2 -2
- package/dist/dataParser/parsers/bigint/checkers/min.mjs +3 -3
- package/dist/dataParser/parsers/bigint/index.cjs +2 -2
- package/dist/dataParser/parsers/bigint/index.mjs +3 -3
- package/dist/dataParser/parsers/boolean.cjs +3 -3
- package/dist/dataParser/parsers/boolean.mjs +4 -4
- package/dist/dataParser/parsers/date.cjs +4 -4
- package/dist/dataParser/parsers/date.mjs +5 -5
- package/dist/dataParser/parsers/empty.cjs +2 -2
- package/dist/dataParser/parsers/empty.mjs +3 -3
- package/dist/dataParser/parsers/literal.cjs +2 -2
- package/dist/dataParser/parsers/literal.mjs +3 -3
- package/dist/dataParser/parsers/nil.cjs +2 -2
- package/dist/dataParser/parsers/nil.mjs +3 -3
- package/dist/dataParser/parsers/number/checkers/int.cjs +2 -2
- package/dist/dataParser/parsers/number/checkers/int.mjs +3 -3
- package/dist/dataParser/parsers/number/checkers/max.cjs +3 -1
- package/dist/dataParser/parsers/number/checkers/max.mjs +4 -2
- package/dist/dataParser/parsers/number/checkers/min.cjs +3 -1
- package/dist/dataParser/parsers/number/checkers/min.mjs +4 -2
- package/dist/dataParser/parsers/number/index.cjs +2 -2
- package/dist/dataParser/parsers/number/index.mjs +3 -3
- package/dist/dataParser/parsers/object/index.cjs +8 -8
- package/dist/dataParser/parsers/object/index.mjs +4 -4
- package/dist/dataParser/parsers/pipe.cjs +25 -10
- package/dist/dataParser/parsers/pipe.mjs +22 -7
- package/dist/dataParser/parsers/record/index.cjs +18 -16
- package/dist/dataParser/parsers/record/index.mjs +8 -6
- package/dist/dataParser/parsers/recover.cjs +7 -6
- package/dist/dataParser/parsers/recover.mjs +2 -1
- package/dist/dataParser/parsers/refine.cjs +3 -1
- package/dist/dataParser/parsers/refine.mjs +4 -2
- package/dist/dataParser/parsers/string/checkers/email.cjs +2 -2
- package/dist/dataParser/parsers/string/checkers/email.mjs +3 -3
- package/dist/dataParser/parsers/string/checkers/max.cjs +3 -1
- package/dist/dataParser/parsers/string/checkers/max.mjs +4 -2
- package/dist/dataParser/parsers/string/checkers/min.cjs +3 -1
- package/dist/dataParser/parsers/string/checkers/min.mjs +4 -2
- package/dist/dataParser/parsers/string/checkers/regex.cjs +2 -2
- package/dist/dataParser/parsers/string/checkers/regex.mjs +3 -3
- package/dist/dataParser/parsers/string/checkers/url.cjs +4 -4
- package/dist/dataParser/parsers/string/checkers/url.mjs +5 -5
- package/dist/dataParser/parsers/string/index.cjs +2 -2
- package/dist/dataParser/parsers/string/index.mjs +3 -3
- package/dist/dataParser/parsers/templateLiteral/index.cjs +2 -2
- package/dist/dataParser/parsers/templateLiteral/index.mjs +3 -3
- package/dist/dataParser/parsers/time/checkers/max.cjs +3 -1
- package/dist/dataParser/parsers/time/checkers/max.mjs +4 -2
- package/dist/dataParser/parsers/time/checkers/min.cjs +3 -1
- package/dist/dataParser/parsers/time/checkers/min.mjs +4 -2
- package/dist/dataParser/parsers/time/index.cjs +4 -4
- package/dist/dataParser/parsers/time/index.mjs +5 -5
- package/dist/dataParser/parsers/transform.cjs +6 -6
- package/dist/dataParser/parsers/transform.d.ts +2 -2
- package/dist/dataParser/parsers/transform.mjs +4 -4
- package/dist/dataParser/parsers/tuple.cjs +14 -14
- package/dist/dataParser/parsers/tuple.mjs +4 -4
- package/dist/dataParser/parsers/union.cjs +26 -8
- package/dist/dataParser/parsers/union.mjs +26 -8
- package/dist/flow/calledByNext.cjs +13 -0
- package/dist/flow/calledByNext.d.ts +47 -0
- package/dist/flow/calledByNext.mjs +11 -0
- package/dist/flow/debounce.cjs +16 -0
- package/dist/flow/debounce.d.ts +63 -0
- package/dist/flow/debounce.mjs +14 -0
- package/dist/flow/exec.cjs +101 -0
- package/dist/flow/exec.d.ts +4 -3
- package/dist/flow/exec.mjs +101 -0
- package/dist/flow/index.cjs +28 -0
- package/dist/flow/index.d.ts +5 -0
- package/dist/flow/index.mjs +10 -1
- package/dist/flow/queue.cjs +19 -0
- package/dist/flow/queue.d.ts +47 -0
- package/dist/flow/queue.mjs +17 -0
- package/dist/flow/run.cjs +118 -0
- package/dist/flow/run.d.ts +6 -4
- package/dist/flow/run.mjs +113 -1
- package/dist/flow/theFlow/calledByNext.cjs +11 -0
- package/dist/flow/theFlow/calledByNext.d.ts +5 -0
- package/dist/flow/theFlow/calledByNext.mjs +8 -0
- package/dist/flow/theFlow/debounce.cjs +11 -0
- package/dist/flow/theFlow/debounce.d.ts +9 -0
- package/dist/flow/theFlow/debounce.mjs +8 -0
- package/dist/flow/theFlow/index.d.ts +11 -3
- package/dist/flow/theFlow/queue.cjs +11 -0
- package/dist/flow/theFlow/queue.d.ts +9 -0
- package/dist/flow/theFlow/queue.mjs +8 -0
- package/dist/flow/theFlow/throttling.cjs +11 -0
- package/dist/flow/theFlow/throttling.d.ts +10 -0
- package/dist/flow/theFlow/throttling.mjs +8 -0
- package/dist/flow/throttling.cjs +27 -0
- package/dist/flow/throttling.d.ts +60 -0
- package/dist/flow/throttling.mjs +25 -0
- package/dist/flow/toFunction.cjs +15 -0
- package/dist/flow/toFunction.d.ts +56 -0
- package/dist/flow/toFunction.mjs +13 -0
- package/dist/index.cjs +11 -0
- package/dist/index.mjs +4 -1
- package/dist/metadata.json +126 -0
- package/dist/number/types/isGreater.d.ts +26 -3
- package/dist/object/types/getPropsWithValue.d.ts +1 -1
- package/dist/object/types/getPropsWithValueExtends.d.ts +1 -1
- package/dist/string/length.d.ts +2 -2
- package/dist/string/types/split.d.ts +6 -5
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type OnlyLiteralBoolean, type IsEqual } from "../common";
|
|
2
|
+
import { type Throttling } from "./theFlow";
|
|
3
|
+
/**
|
|
4
|
+
* Throttles repeated runs of the same flow and can return a fallback value when a run happens too early.
|
|
5
|
+
*
|
|
6
|
+
* **Supported call styles:**
|
|
7
|
+
* - Classic: `throttling(time)` -> yields a throttling effect
|
|
8
|
+
* - Classic with options: `throttling(time, params)` -> yields a throttling effect with a fallback return value and optional `keepLast`
|
|
9
|
+
*
|
|
10
|
+
* `throttling` lets the runner decide whether the current run should continue or stop early depending on the previous execution time of the same flow.
|
|
11
|
+
* When a run happens inside the throttling window, the runner can return `params.returnValue`.
|
|
12
|
+
* With `keepLast: true`, the runner keeps the last skipped async run and resumes it after the delay.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* const searchFlow = F.create(
|
|
16
|
+
* function *(query: string) {
|
|
17
|
+
* yield *F.throttling(
|
|
18
|
+
* 300,
|
|
19
|
+
* { returnValue: "skipped" as const },
|
|
20
|
+
* );
|
|
21
|
+
* return query;
|
|
22
|
+
* },
|
|
23
|
+
* );
|
|
24
|
+
* const runSearch = F.toFunction(searchFlow);
|
|
25
|
+
*
|
|
26
|
+
* runSearch("first"); // "first"
|
|
27
|
+
*
|
|
28
|
+
* runSearch("second"); // "skipped"
|
|
29
|
+
*
|
|
30
|
+
* const latestFlow = F.create(
|
|
31
|
+
* async function *(value: string) {
|
|
32
|
+
* yield *F.throttling(
|
|
33
|
+
* 500,
|
|
34
|
+
* {
|
|
35
|
+
* returnValue: "ignored" as const,
|
|
36
|
+
* keepLast: true,
|
|
37
|
+
* },
|
|
38
|
+
* );
|
|
39
|
+
* return Promise.resolve(value);
|
|
40
|
+
* },
|
|
41
|
+
* );
|
|
42
|
+
* const runLatestFlow = F.toFunction(latestFlow);
|
|
43
|
+
* await runLatestFlow("latest"); // Promise<"latest" | "ignored">
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* - `keepLast: true` changes the helper to an async generator because the runner may resume the latest skipped run later
|
|
48
|
+
* - Throttling state is attached to the flow reference, so examples should reuse the same created flow or wrapped function
|
|
49
|
+
* - If the same flow execution yields `throttling(...)` multiple times, only the first yielded effect is applied by the runner
|
|
50
|
+
*
|
|
51
|
+
* @see [`F.run`](https://utils.duplojs.dev/en/v1/api/flow/run) For the throttling behavior implemented by the runner
|
|
52
|
+
* @see https://utils.duplojs.dev/en/v1/api/flow/throttling
|
|
53
|
+
*
|
|
54
|
+
* @namespace F
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
export declare function throttling<GenericValue extends unknown = undefined, GenericKeepLast extends boolean = false>(time: number, params?: {
|
|
58
|
+
returnValue?: GenericValue;
|
|
59
|
+
keepLast?: GenericKeepLast & OnlyLiteralBoolean<GenericKeepLast>;
|
|
60
|
+
}): IsEqual<GenericKeepLast, true> extends true ? AsyncGenerator<Throttling<NoInfer<GenericValue>>, undefined> : Generator<Throttling<NoInfer<GenericValue>>, undefined>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createThrottling } from './theFlow/throttling.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* {@include flow/throttling/index.md}
|
|
5
|
+
*/
|
|
6
|
+
function throttling(time, params) {
|
|
7
|
+
if (params?.keepLast === true) {
|
|
8
|
+
return (async function* () {
|
|
9
|
+
yield createThrottling({
|
|
10
|
+
time,
|
|
11
|
+
returnValue: params?.returnValue,
|
|
12
|
+
keepLast: true,
|
|
13
|
+
});
|
|
14
|
+
})();
|
|
15
|
+
}
|
|
16
|
+
return (function* () {
|
|
17
|
+
yield createThrottling({
|
|
18
|
+
time,
|
|
19
|
+
returnValue: params?.returnValue,
|
|
20
|
+
keepLast: false,
|
|
21
|
+
});
|
|
22
|
+
})();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { throttling };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var run = require('./run.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* {@include flow/toFunction/index.md}
|
|
7
|
+
*/
|
|
8
|
+
function toFunction(flow, ...[params]) {
|
|
9
|
+
return (input) => run.run(flow, {
|
|
10
|
+
...params,
|
|
11
|
+
input,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.toFunction = toFunction;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type SimplifyTopLevel, type IsEqual } from "../common";
|
|
2
|
+
import { type RunResult } from "./run";
|
|
3
|
+
import { type WrapFlow, type TheFlow, type TheFlowFunction, type FlowDependencies, type TheFlowGenerator } from "./theFlow";
|
|
4
|
+
type ComputeToFunctionParams<GenericDependencies extends Record<string, unknown> = Record<string, unknown>> = SimplifyTopLevel<{
|
|
5
|
+
includeDetails?: boolean;
|
|
6
|
+
} & ({} extends GenericDependencies ? {
|
|
7
|
+
dependencies?: GenericDependencies;
|
|
8
|
+
} : {
|
|
9
|
+
dependencies: GenericDependencies;
|
|
10
|
+
})>;
|
|
11
|
+
/**
|
|
12
|
+
* Converts a flow into a plain callable function that delegates to `F.run(...)`.
|
|
13
|
+
*
|
|
14
|
+
* **Supported call styles:**
|
|
15
|
+
* - Classic with a flow function: `toFunction(flow, params?)` -> returns a callable function
|
|
16
|
+
* - Classic with a flow instance: `toFunction(flow, params?)` -> returns a callable function
|
|
17
|
+
*
|
|
18
|
+
* `toFunction` wraps a flow function or a flow created with `F.create(...)` and returns a regular function that accepts only the flow input.
|
|
19
|
+
* The provided options are forwarded to `F.run(...)`, which means you can preconfigure `includeDetails` and `dependencies`.
|
|
20
|
+
* Use it when a flow should be exposed as a reusable application function instead of being run manually each time.
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* const runUppercase = F.toFunction(
|
|
24
|
+
* function *(input: string) {
|
|
25
|
+
* yield *F.step("uppercase");
|
|
26
|
+
* return input.toUpperCase();
|
|
27
|
+
* },
|
|
28
|
+
* );
|
|
29
|
+
* runUppercase("duplo"); // "DUPLO"
|
|
30
|
+
*
|
|
31
|
+
* const runWithDetails = F.toFunction(
|
|
32
|
+
* function *(input: string) {
|
|
33
|
+
* yield *F.step("format");
|
|
34
|
+
* return input.length;
|
|
35
|
+
* },
|
|
36
|
+
* { includeDetails: true },
|
|
37
|
+
* );
|
|
38
|
+
* runWithDetails("hello"); // { result: 5, steps: ["format"] }
|
|
39
|
+
*
|
|
40
|
+
* const service = F.createDependence("service")<string>;
|
|
41
|
+
* const runWithDependencies = F.toFunction(
|
|
42
|
+
* function *(input: string) {
|
|
43
|
+
* const currentService = yield *F.inject(service);
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* - `toFunction` keeps the same sync or async return shape as `F.run(...)` for the wrapped flow
|
|
48
|
+
*
|
|
49
|
+
* @see [`F.run`](https://utils.duplojs.dev/en/v1/api/flow/run) For the execution behavior used internally
|
|
50
|
+
* @see https://utils.duplojs.dev/en/v1/api/flow/toFunction
|
|
51
|
+
*
|
|
52
|
+
* @namespace F
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
export declare function toFunction<GenericInput extends unknown, GenericOutput extends TheFlowGenerator, GenericWrapFlow extends WrapFlow<TheFlowFunction<GenericInput, GenericOutput>>, const GenericParams extends ComputeToFunctionParams<FlowDependencies<GenericWrapFlow>>>(flow: (TheFlowFunction<GenericInput, GenericOutput> | TheFlow<TheFlowFunction<GenericInput, GenericOutput>>), ...[params]: ({} extends GenericParams ? [params?: GenericParams] : [params: GenericParams])): (input: GenericInput) => RunResult<GenericWrapFlow, IsEqual<GenericParams["includeDetails"], true>>;
|
|
56
|
+
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -67,6 +67,9 @@ var path = require('./common/path.cjs');
|
|
|
67
67
|
var transformer = require('./common/transformer.cjs');
|
|
68
68
|
var toRegExp = require('./common/toRegExp.cjs');
|
|
69
69
|
var justExec = require('./common/justExec.cjs');
|
|
70
|
+
var callThen = require('./common/callThen.cjs');
|
|
71
|
+
var queue = require('./common/queue.cjs');
|
|
72
|
+
var printer = require('./common/printer.cjs');
|
|
70
73
|
|
|
71
74
|
|
|
72
75
|
|
|
@@ -160,6 +163,7 @@ exports.toCurriedPredicate = toCurriedPredicate.toCurriedPredicate;
|
|
|
160
163
|
exports.pipeCall = pipeCall.pipeCall;
|
|
161
164
|
exports.AssertsError = asserts.AssertsError;
|
|
162
165
|
exports.asserts = asserts.asserts;
|
|
166
|
+
exports.forwardAsserts = asserts.forwardAsserts;
|
|
163
167
|
Object.defineProperty(exports, "Path", {
|
|
164
168
|
enumerable: true,
|
|
165
169
|
get: function () { return path.Path; }
|
|
@@ -170,3 +174,10 @@ exports.toNative = transformer.toNative;
|
|
|
170
174
|
exports.transformer = transformer.transformer;
|
|
171
175
|
exports.toRegExp = toRegExp.toRegExp;
|
|
172
176
|
exports.justExec = justExec.justExec;
|
|
177
|
+
exports.callThen = callThen.callThen;
|
|
178
|
+
exports.createQueue = queue.createQueue;
|
|
179
|
+
exports.queueKind = queue.queueKind;
|
|
180
|
+
Object.defineProperty(exports, "Printer", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function () { return printer.Printer; }
|
|
183
|
+
});
|
package/dist/index.mjs
CHANGED
|
@@ -86,8 +86,11 @@ export { hasSomeKinds } from './common/hasSomeKinds.mjs';
|
|
|
86
86
|
export { hasKinds } from './common/hasKinds.mjs';
|
|
87
87
|
export { toCurriedPredicate } from './common/toCurriedPredicate.mjs';
|
|
88
88
|
export { pipeCall } from './common/pipeCall.mjs';
|
|
89
|
-
export { AssertsError, asserts } from './common/asserts.mjs';
|
|
89
|
+
export { AssertsError, asserts, forwardAsserts } from './common/asserts.mjs';
|
|
90
90
|
export { Path } from './common/path.mjs';
|
|
91
91
|
export { createTransformer, toJSON, toNative, transformer } from './common/transformer.mjs';
|
|
92
92
|
export { toRegExp } from './common/toRegExp.mjs';
|
|
93
93
|
export { justExec } from './common/justExec.mjs';
|
|
94
|
+
export { callThen } from './common/callThen.mjs';
|
|
95
|
+
export { createQueue, queueKind } from './common/queue.mjs';
|
|
96
|
+
export { Printer } from './common/printer.mjs';
|
package/dist/metadata.json
CHANGED
|
@@ -645,6 +645,15 @@
|
|
|
645
645
|
{
|
|
646
646
|
"name": "base.mjs"
|
|
647
647
|
},
|
|
648
|
+
{
|
|
649
|
+
"name": "cast.cjs"
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
"name": "cast.d.ts"
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"name": "cast.mjs"
|
|
656
|
+
},
|
|
648
657
|
{
|
|
649
658
|
"name": "index.d.ts"
|
|
650
659
|
},
|
|
@@ -1038,6 +1047,15 @@
|
|
|
1038
1047
|
{
|
|
1039
1048
|
"name": "repository.mjs"
|
|
1040
1049
|
},
|
|
1050
|
+
{
|
|
1051
|
+
"name": "toMapDataParser.cjs"
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
"name": "toMapDataParser.d.ts"
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
"name": "toMapDataParser.mjs"
|
|
1058
|
+
},
|
|
1041
1059
|
{
|
|
1042
1060
|
"name": "useCase.cjs"
|
|
1043
1061
|
},
|
|
@@ -1279,6 +1297,15 @@
|
|
|
1279
1297
|
{
|
|
1280
1298
|
"name": "builder.mjs"
|
|
1281
1299
|
},
|
|
1300
|
+
{
|
|
1301
|
+
"name": "callThen.cjs"
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
"name": "callThen.d.ts"
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
"name": "callThen.mjs"
|
|
1308
|
+
},
|
|
1282
1309
|
{
|
|
1283
1310
|
"name": "clone.cjs"
|
|
1284
1311
|
},
|
|
@@ -1552,6 +1579,15 @@
|
|
|
1552
1579
|
{
|
|
1553
1580
|
"name": "pipeCall.mjs"
|
|
1554
1581
|
},
|
|
1582
|
+
{
|
|
1583
|
+
"name": "printer.cjs"
|
|
1584
|
+
},
|
|
1585
|
+
{
|
|
1586
|
+
"name": "printer.d.ts"
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
"name": "printer.mjs"
|
|
1590
|
+
},
|
|
1555
1591
|
{
|
|
1556
1592
|
"name": "promiseObject.cjs"
|
|
1557
1593
|
},
|
|
@@ -1561,6 +1597,15 @@
|
|
|
1561
1597
|
{
|
|
1562
1598
|
"name": "promiseObject.mjs"
|
|
1563
1599
|
},
|
|
1600
|
+
{
|
|
1601
|
+
"name": "queue.cjs"
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
"name": "queue.d.ts"
|
|
1605
|
+
},
|
|
1606
|
+
{
|
|
1607
|
+
"name": "queue.mjs"
|
|
1608
|
+
},
|
|
1564
1609
|
{
|
|
1565
1610
|
"name": "simpleClone.cjs"
|
|
1566
1611
|
},
|
|
@@ -3917,6 +3962,24 @@
|
|
|
3917
3962
|
{
|
|
3918
3963
|
"name": "break.mjs"
|
|
3919
3964
|
},
|
|
3965
|
+
{
|
|
3966
|
+
"name": "calledByNext.cjs"
|
|
3967
|
+
},
|
|
3968
|
+
{
|
|
3969
|
+
"name": "calledByNext.d.ts"
|
|
3970
|
+
},
|
|
3971
|
+
{
|
|
3972
|
+
"name": "calledByNext.mjs"
|
|
3973
|
+
},
|
|
3974
|
+
{
|
|
3975
|
+
"name": "debounce.cjs"
|
|
3976
|
+
},
|
|
3977
|
+
{
|
|
3978
|
+
"name": "debounce.d.ts"
|
|
3979
|
+
},
|
|
3980
|
+
{
|
|
3981
|
+
"name": "debounce.mjs"
|
|
3982
|
+
},
|
|
3920
3983
|
{
|
|
3921
3984
|
"name": "defer.cjs"
|
|
3922
3985
|
},
|
|
@@ -3971,6 +4034,15 @@
|
|
|
3971
4034
|
{
|
|
3972
4035
|
"name": "injection.mjs"
|
|
3973
4036
|
},
|
|
4037
|
+
{
|
|
4038
|
+
"name": "queue.cjs"
|
|
4039
|
+
},
|
|
4040
|
+
{
|
|
4041
|
+
"name": "queue.d.ts"
|
|
4042
|
+
},
|
|
4043
|
+
{
|
|
4044
|
+
"name": "queue.mjs"
|
|
4045
|
+
},
|
|
3974
4046
|
{
|
|
3975
4047
|
"name": "step.cjs"
|
|
3976
4048
|
},
|
|
@@ -3979,6 +4051,15 @@
|
|
|
3979
4051
|
},
|
|
3980
4052
|
{
|
|
3981
4053
|
"name": "step.mjs"
|
|
4054
|
+
},
|
|
4055
|
+
{
|
|
4056
|
+
"name": "throttling.cjs"
|
|
4057
|
+
},
|
|
4058
|
+
{
|
|
4059
|
+
"name": "throttling.d.ts"
|
|
4060
|
+
},
|
|
4061
|
+
{
|
|
4062
|
+
"name": "throttling.mjs"
|
|
3982
4063
|
}
|
|
3983
4064
|
]
|
|
3984
4065
|
},
|
|
@@ -3999,6 +4080,24 @@
|
|
|
3999
4080
|
{
|
|
4000
4081
|
"name": "breakIf.mjs"
|
|
4001
4082
|
},
|
|
4083
|
+
{
|
|
4084
|
+
"name": "calledByNext.cjs"
|
|
4085
|
+
},
|
|
4086
|
+
{
|
|
4087
|
+
"name": "calledByNext.d.ts"
|
|
4088
|
+
},
|
|
4089
|
+
{
|
|
4090
|
+
"name": "calledByNext.mjs"
|
|
4091
|
+
},
|
|
4092
|
+
{
|
|
4093
|
+
"name": "debounce.cjs"
|
|
4094
|
+
},
|
|
4095
|
+
{
|
|
4096
|
+
"name": "debounce.d.ts"
|
|
4097
|
+
},
|
|
4098
|
+
{
|
|
4099
|
+
"name": "debounce.mjs"
|
|
4100
|
+
},
|
|
4002
4101
|
{
|
|
4003
4102
|
"name": "defer.cjs"
|
|
4004
4103
|
},
|
|
@@ -4071,6 +4170,15 @@
|
|
|
4071
4170
|
{
|
|
4072
4171
|
"name": "kind.mjs"
|
|
4073
4172
|
},
|
|
4173
|
+
{
|
|
4174
|
+
"name": "queue.cjs"
|
|
4175
|
+
},
|
|
4176
|
+
{
|
|
4177
|
+
"name": "queue.d.ts"
|
|
4178
|
+
},
|
|
4179
|
+
{
|
|
4180
|
+
"name": "queue.mjs"
|
|
4181
|
+
},
|
|
4074
4182
|
{
|
|
4075
4183
|
"name": "run.cjs"
|
|
4076
4184
|
},
|
|
@@ -4088,6 +4196,24 @@
|
|
|
4088
4196
|
},
|
|
4089
4197
|
{
|
|
4090
4198
|
"name": "step.mjs"
|
|
4199
|
+
},
|
|
4200
|
+
{
|
|
4201
|
+
"name": "throttling.cjs"
|
|
4202
|
+
},
|
|
4203
|
+
{
|
|
4204
|
+
"name": "throttling.d.ts"
|
|
4205
|
+
},
|
|
4206
|
+
{
|
|
4207
|
+
"name": "throttling.mjs"
|
|
4208
|
+
},
|
|
4209
|
+
{
|
|
4210
|
+
"name": "toFunction.cjs"
|
|
4211
|
+
},
|
|
4212
|
+
{
|
|
4213
|
+
"name": "toFunction.d.ts"
|
|
4214
|
+
},
|
|
4215
|
+
{
|
|
4216
|
+
"name": "toFunction.mjs"
|
|
4091
4217
|
}
|
|
4092
4218
|
]
|
|
4093
4219
|
},
|
|
@@ -25,10 +25,33 @@ type CheckIsGreater<GreaterSplitValue extends AnyTuple<DString.Digit>, GreaterTa
|
|
|
25
25
|
infer InferredRestSplitValue extends AnyTuple<DString.Digit>,
|
|
26
26
|
infer InferredRestSplitReference extends AnyTuple<FigureGreaterThanTableValue>
|
|
27
27
|
] ? CheckIsGreater<InferredRestSplitValue, InferredRestSplitReference> : never : false;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
type toStringDecimal<GenericValue extends number> = `${GenericValue}` extends `${DString.Number}.${DString.Number}` ? `${GenericValue}` : `${GenericValue}.0`;
|
|
29
|
+
type PrepareValues<GenericValue extends number, GenericReference extends number> = [
|
|
30
|
+
toStringDecimal<GenericValue>,
|
|
31
|
+
toStringDecimal<GenericReference>
|
|
31
32
|
] extends [
|
|
33
|
+
`${infer InferredValueInteger extends DString.Number}.${infer InferredValueDecimals extends DString.Number}`,
|
|
34
|
+
`${infer InferredReferenceInteger extends DString.Number}.${infer InferredReferenceDecimals extends DString.Number}`
|
|
35
|
+
] ? And<[
|
|
36
|
+
IsEqual<InferredValueDecimals, "0">,
|
|
37
|
+
IsEqual<InferredReferenceDecimals, "0">
|
|
38
|
+
]> extends true ? [InferredValueInteger, InferredReferenceInteger] : IsEqual<InferredValueInteger, InferredReferenceInteger> extends true ? [
|
|
39
|
+
DString.Split<InferredValueDecimals, "">,
|
|
40
|
+
DString.Split<InferredReferenceDecimals, "">
|
|
41
|
+
] extends [
|
|
42
|
+
infer InferredSplitValue extends AnyTuple<DString.Digit>,
|
|
43
|
+
infer InferredSplitReference extends AnyTuple<DString.Digit>
|
|
44
|
+
] ? (IsEqual<InferredSplitValue["length"], InferredSplitReference["length"]> extends true ? [
|
|
45
|
+
DArray.JoinTuple<InferredSplitValue, "">,
|
|
46
|
+
DArray.JoinTuple<InferredSplitReference, "">
|
|
47
|
+
] : (DArray.CreateTuple<any, InferredSplitValue["length"]> extends [...DArray.CreateTuple<any, InferredSplitReference["length"]>, ...any[]] ? InferredSplitValue["length"] : InferredSplitReference["length"]) extends infer InferredLength extends number ? [
|
|
48
|
+
DArray.JoinTuple<Extract<IsEqual<InferredLength, InferredSplitValue["length"]> extends true ? InferredSplitValue : DArray.CreateTuple<"0", InferredLength, InferredSplitValue>, AnyTuple<string>>, "">,
|
|
49
|
+
DArray.JoinTuple<Extract<IsEqual<InferredLength, InferredSplitReference["length"]> extends true ? InferredSplitReference : DArray.CreateTuple<"0", InferredLength, InferredSplitReference>, AnyTuple<string>>, "">
|
|
50
|
+
] : never) extends [
|
|
51
|
+
`${infer InferredResultValue}`,
|
|
52
|
+
`${infer InferredResultReference}`
|
|
53
|
+
] ? [`${InferredResultValue}`, `${InferredResultReference}`] : never : never : [InferredValueInteger, InferredReferenceInteger] : never;
|
|
54
|
+
export type IsGreater<GenericValue extends number, GenericReference extends number> = IsEqual<GenericValue, GenericReference> extends true ? true : PrepareValues<GenericValue, GenericReference> extends [
|
|
32
55
|
infer InferredValue extends DString.Number,
|
|
33
56
|
infer InferredReference extends DString.Number
|
|
34
57
|
] ? And<[
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type IsEqual } from "../../common";
|
|
2
2
|
export type GetPropsWithValue<GenericObject extends object, GenericValue extends unknown> = {
|
|
3
|
-
[Prop in keyof GenericObject]
|
|
3
|
+
[Prop in keyof GenericObject]-?: IsEqual<GenericObject[Prop], GenericValue> extends true ? Prop : never;
|
|
4
4
|
}[keyof GenericObject];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type GetPropsWithValueExtends<GenericObject extends object, GenericValue extends unknown> = {
|
|
2
|
-
[Prop in keyof GenericObject]
|
|
2
|
+
[Prop in keyof GenericObject]-?: GenericObject[Prop] extends infer InferredValue ? InferredValue extends GenericValue ? Prop : never : never;
|
|
3
3
|
}[keyof GenericObject];
|
package/dist/string/length.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type StringLength } from "./types
|
|
1
|
+
import { type TemplateLiteralContainLargeType, type StringLength } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Returns the length of a string.
|
|
4
4
|
*
|
|
@@ -23,4 +23,4 @@ import { type StringLength } from "./types/stringLength";
|
|
|
23
23
|
* @namespace S
|
|
24
24
|
*
|
|
25
25
|
*/
|
|
26
|
-
export declare function length<GenericInput extends string>(input: GenericInput): StringLength<GenericInput>;
|
|
26
|
+
export declare function length<GenericInput extends string>(input: GenericInput): TemplateLiteralContainLargeType<GenericInput> extends true ? number : StringLength<GenericInput>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type IsEqual } from "../../common";
|
|
2
2
|
import { type Includes } from "./includes";
|
|
3
3
|
import { type TemplateLiteralContainLargeType } from "./templateLiteralContainLargeType";
|
|
4
|
+
import { type CreateTuple } from "../../array";
|
|
4
5
|
type _Split<GenericString extends string, GenericSeparator extends string, GenericLimit extends number = number, GenericLastResult extends string[] = []> = GenericString extends `${infer InferredBefore}${GenericSeparator}${infer InferredAfter}` ? [...GenericLastResult, InferredBefore] extends infer InferredResult extends any[] ? IsEqual<InferredAfter, ""> extends true ? InferredResult : IsEqual<InferredResult["length"], 250> extends true ? Includes<InferredAfter, GenericSeparator> extends true ? [...InferredResult, ...string[]] : InferredResult : IsEqual<InferredResult["length"], GenericLimit> extends true ? InferredResult : _Split<InferredAfter, GenericSeparator, GenericLimit, InferredResult> : never : [...GenericLastResult, GenericString];
|
|
5
|
-
export type Split<GenericString extends string, GenericSeparator extends string, GenericLimit extends number = number> = IsEqual<GenericLimit, 0> extends true ? [] :
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
]
|
|
6
|
+
export type Split<GenericString extends string, GenericSeparator extends string, GenericLimit extends number = number> = IsEqual<GenericLimit, 0> extends true ? [] : TemplateLiteralContainLargeType<GenericSeparator> extends true ? [string, ...string[]] : TemplateLiteralContainLargeType<GenericString> extends true ? [
|
|
7
|
+
...CreateTuple<string, _Split<GenericString, GenericSeparator, GenericLimit>["length"]>,
|
|
8
|
+
...string[]
|
|
9
|
+
] : _Split<GenericString, GenericSeparator, GenericLimit>;
|
|
9
10
|
export {};
|