@duplojs/utils 1.1.12 → 1.1.14
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/flat.cjs +1 -13
- package/dist/array/flat.d.ts +1 -4
- package/dist/array/flat.mjs +1 -13
- package/dist/array/index.cjs +2 -0
- package/dist/array/index.d.ts +1 -0
- package/dist/array/index.mjs +1 -0
- package/dist/array/notIncludes.cjs +12 -0
- package/dist/array/notIncludes.d.ts +4 -0
- package/dist/array/notIncludes.mjs +10 -0
- package/dist/array/reduce.d.ts +6 -7
- package/dist/array/reduceRight.d.ts +4 -3
- package/dist/common/createKindIdentifier.cjs +27 -0
- package/dist/common/createKindIdentifier.d.ts +7 -0
- package/dist/common/createKindIdentifier.mjs +25 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/kind.cjs +15 -12
- package/dist/common/kind.d.ts +2 -2
- package/dist/common/kind.mjs +15 -12
- package/dist/common/or.d.ts +9 -9
- package/dist/common/types/index.d.ts +2 -0
- package/dist/common/types/onlyLiteral.d.ts +18 -0
- package/dist/common/types/unwrapArray.d.ts +1 -0
- package/dist/dataParser/base.cjs +55 -29
- package/dist/dataParser/base.d.ts +1 -1
- package/dist/dataParser/base.mjs +55 -29
- package/dist/dataParser/baseExtended.cjs +15 -2
- package/dist/dataParser/baseExtended.d.ts +8 -3
- package/dist/dataParser/baseExtended.mjs +15 -2
- package/dist/dataParser/extended/array.cjs +1 -0
- package/dist/dataParser/extended/array.d.ts +11 -5
- package/dist/dataParser/extended/array.mjs +1 -0
- package/dist/dataParser/extended/bigint.cjs +1 -0
- package/dist/dataParser/extended/bigint.d.ts +9 -2
- package/dist/dataParser/extended/bigint.mjs +1 -0
- package/dist/dataParser/extended/boolean.cjs +1 -0
- package/dist/dataParser/extended/boolean.d.ts +13 -2
- package/dist/dataParser/extended/boolean.mjs +1 -0
- package/dist/dataParser/extended/coerce/bigint.cjs +1 -0
- package/dist/dataParser/extended/coerce/bigint.mjs +1 -0
- package/dist/dataParser/extended/coerce/boolean.cjs +1 -0
- package/dist/dataParser/extended/coerce/boolean.mjs +1 -0
- package/dist/dataParser/extended/coerce/empty.cjs +1 -0
- package/dist/dataParser/extended/coerce/empty.mjs +1 -0
- package/dist/dataParser/extended/coerce/nil.cjs +1 -0
- package/dist/dataParser/extended/coerce/nil.mjs +1 -0
- package/dist/dataParser/extended/coerce/number.cjs +1 -0
- package/dist/dataParser/extended/coerce/number.mjs +1 -0
- package/dist/dataParser/extended/coerce/string.cjs +1 -0
- package/dist/dataParser/extended/coerce/string.mjs +1 -0
- package/dist/dataParser/extended/empty.cjs +1 -0
- package/dist/dataParser/extended/empty.d.ts +13 -2
- package/dist/dataParser/extended/empty.mjs +1 -0
- package/dist/dataParser/extended/index.cjs +2 -0
- package/dist/dataParser/extended/index.d.ts +1 -0
- package/dist/dataParser/extended/index.mjs +1 -0
- package/dist/dataParser/extended/lazy.cjs +1 -0
- package/dist/dataParser/extended/lazy.d.ts +13 -3
- package/dist/dataParser/extended/lazy.mjs +1 -0
- package/dist/dataParser/extended/literal.cjs +1 -0
- package/dist/dataParser/extended/literal.d.ts +13 -2
- package/dist/dataParser/extended/literal.mjs +1 -0
- package/dist/dataParser/extended/nil.cjs +1 -0
- package/dist/dataParser/extended/nil.d.ts +13 -2
- package/dist/dataParser/extended/nil.mjs +1 -0
- package/dist/dataParser/extended/nullable.cjs +1 -0
- package/dist/dataParser/extended/nullable.d.ts +14 -4
- package/dist/dataParser/extended/nullable.mjs +1 -0
- package/dist/dataParser/extended/number.cjs +1 -0
- package/dist/dataParser/extended/number.d.ts +9 -2
- package/dist/dataParser/extended/number.mjs +1 -0
- package/dist/dataParser/extended/object.cjs +1 -0
- package/dist/dataParser/extended/object.d.ts +13 -2
- package/dist/dataParser/extended/object.mjs +1 -0
- package/dist/dataParser/extended/optional.cjs +1 -0
- package/dist/dataParser/extended/optional.d.ts +14 -4
- package/dist/dataParser/extended/optional.mjs +1 -0
- package/dist/dataParser/extended/pipe.cjs +1 -0
- package/dist/dataParser/extended/pipe.d.ts +13 -3
- package/dist/dataParser/extended/pipe.mjs +1 -0
- package/dist/dataParser/extended/record.cjs +3 -2
- package/dist/dataParser/extended/record.d.ts +13 -3
- package/dist/dataParser/extended/record.mjs +2 -1
- package/dist/dataParser/extended/recover.cjs +14 -0
- package/dist/dataParser/extended/recover.d.ts +23 -0
- package/dist/dataParser/extended/recover.mjs +12 -0
- package/dist/dataParser/extended/string.cjs +1 -0
- package/dist/dataParser/extended/string.d.ts +9 -2
- package/dist/dataParser/extended/string.mjs +1 -0
- package/dist/dataParser/extended/templateLiteral.cjs +4 -2
- package/dist/dataParser/extended/templateLiteral.d.ts +13 -2
- package/dist/dataParser/extended/templateLiteral.mjs +3 -1
- package/dist/dataParser/extended/transform.cjs +1 -0
- package/dist/dataParser/extended/transform.d.ts +12 -2
- package/dist/dataParser/extended/transform.mjs +1 -0
- package/dist/dataParser/extended/tuple.cjs +11 -1
- package/dist/dataParser/extended/tuple.d.ts +19 -2
- package/dist/dataParser/extended/tuple.mjs +11 -1
- package/dist/dataParser/extended/union.cjs +1 -0
- package/dist/dataParser/extended/union.d.ts +13 -2
- package/dist/dataParser/extended/union.mjs +1 -0
- package/dist/dataParser/extended/unknown.cjs +1 -0
- package/dist/dataParser/extended/unknown.d.ts +13 -2
- package/dist/dataParser/extended/unknown.mjs +1 -0
- package/dist/dataParser/identifier.cjs +2 -17
- package/dist/dataParser/identifier.d.ts +216 -8
- package/dist/dataParser/identifier.mjs +2 -17
- package/dist/dataParser/index.cjs +29 -18
- package/dist/dataParser/index.mjs +18 -14
- package/dist/dataParser/parsers/array/checkers/max.cjs +3 -3
- package/dist/dataParser/parsers/array/checkers/max.d.ts +2 -2
- package/dist/dataParser/parsers/array/checkers/max.mjs +3 -3
- package/dist/dataParser/parsers/array/checkers/min.cjs +3 -3
- package/dist/dataParser/parsers/array/checkers/min.d.ts +2 -2
- package/dist/dataParser/parsers/array/checkers/min.mjs +3 -3
- package/dist/dataParser/parsers/array/index.d.ts +14 -7
- package/dist/dataParser/parsers/bigint/checkers/max.cjs +3 -3
- package/dist/dataParser/parsers/bigint/checkers/max.d.ts +2 -2
- package/dist/dataParser/parsers/bigint/checkers/max.mjs +3 -3
- package/dist/dataParser/parsers/bigint/checkers/min.cjs +3 -3
- package/dist/dataParser/parsers/bigint/checkers/min.d.ts +2 -2
- package/dist/dataParser/parsers/bigint/checkers/min.mjs +3 -3
- package/dist/dataParser/parsers/bigint/index.d.ts +11 -4
- package/dist/dataParser/parsers/boolean.d.ts +16 -4
- package/dist/dataParser/parsers/coerce/bigint.cjs +1 -0
- package/dist/dataParser/parsers/coerce/bigint.mjs +1 -0
- package/dist/dataParser/parsers/coerce/boolean.cjs +1 -0
- package/dist/dataParser/parsers/coerce/boolean.mjs +1 -0
- package/dist/dataParser/parsers/coerce/empty.cjs +1 -0
- package/dist/dataParser/parsers/coerce/empty.mjs +1 -0
- package/dist/dataParser/parsers/coerce/nil.cjs +1 -0
- package/dist/dataParser/parsers/coerce/nil.mjs +1 -0
- package/dist/dataParser/parsers/coerce/number.cjs +1 -0
- package/dist/dataParser/parsers/coerce/number.mjs +1 -0
- package/dist/dataParser/parsers/coerce/string.cjs +1 -0
- package/dist/dataParser/parsers/coerce/string.mjs +1 -0
- package/dist/dataParser/parsers/empty.d.ts +16 -4
- package/dist/dataParser/parsers/index.d.ts +2 -0
- package/dist/dataParser/parsers/lazy.d.ts +16 -4
- package/dist/dataParser/parsers/literal.d.ts +16 -4
- package/dist/dataParser/parsers/nil.d.ts +16 -4
- package/dist/dataParser/parsers/nullable.cjs +3 -2
- package/dist/dataParser/parsers/nullable.d.ts +19 -6
- package/dist/dataParser/parsers/nullable.mjs +3 -2
- package/dist/dataParser/parsers/number/checkers/int.cjs +3 -3
- package/dist/dataParser/parsers/number/checkers/int.d.ts +2 -2
- package/dist/dataParser/parsers/number/checkers/int.mjs +3 -3
- package/dist/dataParser/parsers/number/checkers/max.cjs +3 -3
- package/dist/dataParser/parsers/number/checkers/max.d.ts +2 -2
- package/dist/dataParser/parsers/number/checkers/max.mjs +3 -3
- package/dist/dataParser/parsers/number/checkers/min.cjs +3 -3
- package/dist/dataParser/parsers/number/checkers/min.d.ts +2 -2
- package/dist/dataParser/parsers/number/checkers/min.mjs +3 -3
- package/dist/dataParser/parsers/number/index.d.ts +11 -4
- package/dist/dataParser/parsers/object.d.ts +16 -4
- package/dist/dataParser/parsers/optional.cjs +3 -2
- package/dist/dataParser/parsers/optional.d.ts +19 -6
- package/dist/dataParser/parsers/optional.mjs +3 -2
- package/dist/dataParser/parsers/pipe.d.ts +16 -4
- package/dist/dataParser/parsers/record/findRecordRequiredKey.cjs +50 -0
- package/dist/dataParser/parsers/record/findRecordRequiredKey.d.ts +4 -0
- package/dist/dataParser/parsers/record/findRecordRequiredKey.mjs +47 -0
- package/dist/dataParser/parsers/{record.cjs → record/index.cjs} +21 -3
- package/dist/dataParser/parsers/record/index.d.ts +42 -0
- package/dist/dataParser/parsers/{record.mjs → record/index.mjs} +21 -4
- package/dist/dataParser/parsers/recover.cjs +32 -0
- package/dist/dataParser/parsers/recover.d.ts +28 -0
- package/dist/dataParser/parsers/recover.mjs +29 -0
- package/dist/dataParser/parsers/refine.cjs +18 -0
- package/dist/dataParser/parsers/refine.d.ts +17 -0
- package/dist/dataParser/parsers/refine.mjs +15 -0
- package/dist/dataParser/parsers/string/checkers/email.cjs +3 -3
- package/dist/dataParser/parsers/string/checkers/email.d.ts +2 -2
- package/dist/dataParser/parsers/string/checkers/email.mjs +3 -3
- package/dist/dataParser/parsers/string/checkers/max.cjs +3 -3
- package/dist/dataParser/parsers/string/checkers/max.d.ts +2 -2
- package/dist/dataParser/parsers/string/checkers/max.mjs +3 -3
- package/dist/dataParser/parsers/string/checkers/min.cjs +3 -3
- package/dist/dataParser/parsers/string/checkers/min.d.ts +2 -2
- package/dist/dataParser/parsers/string/checkers/min.mjs +3 -3
- package/dist/dataParser/parsers/string/checkers/regex.cjs +3 -3
- package/dist/dataParser/parsers/string/checkers/regex.d.ts +2 -2
- package/dist/dataParser/parsers/string/checkers/regex.mjs +3 -3
- package/dist/dataParser/parsers/string/checkers/url.cjs +3 -3
- package/dist/dataParser/parsers/string/checkers/url.d.ts +2 -2
- package/dist/dataParser/parsers/string/checkers/url.mjs +3 -3
- package/dist/dataParser/parsers/string/index.d.ts +11 -4
- package/dist/dataParser/parsers/templateLiteral/createTemplateLiteralPattern.cjs +75 -0
- package/dist/dataParser/parsers/templateLiteral/createTemplateLiteralPattern.d.ts +2 -0
- package/dist/dataParser/parsers/templateLiteral/createTemplateLiteralPattern.mjs +73 -0
- package/dist/dataParser/parsers/templateLiteral/index.cjs +31 -0
- package/dist/dataParser/parsers/templateLiteral/index.d.ts +66 -0
- package/dist/dataParser/parsers/templateLiteral/index.mjs +27 -0
- package/dist/dataParser/parsers/transform.d.ts +16 -4
- package/dist/dataParser/parsers/tuple.d.ts +14 -4
- package/dist/dataParser/parsers/union.d.ts +16 -4
- package/dist/dataParser/parsers/unknown.d.ts +16 -4
- package/dist/dataParser/types/checkers.d.ts +1 -1
- package/dist/dataParser/types/dataParsers.d.ts +2 -2
- package/dist/either/bool/falsy.cjs +1 -1
- package/dist/either/bool/falsy.mjs +1 -1
- package/dist/either/bool/truthy.cjs +2 -2
- package/dist/either/bool/truthy.mjs +2 -2
- package/dist/either/future/create.cjs +1 -1
- package/dist/either/future/create.mjs +1 -1
- package/dist/either/nullable/empty.cjs +1 -1
- package/dist/either/nullable/empty.mjs +1 -1
- package/dist/either/nullish/filled.cjs +2 -2
- package/dist/either/nullish/filled.mjs +2 -2
- package/dist/either/optional/filled.cjs +2 -2
- package/dist/either/optional/filled.mjs +2 -2
- package/dist/either/right/asyncPipe.cjs +1 -1
- package/dist/either/right/asyncPipe.mjs +1 -1
- package/dist/either/right/pipe.cjs +1 -1
- package/dist/either/right/pipe.mjs +1 -1
- package/dist/generator/asyncReduce.cjs +1 -1
- package/dist/generator/asyncReduce.d.ts +4 -3
- package/dist/generator/asyncReduce.mjs +1 -1
- package/dist/generator/reduce.d.ts +6 -7
- package/dist/index.cjs +2 -0
- package/dist/index.mjs +1 -0
- package/dist/string/types/index.d.ts +1 -0
- package/dist/string/types/templateLiteralContainLargeType.d.ts +5 -0
- package/package.json +3 -3
- package/dist/dataParser/parsers/record.d.ts +0 -30
- package/dist/dataParser/parsers/templateLiteral.cjs +0 -47
- package/dist/dataParser/parsers/templateLiteral.d.ts +0 -49
- package/dist/dataParser/parsers/templateLiteral.mjs +0 -44
package/dist/array/flat.cjs
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function flat(
|
|
4
|
-
if (args.length === 0) {
|
|
5
|
-
return (array) => flat(array);
|
|
6
|
-
}
|
|
7
|
-
if (args.length === 1) {
|
|
8
|
-
const [depthOrArray] = args;
|
|
9
|
-
if (Array.isArray(depthOrArray)) {
|
|
10
|
-
return depthOrArray.flat(1);
|
|
11
|
-
}
|
|
12
|
-
const depth = depthOrArray;
|
|
13
|
-
return (array) => flat(array, depth);
|
|
14
|
-
}
|
|
15
|
-
const [array, depth] = args;
|
|
3
|
+
function flat(array, depth) {
|
|
16
4
|
return array.flat(depth);
|
|
17
5
|
}
|
|
18
6
|
|
package/dist/array/flat.d.ts
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
export declare function flat
|
|
2
|
-
export declare function flat<const Depth extends number>(depth: Depth): <const GenericArray extends readonly unknown[]>(array: GenericArray) => FlatArray<GenericArray, Depth>[];
|
|
3
|
-
export declare function flat<const GenericArray extends readonly unknown[], const Depth extends number>(array: GenericArray, depth: Depth): FlatArray<GenericArray, Depth>[];
|
|
4
|
-
export declare function flat<const GenericArray extends readonly unknown[]>(array: GenericArray): FlatArray<GenericArray, 1>[];
|
|
1
|
+
export declare function flat<const GenericArray extends readonly unknown[], const Depth extends number = 1>(array: GenericArray, depth?: Depth): FlatArray<GenericArray, Depth>[];
|
package/dist/array/flat.mjs
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
function flat(
|
|
2
|
-
if (args.length === 0) {
|
|
3
|
-
return (array) => flat(array);
|
|
4
|
-
}
|
|
5
|
-
if (args.length === 1) {
|
|
6
|
-
const [depthOrArray] = args;
|
|
7
|
-
if (Array.isArray(depthOrArray)) {
|
|
8
|
-
return depthOrArray.flat(1);
|
|
9
|
-
}
|
|
10
|
-
const depth = depthOrArray;
|
|
11
|
-
return (array) => flat(array, depth);
|
|
12
|
-
}
|
|
13
|
-
const [array, depth] = args;
|
|
1
|
+
function flat(array, depth) {
|
|
14
2
|
return array.flat(depth);
|
|
15
3
|
}
|
|
16
4
|
|
package/dist/array/index.cjs
CHANGED
|
@@ -51,6 +51,7 @@ var sum = require('./sum.cjs');
|
|
|
51
51
|
var length = require('./length.cjs');
|
|
52
52
|
var coalescing = require('./coalescing.cjs');
|
|
53
53
|
var toTuple = require('./toTuple.cjs');
|
|
54
|
+
var notIncludes = require('./notIncludes.cjs');
|
|
54
55
|
|
|
55
56
|
|
|
56
57
|
|
|
@@ -107,3 +108,4 @@ exports.sum = sum.sum;
|
|
|
107
108
|
exports.length = length.length;
|
|
108
109
|
exports.coalescing = coalescing.coalescing;
|
|
109
110
|
exports.toTuple = toTuple.toTuple;
|
|
111
|
+
exports.notIncludes = notIncludes.notIncludes;
|
package/dist/array/index.d.ts
CHANGED
package/dist/array/index.mjs
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function notIncludes(...args) {
|
|
4
|
+
if (args.length === 1) {
|
|
5
|
+
const [value] = args;
|
|
6
|
+
return (array) => notIncludes(array, value);
|
|
7
|
+
}
|
|
8
|
+
const [array, value] = args;
|
|
9
|
+
return !array.includes(value);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.notIncludes = notIncludes;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type RemoveFromUnion } from "../common";
|
|
2
|
+
export type NotIncludeValue = string | null | undefined | boolean | number | bigint | symbol;
|
|
3
|
+
export declare function notIncludes<GenericArrayValue extends unknown, const GenericNotIncludeValue extends RemoveFromUnion<Extract<GenericArrayValue, NotIncludeValue>, Exclude<NotIncludeValue, null | undefined>>>(value: GenericNotIncludeValue): (input: readonly GenericArrayValue[]) => input is Exclude<GenericArrayValue, GenericNotIncludeValue>[];
|
|
4
|
+
export declare function notIncludes<GenericArrayValue extends unknown, const GenericNotIncludeValue extends RemoveFromUnion<Extract<GenericArrayValue, NotIncludeValue>, Exclude<NotIncludeValue, null | undefined>>>(input: readonly GenericArrayValue[], value: GenericNotIncludeValue): input is Exclude<GenericArrayValue, GenericNotIncludeValue>[];
|
package/dist/array/reduce.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { type Kind } from "../common/kind";
|
|
2
2
|
import { type WrappedValue } from "../common/wrapValue";
|
|
3
3
|
import { type Unwrap } from "../common/unwrap";
|
|
4
|
-
import { type ToLargeEnsemble } from "../common";
|
|
5
|
-
interface ArrayReduceNext<GenericOutput extends unknown> {
|
|
4
|
+
import { type IsEqual, type ToLargeEnsemble } from "../common";
|
|
5
|
+
export interface ArrayReduceNext<GenericOutput extends unknown = unknown> {
|
|
6
6
|
"-next": GenericOutput;
|
|
7
7
|
}
|
|
8
|
-
interface ArrayReduceExit<GenericOutput extends unknown> {
|
|
8
|
+
export interface ArrayReduceExit<GenericOutput extends unknown = unknown> {
|
|
9
9
|
"-exit": GenericOutput;
|
|
10
10
|
}
|
|
11
|
-
export type ArrayReduceExitOrNext<GenericOutput extends unknown = unknown> = ArrayReduceExit<GenericOutput> | ArrayReduceNext<GenericOutput>;
|
|
12
11
|
export interface ArrayReduceFunctionParams<GenericElement extends unknown = unknown, GenericOutput extends unknown = unknown> {
|
|
13
12
|
element: GenericElement;
|
|
14
13
|
index: number;
|
|
15
14
|
lastValue: GenericOutput;
|
|
16
15
|
nextWithObject: GenericOutput extends object ? (object1: GenericOutput, object2: Partial<GenericOutput>) => ArrayReduceNext<GenericOutput> : undefined;
|
|
17
16
|
next(output: GenericOutput): ArrayReduceNext<GenericOutput>;
|
|
18
|
-
exit(output:
|
|
17
|
+
exit<GenericExitValue extends unknown>(output: GenericExitValue): ArrayReduceExit<GenericExitValue>;
|
|
19
18
|
}
|
|
20
19
|
declare const arrayReduceFromKind: import("../common").KindHandler<import("../common").KindDefinition<"array-reduce-from", unknown>>;
|
|
21
20
|
export interface ArrayReduceFromResult<GenericValue extends unknown = unknown> extends Kind<typeof arrayReduceFromKind.definition>, WrappedValue<GenericValue> {
|
|
@@ -23,6 +22,6 @@ export interface ArrayReduceFromResult<GenericValue extends unknown = unknown> e
|
|
|
23
22
|
export declare function reduceFrom<GenericValue extends unknown>(value: GenericValue): ArrayReduceFromResult<GenericValue>;
|
|
24
23
|
export type ArrayEligibleReduceFromValue = number | string | bigint | boolean | ArrayReduceFromResult;
|
|
25
24
|
export type ArrayReduceFromValue<GenericValue extends ArrayEligibleReduceFromValue> = GenericValue extends ArrayReduceFromResult ? Unwrap<GenericValue> : ToLargeEnsemble<GenericValue>;
|
|
26
|
-
export declare function reduce<GenericElement extends unknown, GenericReduceFrom extends ArrayEligibleReduceFromValue
|
|
27
|
-
export declare function reduce<GenericElement extends unknown, GenericReduceFrom extends number | string | bigint | boolean | ArrayReduceFromResult
|
|
25
|
+
export declare function reduce<GenericElement extends unknown, GenericReduceFrom extends ArrayEligibleReduceFromValue, GenericExit extends ArrayReduceExit = ArrayReduceExit<never>>(startValue: GenericReduceFrom, theFunction: (params: ArrayReduceFunctionParams<GenericElement, ArrayReduceFromValue<GenericReduceFrom>>) => ArrayReduceNext<ArrayReduceFromValue<GenericReduceFrom>> | GenericExit): (array: readonly GenericElement[]) => ArrayReduceFromValue<GenericReduceFrom> | (IsEqual<GenericExit, ArrayReduceExit> extends true ? never : GenericExit["-exit"]);
|
|
26
|
+
export declare function reduce<GenericElement extends unknown, GenericReduceFrom extends number | string | bigint | boolean | ArrayReduceFromResult, GenericExit extends ArrayReduceExit = ArrayReduceExit<never>>(array: readonly GenericElement[], startValue: GenericReduceFrom, theFunction: (params: ArrayReduceFunctionParams<GenericElement, ArrayReduceFromValue<GenericReduceFrom>>) => ArrayReduceNext<ArrayReduceFromValue<GenericReduceFrom>> | GenericExit): ArrayReduceFromValue<GenericReduceFrom> | (IsEqual<GenericExit, ArrayReduceExit> extends true ? never : GenericExit["-exit"]);
|
|
28
27
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { type ArrayReduceFunctionParams, type ArrayReduceFromResult, type
|
|
2
|
-
|
|
3
|
-
export declare function reduceRight<GenericElement extends unknown, GenericReduceFrom extends number | string | bigint | boolean | ArrayReduceFromResult
|
|
1
|
+
import { type ArrayReduceFunctionParams, type ArrayReduceFromResult, type ArrayReduceFromValue, type ArrayReduceExit, type ArrayReduceNext } from "./reduce";
|
|
2
|
+
import { type IsEqual } from "../common";
|
|
3
|
+
export declare function reduceRight<GenericElement extends unknown, GenericReduceFrom extends number | string | bigint | boolean | ArrayReduceFromResult, GenericExit extends ArrayReduceExit = ArrayReduceExit<never>>(startValue: GenericReduceFrom, theFunction: (params: ArrayReduceFunctionParams<GenericElement, ArrayReduceFromValue<GenericReduceFrom>>) => ArrayReduceNext<ArrayReduceFromValue<GenericReduceFrom>> | GenericExit): (array: readonly GenericElement[]) => ArrayReduceFromValue<GenericReduceFrom> | (IsEqual<GenericExit, ArrayReduceExit> extends true ? never : GenericExit["-exit"]);
|
|
4
|
+
export declare function reduceRight<GenericElement extends unknown, GenericReduceFrom extends number | string | bigint | boolean | ArrayReduceFromResult, GenericExit extends ArrayReduceExit = ArrayReduceExit<never>>(array: readonly GenericElement[], startValue: GenericReduceFrom, theFunction: (params: ArrayReduceFunctionParams<GenericElement, ArrayReduceFromValue<GenericReduceFrom>>) => ArrayReduceNext<ArrayReduceFromValue<GenericReduceFrom>> | GenericExit): ArrayReduceFromValue<GenericReduceFrom> | (IsEqual<GenericExit, ArrayReduceExit> extends true ? never : GenericExit["-exit"]);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('./globalStore.cjs');
|
|
4
|
+
require('./builder.cjs');
|
|
5
|
+
var error = require('../either/left/error.cjs');
|
|
6
|
+
var success = require('../either/right/success.cjs');
|
|
7
|
+
var coalescing = require('../array/coalescing.cjs');
|
|
8
|
+
|
|
9
|
+
function createKindIdentifier() {
|
|
10
|
+
function identifier(...args) {
|
|
11
|
+
if (args.length === 1) {
|
|
12
|
+
const [kind] = args;
|
|
13
|
+
return (input) => identifier(input, kind);
|
|
14
|
+
}
|
|
15
|
+
const [input, kind] = args;
|
|
16
|
+
const formattedKind = coalescing.coalescing(kind);
|
|
17
|
+
for (const kind of formattedKind) {
|
|
18
|
+
if (!kind.has(input)) {
|
|
19
|
+
return error.error(input);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return success.success(input);
|
|
23
|
+
}
|
|
24
|
+
return identifier;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.createKindIdentifier = createKindIdentifier;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type GetKindHandler, type Kind, type KindDefinition, type KindHandler } from "./kind";
|
|
2
|
+
import { type UnionContain, type UnionToIntersection } from "./types";
|
|
3
|
+
import * as DEither from "../either";
|
|
4
|
+
export declare function createKindIdentifier<GenericParent extends Kind<KindDefinition>, GenericChildren extends GenericParent>(): {
|
|
5
|
+
<GenericKindHandler extends GenericChildren extends infer InferredChildren ? InferredChildren extends GenericParent ? GetKindHandler<InferredChildren> : never : never, GenericInput extends GenericParent, GenericResult extends Extract<GenericChildren, UnionToIntersection<GenericKindHandler extends KindHandler ? Kind<GenericKindHandler["definition"]> : never>>>(kind: GenericKindHandler | GenericKindHandler[]): (input: GenericInput) => ((GenericInput extends any ? UnionContain<GetKindHandler<GenericInput>, GenericKindHandler> extends true ? DEither.EitherSuccess<GenericInput> : DEither.EitherError<GenericInput> : never) | DEither.EitherSuccess<GenericResult>);
|
|
6
|
+
<GenericKindHandler extends GenericChildren extends infer InferredChildren ? InferredChildren extends GenericParent ? GetKindHandler<InferredChildren> : never : never, GenericInput extends GenericParent, GenericResult extends Extract<GenericChildren, UnionToIntersection<GenericKindHandler extends KindHandler ? Kind<GenericKindHandler["definition"]> : never>>>(input: GenericInput, kind: GenericKindHandler | GenericKindHandler[]): ((GenericInput extends any ? UnionContain<GetKindHandler<GenericInput>, GenericKindHandler> extends true ? DEither.EitherSuccess<GenericInput> : DEither.EitherError<GenericInput> : never) | DEither.EitherSuccess<GenericResult>);
|
|
7
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import './globalStore.mjs';
|
|
2
|
+
import './builder.mjs';
|
|
3
|
+
import { error } from '../either/left/error.mjs';
|
|
4
|
+
import { success } from '../either/right/success.mjs';
|
|
5
|
+
import { coalescing } from '../array/coalescing.mjs';
|
|
6
|
+
|
|
7
|
+
function createKindIdentifier() {
|
|
8
|
+
function identifier(...args) {
|
|
9
|
+
if (args.length === 1) {
|
|
10
|
+
const [kind] = args;
|
|
11
|
+
return (input) => identifier(input, kind);
|
|
12
|
+
}
|
|
13
|
+
const [input, kind] = args;
|
|
14
|
+
const formattedKind = coalescing(kind);
|
|
15
|
+
for (const kind of formattedKind) {
|
|
16
|
+
if (!kind.has(input)) {
|
|
17
|
+
return error(input);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return success(input);
|
|
21
|
+
}
|
|
22
|
+
return identifier;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { createKindIdentifier };
|
package/dist/common/index.d.ts
CHANGED
package/dist/common/kind.cjs
CHANGED
|
@@ -35,22 +35,21 @@ function createKindNamespace(namespace) {
|
|
|
35
35
|
return kindHandler;
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function kindHeritage(uniqueName, kind) {
|
|
38
|
+
function kindHeritage(uniqueName, kind, parent) {
|
|
39
39
|
const uniqueKind = createKind(uniqueName);
|
|
40
40
|
const kinds = kind instanceof Array
|
|
41
41
|
? kind
|
|
42
42
|
: [kind];
|
|
43
|
-
const
|
|
44
|
-
for (const kind of kinds) {
|
|
45
|
-
this[kind.runTimeKey] = params[kind.definition.name] ?? null;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
kinds.forEach((value) => {
|
|
49
|
-
ParentKindClass.prototype[value.runTimeKey] = null;
|
|
43
|
+
const Extendable = (parent ?? class {
|
|
50
44
|
});
|
|
51
|
-
ParentKindClass
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
const ParentKindClass = (class extends Extendable {
|
|
46
|
+
constructor(params = {}, parentParams = []) {
|
|
47
|
+
super(...parentParams);
|
|
48
|
+
for (const kind of kinds) {
|
|
49
|
+
this[kind.runTimeKey] = params[kind.definition.name] ?? null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static [Symbol.hasInstance](value) {
|
|
54
53
|
if (!uniqueKind.has(value)) {
|
|
55
54
|
return false;
|
|
56
55
|
}
|
|
@@ -60,8 +59,12 @@ function kindHeritage(uniqueName, kind) {
|
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
return true;
|
|
63
|
-
}
|
|
62
|
+
}
|
|
64
63
|
});
|
|
64
|
+
kinds.forEach((value) => {
|
|
65
|
+
ParentKindClass.prototype[value.runTimeKey] = null;
|
|
66
|
+
});
|
|
67
|
+
ParentKindClass.prototype[uniqueKind.runTimeKey] = null;
|
|
65
68
|
return ParentKindClass;
|
|
66
69
|
}
|
|
67
70
|
function isRuntimeKind(value) {
|
package/dist/common/kind.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ForbiddenString } from "../string";
|
|
2
|
-
import { type Or, type IsEqual, type BreakGenericLink, type Adaptor, type UnionToIntersection } from "./types";
|
|
2
|
+
import { type Or, type IsEqual, type BreakGenericLink, type Adaptor, type UnionToIntersection, type AnyConstructor, type And } from "./types";
|
|
3
3
|
import { type GetPropsWithValue, type PartialKeys } from "../object";
|
|
4
4
|
export interface KindHandler<GenericKindDefinition extends KindDefinition = KindDefinition> {
|
|
5
5
|
definition: GenericKindDefinition;
|
|
@@ -49,6 +49,6 @@ export declare function createKindNamespace<GenericNamespace extends string>(nam
|
|
|
49
49
|
export type KindHeritageConstructorParams<GenericKindHandler extends KindHandler> = {
|
|
50
50
|
[KindHandler in GenericKindHandler as KindHandler["definition"]["name"]]: KindHandler["definition"]["value"];
|
|
51
51
|
} extends infer InferredResult extends object ? PartialKeys<InferredResult, GetPropsWithValue<InferredResult, unknown>> : never;
|
|
52
|
-
export declare function kindHeritage<GenericUniqueName extends string, GenericKindHandler extends KindHandler
|
|
52
|
+
export declare function kindHeritage<GenericUniqueName extends string, GenericKindHandler extends KindHandler, GenericParent extends AnyConstructor = AnyConstructor<unknown[], never>>(uniqueName: GenericUniqueName & ForbiddenKindCharacters<GenericUniqueName>, kind: GenericKindHandler | GenericKindHandler[], parent?: GenericParent): new (...args: And<[IsEqual<GenericKindHandler extends KindHandler ? IsEqual<GenericKindHandler["definition"]["value"], unknown> : never, true>, IsEqual<InstanceType<GenericParent>, never>]> extends true ? [params?: KindHeritageConstructorParams<GenericKindHandler>] : [params: KindHeritageConstructorParams<GenericKindHandler>, ...parentArgs: IsEqual<ConstructorParameters<GenericParent>, unknown[]> extends true ? [parentParams?: ConstructorParameters<GenericParent>] : [parentParams: ConstructorParameters<GenericParent>]]) => UnionToIntersection<(GenericKindHandler extends KindHandler ? Kind<GenericKindHandler["definition"]> : never) | Kind<KindDefinition<GenericUniqueName, unknown>> | InstanceType<GenericParent>>;
|
|
53
53
|
export declare function isRuntimeKind(value: string): boolean;
|
|
54
54
|
export {};
|
package/dist/common/kind.mjs
CHANGED
|
@@ -33,22 +33,21 @@ function createKindNamespace(namespace) {
|
|
|
33
33
|
return kindHandler;
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function kindHeritage(uniqueName, kind) {
|
|
36
|
+
function kindHeritage(uniqueName, kind, parent) {
|
|
37
37
|
const uniqueKind = createKind(uniqueName);
|
|
38
38
|
const kinds = kind instanceof Array
|
|
39
39
|
? kind
|
|
40
40
|
: [kind];
|
|
41
|
-
const
|
|
42
|
-
for (const kind of kinds) {
|
|
43
|
-
this[kind.runTimeKey] = params[kind.definition.name] ?? null;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
kinds.forEach((value) => {
|
|
47
|
-
ParentKindClass.prototype[value.runTimeKey] = null;
|
|
41
|
+
const Extendable = (parent ?? class {
|
|
48
42
|
});
|
|
49
|
-
ParentKindClass
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
const ParentKindClass = (class extends Extendable {
|
|
44
|
+
constructor(params = {}, parentParams = []) {
|
|
45
|
+
super(...parentParams);
|
|
46
|
+
for (const kind of kinds) {
|
|
47
|
+
this[kind.runTimeKey] = params[kind.definition.name] ?? null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
static [Symbol.hasInstance](value) {
|
|
52
51
|
if (!uniqueKind.has(value)) {
|
|
53
52
|
return false;
|
|
54
53
|
}
|
|
@@ -58,8 +57,12 @@ function kindHeritage(uniqueName, kind) {
|
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
return true;
|
|
61
|
-
}
|
|
60
|
+
}
|
|
62
61
|
});
|
|
62
|
+
kinds.forEach((value) => {
|
|
63
|
+
ParentKindClass.prototype[value.runTimeKey] = null;
|
|
64
|
+
});
|
|
65
|
+
ParentKindClass.prototype[uniqueKind.runTimeKey] = null;
|
|
63
66
|
return ParentKindClass;
|
|
64
67
|
}
|
|
65
68
|
function isRuntimeKind(value) {
|
package/dist/common/or.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { type AnyFunction } from "./types";
|
|
2
|
-
type ExtractPredicate<
|
|
3
|
-
(input: any) => input is infer InferredPredicate,
|
|
4
|
-
...infer InferredRest extends
|
|
5
|
-
] ? InferredRest extends readonly [] ? InferredPredicate :
|
|
6
|
-
export declare function or<GenericInput extends unknown, GenericArrayPredicatedInput extends [
|
|
1
|
+
import { type AnyPredicate, type AnyFunction, type IsEqual } from "./types";
|
|
2
|
+
type ExtractPredicate<GenericPredicatedInput extends readonly AnyFunction<any[], boolean>[]> = GenericPredicatedInput extends readonly [
|
|
3
|
+
(input: any, ...args: any[]) => input is infer InferredPredicate,
|
|
4
|
+
...infer InferredRest extends readonly AnyPredicate[]
|
|
5
|
+
] ? InferredRest extends readonly [] ? InferredPredicate : ExtractPredicate<InferredRest> extends infer InferredResult ? IsEqual<InferredResult, never> extends true ? never : InferredPredicate | InferredResult : never : never;
|
|
6
|
+
export declare function or<GenericInput extends unknown, const GenericArrayPredicatedInput extends readonly [
|
|
7
7
|
(input: GenericInput) => input is any,
|
|
8
8
|
(input: GenericInput) => input is any,
|
|
9
9
|
...((input: GenericInput) => input is any)[]
|
|
10
|
-
]>(predicatedList: GenericArrayPredicatedInput): (input: GenericInput) => input is Extract<GenericInput, ExtractPredicate<
|
|
10
|
+
]>(predicatedList: GenericArrayPredicatedInput): (input: GenericInput) => input is Extract<GenericInput, ExtractPredicate<GenericArrayPredicatedInput>>;
|
|
11
11
|
export declare function or<GenericInput extends unknown>(predicatedList: [
|
|
12
12
|
(input: GenericInput) => boolean,
|
|
13
13
|
(input: GenericInput) => boolean,
|
|
14
14
|
...((input: GenericInput) => boolean)[]
|
|
15
15
|
]): (input: GenericInput) => boolean;
|
|
16
|
-
export declare function or<GenericInput extends unknown, GenericArrayPredicatedInput extends [
|
|
16
|
+
export declare function or<GenericInput extends unknown, const GenericArrayPredicatedInput extends readonly [
|
|
17
17
|
(input: GenericInput) => input is any,
|
|
18
18
|
(input: GenericInput) => input is any,
|
|
19
19
|
...((input: GenericInput) => input is any)[]
|
|
20
|
-
]>(input: GenericInput, predicatedList: GenericArrayPredicatedInput): input is Extract<GenericInput, ExtractPredicate<
|
|
20
|
+
]>(input: GenericInput, predicatedList: GenericArrayPredicatedInput): input is Extract<GenericInput, ExtractPredicate<GenericArrayPredicatedInput>>;
|
|
21
21
|
export declare function or<GenericInput extends unknown>(input: GenericInput, predicatedList: [
|
|
22
22
|
(input: GenericInput) => boolean,
|
|
23
23
|
(input: GenericInput) => boolean,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const SymbolErrorOnlyLiteral: unique symbol;
|
|
2
|
+
export type OnlyLiteralString<GenericValue extends unknown> = string extends GenericValue ? {
|
|
3
|
+
[SymbolErrorOnlyLiteral]: "Input must be a literal string.";
|
|
4
|
+
} : GenericValue;
|
|
5
|
+
export type OnlyLiteralNumber<GenericValue extends unknown> = number extends GenericValue ? {
|
|
6
|
+
[SymbolErrorOnlyLiteral]: "Input must be a literal number.";
|
|
7
|
+
} : GenericValue;
|
|
8
|
+
export type OnlyLiteralSymbol<GenericValue extends unknown> = symbol extends GenericValue ? {
|
|
9
|
+
[SymbolErrorOnlyLiteral]: "Input must be a literal symbol.";
|
|
10
|
+
} : GenericValue;
|
|
11
|
+
export type OnlyLiteralBigInt<GenericValue extends unknown> = bigint extends GenericValue ? {
|
|
12
|
+
[SymbolErrorOnlyLiteral]: "Input must be a literal bigint.";
|
|
13
|
+
} : GenericValue;
|
|
14
|
+
export type OnlyLiteralBoolean<GenericValue extends unknown> = boolean extends GenericValue ? {
|
|
15
|
+
[SymbolErrorOnlyLiteral]: "Input must be a literal boolean.";
|
|
16
|
+
} : GenericValue;
|
|
17
|
+
export type OnlyLiteral<GenericValue extends unknown> = (OnlyLiteralString<GenericValue> & OnlyLiteralNumber<GenericValue> & OnlyLiteralSymbol<GenericValue> & OnlyLiteralBigInt<GenericValue> & OnlyLiteralBoolean<GenericValue>);
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type UnwrapArray<GenericValue extends unknown> = GenericValue extends readonly any[] ? GenericValue[number] : GenericValue;
|
package/dist/dataParser/base.cjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var simpleClone = require('../common/simpleClone.cjs');
|
|
4
|
+
var wrapValue = require('../common/wrapValue.cjs');
|
|
4
5
|
require('../common/globalStore.cjs');
|
|
5
6
|
require('../common/builder.cjs');
|
|
6
|
-
var error = require('./error.cjs');
|
|
7
7
|
var error$1 = require('../either/left/error.cjs');
|
|
8
8
|
var success = require('../either/right/success.cjs');
|
|
9
|
+
var error = require('./error.cjs');
|
|
9
10
|
var kind = require('./kind.cjs');
|
|
10
11
|
|
|
11
12
|
const SymbolDataParserErrorLabel = "SymbolDataParserError";
|
|
@@ -18,6 +19,14 @@ function dataParserCheckerInit(kind, params, exec) {
|
|
|
18
19
|
}));
|
|
19
20
|
}
|
|
20
21
|
const dataParserKind = kind.createDataParserKind("base");
|
|
22
|
+
// This allows for better performance WTF ???
|
|
23
|
+
const SDPEI = error.SymbolDataParserErrorIssue;
|
|
24
|
+
const SDPEPI = error.SymbolDataParserErrorPromiseIssue;
|
|
25
|
+
const SDPE = SymbolDataParserError;
|
|
26
|
+
const DPE = error.createError();
|
|
27
|
+
const EE = error$1.error(null);
|
|
28
|
+
const ES = success.success(null);
|
|
29
|
+
const KWV = wrapValue.keyWrappedValue;
|
|
21
30
|
function dataParserInit(kind, params, exec) {
|
|
22
31
|
const formattedExec = typeof exec === "object"
|
|
23
32
|
? exec
|
|
@@ -27,21 +36,21 @@ function dataParserInit(kind, params, exec) {
|
|
|
27
36
|
};
|
|
28
37
|
function middleExec(data, error$1) {
|
|
29
38
|
let result = formattedExec.sync(data, error$1, dataParser);
|
|
30
|
-
if (result ===
|
|
39
|
+
if (result === SDPEI) {
|
|
31
40
|
error.addIssue(error$1, dataParser, data);
|
|
32
|
-
return
|
|
41
|
+
return SDPE;
|
|
33
42
|
}
|
|
34
|
-
else if (result ===
|
|
43
|
+
else if (result === SDPEPI) {
|
|
35
44
|
error.addPromiseIssue(error$1, dataParser, data);
|
|
36
|
-
return
|
|
45
|
+
return SDPE;
|
|
37
46
|
}
|
|
38
|
-
else if (result !==
|
|
47
|
+
else if (result !== SDPE
|
|
39
48
|
&& dataParser.definition.checkers.length) {
|
|
40
49
|
for (const checker of dataParser.definition.checkers) {
|
|
41
50
|
const checkerResult = checker.exec(result, checker);
|
|
42
|
-
if (checkerResult ===
|
|
51
|
+
if (checkerResult === SDPEI) {
|
|
43
52
|
error.addIssue(error$1, checker, result);
|
|
44
|
-
return
|
|
53
|
+
return SDPE;
|
|
45
54
|
}
|
|
46
55
|
else {
|
|
47
56
|
result = checkerResult;
|
|
@@ -52,21 +61,21 @@ function dataParserInit(kind, params, exec) {
|
|
|
52
61
|
}
|
|
53
62
|
async function middleAsyncExec(data, error$1) {
|
|
54
63
|
let result = await formattedExec.async(data, error$1, dataParser);
|
|
55
|
-
if (result ===
|
|
64
|
+
if (result === SDPEI) {
|
|
56
65
|
error.addIssue(error$1, dataParser, data);
|
|
57
|
-
return
|
|
66
|
+
return SDPE;
|
|
58
67
|
}
|
|
59
|
-
else if (result ===
|
|
68
|
+
else if (result === SDPEPI) {
|
|
60
69
|
error.addPromiseIssue(error$1, dataParser, data);
|
|
61
|
-
return
|
|
70
|
+
return SDPE;
|
|
62
71
|
}
|
|
63
|
-
else if (result !==
|
|
72
|
+
else if (result !== SDPE
|
|
64
73
|
&& dataParser.definition.checkers.length) {
|
|
65
74
|
for (const checker of dataParser.definition.checkers) {
|
|
66
75
|
const checkerResult = checker.exec(result, checker);
|
|
67
|
-
if (checkerResult ===
|
|
76
|
+
if (checkerResult === SDPEI) {
|
|
68
77
|
error.addIssue(error$1, checker, result);
|
|
69
|
-
return
|
|
78
|
+
return SDPE;
|
|
70
79
|
}
|
|
71
80
|
else {
|
|
72
81
|
result = checkerResult;
|
|
@@ -80,20 +89,40 @@ function dataParserInit(kind, params, exec) {
|
|
|
80
89
|
exec: middleExec,
|
|
81
90
|
asyncExec: middleAsyncExec,
|
|
82
91
|
parse(data) {
|
|
83
|
-
const error
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
92
|
+
const error = {
|
|
93
|
+
...DPE,
|
|
94
|
+
issues: [],
|
|
95
|
+
currentPath: [],
|
|
96
|
+
};
|
|
97
|
+
const result = middleExec(data, error);
|
|
98
|
+
if (result === SDPE) {
|
|
99
|
+
return {
|
|
100
|
+
...EE,
|
|
101
|
+
[KWV]: error,
|
|
102
|
+
};
|
|
87
103
|
}
|
|
88
|
-
return
|
|
104
|
+
return {
|
|
105
|
+
...ES,
|
|
106
|
+
[KWV]: result,
|
|
107
|
+
};
|
|
89
108
|
},
|
|
90
109
|
async asyncParse(data) {
|
|
91
|
-
const error
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
const error = {
|
|
111
|
+
...DPE,
|
|
112
|
+
issues: [],
|
|
113
|
+
currentPath: [],
|
|
114
|
+
};
|
|
115
|
+
const result = await middleAsyncExec(data, error);
|
|
116
|
+
if (result === SDPE) {
|
|
117
|
+
return {
|
|
118
|
+
...EE,
|
|
119
|
+
[KWV]: error,
|
|
120
|
+
};
|
|
95
121
|
}
|
|
96
|
-
return
|
|
122
|
+
return {
|
|
123
|
+
...ES,
|
|
124
|
+
[KWV]: result,
|
|
125
|
+
};
|
|
97
126
|
},
|
|
98
127
|
addChecker: (...checkers) => dataParserInit(kind, simpleClone.simpleClone({
|
|
99
128
|
...params,
|
|
@@ -103,10 +132,7 @@ function dataParserInit(kind, params, exec) {
|
|
|
103
132
|
},
|
|
104
133
|
}), exec),
|
|
105
134
|
clone: () => dataParserInit(kind, simpleClone.simpleClone(params), exec),
|
|
106
|
-
},
|
|
107
|
-
output: undefined,
|
|
108
|
-
input: undefined,
|
|
109
|
-
}));
|
|
135
|
+
}, null));
|
|
110
136
|
return dataParser;
|
|
111
137
|
}
|
|
112
138
|
|
|
@@ -19,7 +19,7 @@ export declare const dataParserKind: KindHandler<import("../common").KindDefinit
|
|
|
19
19
|
}>>;
|
|
20
20
|
export interface DataParserDefinition<GenericChecker extends DataParserChecker = DataParserChecker> {
|
|
21
21
|
readonly errorMessage?: string;
|
|
22
|
-
readonly checkers: readonly GenericChecker[];
|
|
22
|
+
readonly checkers: readonly (GenericChecker)[];
|
|
23
23
|
}
|
|
24
24
|
export interface DataParser<GenericDefinition extends DataParserDefinition = DataParserDefinition, GenericOutput extends unknown = unknown, GenericInput extends unknown = GenericOutput> extends Kind<typeof dataParserKind.definition, {
|
|
25
25
|
input: GenericInput;
|