@duplojs/utils 1.0.6 → 1.1.7
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/coalescing.cjs +9 -0
- package/dist/array/coalescing.d.ts +3 -0
- package/dist/array/coalescing.mjs +7 -0
- 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/map.cjs +1 -1
- package/dist/array/map.d.ts +2 -2
- package/dist/array/map.mjs +1 -1
- package/dist/array/reduce.cjs +1 -1
- package/dist/array/reduce.mjs +1 -1
- package/dist/array/types/ArrayCoalescing.d.ts +1 -0
- package/dist/array/types/index.d.ts +1 -0
- package/dist/common/escapeRegExp.cjs +2 -2
- package/dist/common/escapeRegExp.d.ts +1 -1
- package/dist/common/escapeRegExp.mjs +2 -2
- package/dist/common/index.d.ts +4 -0
- package/dist/common/instanceOf.cjs +20 -0
- package/dist/common/instanceOf.d.ts +3 -0
- package/dist/common/instanceOf.mjs +18 -0
- package/dist/common/justReturn.cjs +12 -0
- package/dist/common/justReturn.d.ts +3 -0
- package/dist/common/justReturn.mjs +10 -0
- package/dist/common/kind.cjs +38 -1
- package/dist/common/kind.d.ts +22 -4
- package/dist/common/kind.mjs +38 -2
- package/dist/common/memo.cjs +16 -0
- package/dist/common/memo.d.ts +5 -0
- package/dist/common/memo.mjs +14 -0
- package/dist/common/simpleClone.cjs +2 -2
- package/dist/common/simpleClone.mjs +2 -2
- package/dist/common/types/anyConstructor.d.ts +1 -0
- package/dist/common/types/anyPredicate.d.ts +1 -0
- package/dist/common/types/index.d.ts +2 -0
- package/dist/common/types/objectEntry.d.ts +1 -1
- package/dist/common/types/predicate.d.ts +1 -0
- package/dist/common/types/unionContain.d.ts +1 -1
- package/dist/common/when.d.ts +2 -2
- package/dist/common/whenElse.cjs +17 -0
- package/dist/common/whenElse.d.ts +5 -0
- package/dist/common/whenElse.mjs +15 -0
- package/dist/common/whenNot.d.ts +2 -2
- package/dist/dataParser/base.cjs +116 -0
- package/dist/dataParser/base.d.ts +44 -0
- package/dist/dataParser/base.mjs +109 -0
- package/dist/dataParser/baseExtended.cjs +55 -0
- package/dist/dataParser/baseExtended.d.ts +45 -0
- package/dist/dataParser/baseExtended.mjs +52 -0
- package/dist/dataParser/error.cjs +54 -0
- package/dist/dataParser/error.d.ts +31 -0
- package/dist/dataParser/error.mjs +41 -0
- package/dist/dataParser/extended/array.cjs +20 -0
- package/dist/dataParser/extended/array.d.ts +21 -0
- package/dist/dataParser/extended/array.mjs +18 -0
- package/dist/dataParser/extended/bigint.cjs +20 -0
- package/dist/dataParser/extended/bigint.d.ts +19 -0
- package/dist/dataParser/extended/bigint.mjs +18 -0
- package/dist/dataParser/extended/boolean.cjs +11 -0
- package/dist/dataParser/extended/boolean.d.ts +9 -0
- package/dist/dataParser/extended/boolean.mjs +9 -0
- package/dist/dataParser/extended/coerce/bigint.cjs +13 -0
- package/dist/dataParser/extended/coerce/bigint.d.ts +7 -0
- package/dist/dataParser/extended/coerce/bigint.mjs +11 -0
- package/dist/dataParser/extended/coerce/boolean.cjs +13 -0
- package/dist/dataParser/extended/coerce/boolean.d.ts +7 -0
- package/dist/dataParser/extended/coerce/boolean.mjs +11 -0
- package/dist/dataParser/extended/coerce/empty.cjs +13 -0
- package/dist/dataParser/extended/coerce/empty.d.ts +7 -0
- package/dist/dataParser/extended/coerce/empty.mjs +11 -0
- package/dist/dataParser/extended/coerce/index.cjs +17 -0
- package/dist/dataParser/extended/coerce/index.d.ts +6 -0
- package/dist/dataParser/extended/coerce/index.mjs +6 -0
- package/dist/dataParser/extended/coerce/nil.cjs +13 -0
- package/dist/dataParser/extended/coerce/nil.d.ts +7 -0
- package/dist/dataParser/extended/coerce/nil.mjs +11 -0
- package/dist/dataParser/extended/coerce/number.cjs +13 -0
- package/dist/dataParser/extended/coerce/number.d.ts +7 -0
- package/dist/dataParser/extended/coerce/number.mjs +11 -0
- package/dist/dataParser/extended/coerce/string.cjs +13 -0
- package/dist/dataParser/extended/coerce/string.d.ts +7 -0
- package/dist/dataParser/extended/coerce/string.mjs +11 -0
- package/dist/dataParser/extended/empty.cjs +11 -0
- package/dist/dataParser/extended/empty.d.ts +9 -0
- package/dist/dataParser/extended/empty.mjs +9 -0
- package/dist/dataParser/extended/index.cjs +48 -0
- package/dist/dataParser/extended/index.d.ts +22 -0
- package/dist/dataParser/extended/index.mjs +21 -0
- package/dist/dataParser/extended/lazy.cjs +11 -0
- package/dist/dataParser/extended/lazy.d.ts +11 -0
- package/dist/dataParser/extended/lazy.mjs +9 -0
- package/dist/dataParser/extended/literal.cjs +11 -0
- package/dist/dataParser/extended/literal.d.ts +11 -0
- package/dist/dataParser/extended/literal.mjs +9 -0
- package/dist/dataParser/extended/nil.cjs +11 -0
- package/dist/dataParser/extended/nil.d.ts +9 -0
- package/dist/dataParser/extended/nil.mjs +9 -0
- package/dist/dataParser/extended/nullable.cjs +11 -0
- package/dist/dataParser/extended/nullable.d.ts +11 -0
- package/dist/dataParser/extended/nullable.mjs +9 -0
- package/dist/dataParser/extended/number.cjs +27 -0
- package/dist/dataParser/extended/number.d.ts +24 -0
- package/dist/dataParser/extended/number.mjs +24 -0
- package/dist/dataParser/extended/object.cjs +11 -0
- package/dist/dataParser/extended/object.d.ts +11 -0
- package/dist/dataParser/extended/object.mjs +9 -0
- package/dist/dataParser/extended/optional.cjs +11 -0
- package/dist/dataParser/extended/optional.d.ts +11 -0
- package/dist/dataParser/extended/optional.mjs +9 -0
- package/dist/dataParser/extended/pipe.cjs +11 -0
- package/dist/dataParser/extended/pipe.d.ts +12 -0
- package/dist/dataParser/extended/pipe.mjs +9 -0
- package/dist/dataParser/extended/record.cjs +11 -0
- package/dist/dataParser/extended/record.d.ts +12 -0
- package/dist/dataParser/extended/record.mjs +9 -0
- package/dist/dataParser/extended/string.cjs +38 -0
- package/dist/dataParser/extended/string.d.ts +32 -0
- package/dist/dataParser/extended/string.mjs +34 -0
- package/dist/dataParser/extended/templateLiteral.cjs +10 -0
- package/dist/dataParser/extended/templateLiteral.d.ts +11 -0
- package/dist/dataParser/extended/templateLiteral.mjs +8 -0
- package/dist/dataParser/extended/transform.cjs +11 -0
- package/dist/dataParser/extended/transform.d.ts +14 -0
- package/dist/dataParser/extended/transform.mjs +9 -0
- package/dist/dataParser/extended/tuple.cjs +11 -0
- package/dist/dataParser/extended/tuple.d.ts +11 -0
- package/dist/dataParser/extended/tuple.mjs +9 -0
- package/dist/dataParser/extended/union.cjs +11 -0
- package/dist/dataParser/extended/union.d.ts +11 -0
- package/dist/dataParser/extended/union.mjs +9 -0
- package/dist/dataParser/extended/unknown.cjs +11 -0
- package/dist/dataParser/extended/unknown.d.ts +9 -0
- package/dist/dataParser/extended/unknown.mjs +9 -0
- package/dist/dataParser/index.cjs +128 -0
- package/dist/dataParser/index.d.ts +6 -0
- package/dist/dataParser/index.mjs +38 -0
- package/dist/dataParser/parsers/array/checkers/index.d.ts +2 -0
- package/dist/dataParser/parsers/array/checkers/max.cjs +23 -0
- package/dist/dataParser/parsers/array/checkers/max.d.ts +11 -0
- package/dist/dataParser/parsers/array/checkers/max.mjs +20 -0
- package/dist/dataParser/parsers/array/checkers/min.cjs +23 -0
- package/dist/dataParser/parsers/array/checkers/min.d.ts +11 -0
- package/dist/dataParser/parsers/array/checkers/min.mjs +20 -0
- package/dist/dataParser/parsers/array/index.cjs +64 -0
- package/dist/dataParser/parsers/array/index.d.ts +20 -0
- package/dist/dataParser/parsers/array/index.mjs +61 -0
- package/dist/dataParser/parsers/bigint/checkers/index.d.ts +2 -0
- package/dist/dataParser/parsers/bigint/checkers/max.cjs +23 -0
- package/dist/dataParser/parsers/bigint/checkers/max.d.ts +11 -0
- package/dist/dataParser/parsers/bigint/checkers/max.mjs +20 -0
- package/dist/dataParser/parsers/bigint/checkers/min.cjs +23 -0
- package/dist/dataParser/parsers/bigint/checkers/min.d.ts +11 -0
- package/dist/dataParser/parsers/bigint/checkers/min.mjs +20 -0
- package/dist/dataParser/parsers/bigint/index.cjs +31 -0
- package/dist/dataParser/parsers/bigint/index.d.ts +18 -0
- package/dist/dataParser/parsers/bigint/index.mjs +28 -0
- package/dist/dataParser/parsers/boolean.cjs +40 -0
- package/dist/dataParser/parsers/boolean.d.ts +12 -0
- package/dist/dataParser/parsers/boolean.mjs +37 -0
- package/dist/dataParser/parsers/coerce/bigint.cjs +13 -0
- package/dist/dataParser/parsers/coerce/bigint.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/bigint.mjs +11 -0
- package/dist/dataParser/parsers/coerce/boolean.cjs +13 -0
- package/dist/dataParser/parsers/coerce/boolean.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/boolean.mjs +11 -0
- package/dist/dataParser/parsers/coerce/empty.cjs +13 -0
- package/dist/dataParser/parsers/coerce/empty.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/empty.mjs +11 -0
- package/dist/dataParser/parsers/coerce/index.cjs +17 -0
- package/dist/dataParser/parsers/coerce/index.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/index.mjs +6 -0
- package/dist/dataParser/parsers/coerce/nil.cjs +13 -0
- package/dist/dataParser/parsers/coerce/nil.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/nil.mjs +11 -0
- package/dist/dataParser/parsers/coerce/number.cjs +13 -0
- package/dist/dataParser/parsers/coerce/number.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/number.mjs +11 -0
- package/dist/dataParser/parsers/coerce/string.cjs +13 -0
- package/dist/dataParser/parsers/coerce/string.d.ts +6 -0
- package/dist/dataParser/parsers/coerce/string.mjs +11 -0
- package/dist/dataParser/parsers/empty.cjs +27 -0
- package/dist/dataParser/parsers/empty.d.ts +12 -0
- package/dist/dataParser/parsers/empty.mjs +24 -0
- package/dist/dataParser/parsers/index.d.ts +20 -0
- package/dist/dataParser/parsers/lazy.cjs +21 -0
- package/dist/dataParser/parsers/lazy.d.ts +14 -0
- package/dist/dataParser/parsers/lazy.mjs +18 -0
- package/dist/dataParser/parsers/literal.cjs +25 -0
- package/dist/dataParser/parsers/literal.d.ts +15 -0
- package/dist/dataParser/parsers/literal.mjs +22 -0
- package/dist/dataParser/parsers/nil.cjs +27 -0
- package/dist/dataParser/parsers/nil.d.ts +12 -0
- package/dist/dataParser/parsers/nil.mjs +24 -0
- package/dist/dataParser/parsers/nullable.cjs +31 -0
- package/dist/dataParser/parsers/nullable.d.ts +14 -0
- package/dist/dataParser/parsers/nullable.mjs +28 -0
- package/dist/dataParser/parsers/number/checkers/index.d.ts +3 -0
- package/dist/dataParser/parsers/number/checkers/int.cjs +27 -0
- package/dist/dataParser/parsers/number/checkers/int.d.ts +15 -0
- package/dist/dataParser/parsers/number/checkers/int.mjs +23 -0
- package/dist/dataParser/parsers/number/checkers/max.cjs +18 -0
- package/dist/dataParser/parsers/number/checkers/max.d.ts +11 -0
- package/dist/dataParser/parsers/number/checkers/max.mjs +15 -0
- package/dist/dataParser/parsers/number/checkers/min.cjs +18 -0
- package/dist/dataParser/parsers/number/checkers/min.d.ts +11 -0
- package/dist/dataParser/parsers/number/checkers/min.mjs +15 -0
- package/dist/dataParser/parsers/number/index.cjs +31 -0
- package/dist/dataParser/parsers/number/index.d.ts +18 -0
- package/dist/dataParser/parsers/number/index.mjs +28 -0
- package/dist/dataParser/parsers/object.cjs +74 -0
- package/dist/dataParser/parsers/object.d.ts +26 -0
- package/dist/dataParser/parsers/object.mjs +71 -0
- package/dist/dataParser/parsers/optional.cjs +31 -0
- package/dist/dataParser/parsers/optional.d.ts +14 -0
- package/dist/dataParser/parsers/optional.mjs +28 -0
- package/dist/dataParser/parsers/pipe.cjs +34 -0
- package/dist/dataParser/parsers/pipe.d.ts +16 -0
- package/dist/dataParser/parsers/pipe.mjs +31 -0
- package/dist/dataParser/parsers/record.cjs +83 -0
- package/dist/dataParser/parsers/record.d.ts +30 -0
- package/dist/dataParser/parsers/record.mjs +80 -0
- package/dist/dataParser/parsers/string/checkers/email.cjs +31 -0
- package/dist/dataParser/parsers/string/checkers/email.d.ts +17 -0
- package/dist/dataParser/parsers/string/checkers/email.mjs +27 -0
- package/dist/dataParser/parsers/string/checkers/index.d.ts +5 -0
- package/dist/dataParser/parsers/string/checkers/max.cjs +18 -0
- package/dist/dataParser/parsers/string/checkers/max.d.ts +11 -0
- package/dist/dataParser/parsers/string/checkers/max.mjs +15 -0
- package/dist/dataParser/parsers/string/checkers/min.cjs +18 -0
- package/dist/dataParser/parsers/string/checkers/min.d.ts +11 -0
- package/dist/dataParser/parsers/string/checkers/min.mjs +15 -0
- package/dist/dataParser/parsers/string/checkers/regex.cjs +20 -0
- package/dist/dataParser/parsers/string/checkers/regex.d.ts +11 -0
- package/dist/dataParser/parsers/string/checkers/regex.mjs +17 -0
- package/dist/dataParser/parsers/string/checkers/url.cjs +48 -0
- package/dist/dataParser/parsers/string/checkers/url.d.ts +18 -0
- package/dist/dataParser/parsers/string/checkers/url.mjs +44 -0
- package/dist/dataParser/parsers/string/index.cjs +31 -0
- package/dist/dataParser/parsers/string/index.d.ts +18 -0
- package/dist/dataParser/parsers/string/index.mjs +28 -0
- package/dist/dataParser/parsers/templateLiteral.cjs +45 -0
- package/dist/dataParser/parsers/templateLiteral.d.ts +49 -0
- package/dist/dataParser/parsers/templateLiteral.mjs +42 -0
- package/dist/dataParser/parsers/transform.cjs +43 -0
- package/dist/dataParser/parsers/transform.d.ts +17 -0
- package/dist/dataParser/parsers/transform.mjs +40 -0
- package/dist/dataParser/parsers/tuple.cjs +83 -0
- package/dist/dataParser/parsers/tuple.d.ts +33 -0
- package/dist/dataParser/parsers/tuple.mjs +80 -0
- package/dist/dataParser/parsers/union.cjs +38 -0
- package/dist/dataParser/parsers/union.d.ts +15 -0
- package/dist/dataParser/parsers/union.mjs +35 -0
- package/dist/dataParser/parsers/unknown.cjs +17 -0
- package/dist/dataParser/parsers/unknown.d.ts +11 -0
- package/dist/dataParser/parsers/unknown.mjs +14 -0
- package/dist/dataParser/types/addCheckersToDefinition.d.ts +5 -0
- package/dist/dataParser/types/checkers.d.ts +3 -0
- package/dist/dataParser/types/dataParsers.d.ts +5 -0
- package/dist/dataParser/types/index.d.ts +4 -0
- package/dist/dataParser/types/mergeDefinition.d.ts +5 -0
- package/dist/either/bool/falsy.cjs +1 -1
- package/dist/either/bool/falsy.d.ts +2 -2
- package/dist/either/bool/falsy.mjs +1 -1
- package/dist/either/bool/truthy.cjs +1 -1
- package/dist/either/bool/truthy.d.ts +2 -2
- package/dist/either/bool/truthy.mjs +1 -1
- package/dist/either/future/error.cjs +1 -1
- package/dist/either/future/error.mjs +1 -1
- package/dist/either/future/success.cjs +1 -1
- package/dist/either/future/success.mjs +1 -1
- package/dist/either/left/create.cjs +1 -1
- package/dist/either/left/create.mjs +1 -1
- package/dist/either/left/error.cjs +1 -1
- package/dist/either/left/error.mjs +1 -1
- package/dist/either/left/fail.cjs +1 -1
- package/dist/either/left/fail.mjs +1 -1
- package/dist/either/left/when.d.ts +2 -2
- package/dist/either/nullable/empty.cjs +1 -1
- package/dist/either/nullable/empty.d.ts +2 -2
- package/dist/either/nullable/empty.mjs +1 -1
- package/dist/either/nullable/filled.cjs +1 -1
- package/dist/either/nullable/filled.d.ts +2 -2
- package/dist/either/nullable/filled.mjs +1 -1
- package/dist/either/nullish/empty.cjs +1 -1
- package/dist/either/nullish/empty.d.ts +2 -2
- package/dist/either/nullish/empty.mjs +1 -1
- package/dist/either/nullish/filled.cjs +1 -1
- package/dist/either/nullish/filled.d.ts +2 -2
- package/dist/either/nullish/filled.mjs +1 -1
- package/dist/either/optional/empty.cjs +1 -1
- package/dist/either/optional/empty.d.ts +2 -2
- package/dist/either/optional/empty.mjs +1 -1
- package/dist/either/optional/filled.cjs +1 -1
- package/dist/either/optional/filled.d.ts +2 -2
- package/dist/either/optional/filled.mjs +1 -1
- package/dist/either/right/asyncPipe.d.ts +2 -2
- package/dist/either/right/create.cjs +1 -1
- package/dist/either/right/create.mjs +1 -1
- package/dist/either/right/ok.cjs +1 -1
- package/dist/either/right/ok.mjs +1 -1
- package/dist/either/right/success.cjs +1 -1
- package/dist/either/right/success.mjs +1 -1
- package/dist/either/right/when.d.ts +2 -2
- package/dist/either/whenHasInformation.d.ts +2 -2
- package/dist/generator/reduce.cjs +1 -1
- package/dist/generator/reduce.mjs +1 -1
- package/dist/index.cjs +18 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +14 -1
- package/dist/object/entry.cjs +7 -0
- package/dist/object/entry.d.ts +2 -0
- package/dist/object/entry.mjs +5 -0
- package/dist/object/fromEntries.d.ts +1 -1
- package/dist/object/index.cjs +2 -0
- package/dist/object/index.d.ts +1 -0
- package/dist/object/index.mjs +1 -0
- package/dist/object/keys.cjs +4 -1
- package/dist/object/keys.d.ts +1 -1
- package/dist/object/keys.mjs +4 -1
- package/dist/object/types/getPropsWithValueExtends.d.ts +1 -1
- package/dist/pattern/result.cjs +1 -1
- package/dist/pattern/result.d.ts +1 -1
- package/dist/pattern/result.mjs +1 -1
- package/dist/pattern/when.d.ts +2 -2
- package/package.json +64 -3
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export { SymbolDataParserError, SymbolDataParserErrorLabel, dataParserCheckerInit, dataParserCheckerKind, dataParserInit, dataParserKind } from './base.mjs';
|
|
2
|
+
export { dataParserExtendedInit, dataParserExtendedKind } from './baseExtended.mjs';
|
|
3
|
+
export { SymbolDataParserErrorIssue, SymbolDataParserErrorIssueLabel, SymbolDataParserErrorPromiseIssue, SymbolDataParserErrorPromiseIssueLabel, addIssue, addPromiseIssue, createError, dataParserErrorIssueKind, dataParserErrorKind, dataParserErrorPromiseIssueKind, popErrorPath, setErrorPath } from './error.mjs';
|
|
4
|
+
import * as index$1 from './parsers/coerce/index.mjs';
|
|
5
|
+
export { index$1 as coerce };
|
|
6
|
+
export { dataParserStringKind, string } from './parsers/string/index.mjs';
|
|
7
|
+
export { dataParserObjectKind, object } from './parsers/object.mjs';
|
|
8
|
+
export { dataParserNumberKind, number } from './parsers/number/index.mjs';
|
|
9
|
+
export { dataParserLiteralKind, literal } from './parsers/literal.mjs';
|
|
10
|
+
export { dataParserUnionKind, union } from './parsers/union.mjs';
|
|
11
|
+
export { array, dataParserArrayKind } from './parsers/array/index.mjs';
|
|
12
|
+
export { bigint, dataParserBigIntKind } from './parsers/bigint/index.mjs';
|
|
13
|
+
export { dataParserTupleKind, tuple } from './parsers/tuple.mjs';
|
|
14
|
+
export { dataParserTransformKind, transform } from './parsers/transform.mjs';
|
|
15
|
+
export { dataParserNilKind, nil } from './parsers/nil.mjs';
|
|
16
|
+
export { boolean, dataParserBooleanKind } from './parsers/boolean.mjs';
|
|
17
|
+
export { dataParserEmptyKind, empty } from './parsers/empty.mjs';
|
|
18
|
+
export { dataParserTemplateLiteralKind, templateLiteral } from './parsers/templateLiteral.mjs';
|
|
19
|
+
export { dataParserPipeKind, pipe } from './parsers/pipe.mjs';
|
|
20
|
+
export { dataParserOptionalKind, optional } from './parsers/optional.mjs';
|
|
21
|
+
export { dataParserNullableKind, nullable } from './parsers/nullable.mjs';
|
|
22
|
+
export { dataParserLazyKind, lazy } from './parsers/lazy.mjs';
|
|
23
|
+
export { dataParserUnknownKind, unknown } from './parsers/unknown.mjs';
|
|
24
|
+
export { dataParserRecordKind, record } from './parsers/record.mjs';
|
|
25
|
+
import * as index from './extended/index.mjs';
|
|
26
|
+
export { index as extended };
|
|
27
|
+
export { checkerUrl, dataParserCheckerUrlKind, url } from './parsers/string/checkers/url.mjs';
|
|
28
|
+
export { checkerEmail, dataParserCheckerEmailKind, email } from './parsers/string/checkers/email.mjs';
|
|
29
|
+
export { checkerStringMax, dataParserCheckerStringMaxKind } from './parsers/string/checkers/max.mjs';
|
|
30
|
+
export { checkerStringMin, dataParserCheckerStringMinKind } from './parsers/string/checkers/min.mjs';
|
|
31
|
+
export { checkerStringRegex, dataParserCheckerStringRegexKind } from './parsers/string/checkers/regex.mjs';
|
|
32
|
+
export { checkerInt, dataParserCheckerIntKind, int } from './parsers/number/checkers/int.mjs';
|
|
33
|
+
export { checkerNumberMin, dataParserCheckerNumberMinKind } from './parsers/number/checkers/min.mjs';
|
|
34
|
+
export { checkerNumberMax, dataParserCheckerNumberMaxKind } from './parsers/number/checkers/max.mjs';
|
|
35
|
+
export { checkerArrayMin, dataParserCheckerArrayMinKind } from './parsers/array/checkers/min.mjs';
|
|
36
|
+
export { checkerArrayMax, dataParserCheckerArrayMaxKind } from './parsers/array/checkers/max.mjs';
|
|
37
|
+
export { checkerBigIntMin, dataParserCheckerBigIntMinKind } from './parsers/bigint/checkers/min.mjs';
|
|
38
|
+
export { checkerBigIntMax, dataParserCheckerBigIntMaxKind } from './parsers/bigint/checkers/max.mjs';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kind = require('../../../../common/kind.cjs');
|
|
4
|
+
var base = require('../../../base.cjs');
|
|
5
|
+
var error = require('../../../error.cjs');
|
|
6
|
+
|
|
7
|
+
const dataParserCheckerArrayMaxKind = kind.createKind("data-parser-checker-array-max");
|
|
8
|
+
function checkerArrayMax(max, definition = {}) {
|
|
9
|
+
return base.dataParserCheckerInit(dataParserCheckerArrayMaxKind, {
|
|
10
|
+
definition: {
|
|
11
|
+
...definition,
|
|
12
|
+
max,
|
|
13
|
+
},
|
|
14
|
+
}, (data, self) => {
|
|
15
|
+
if (data.length > self.definition.max) {
|
|
16
|
+
return error.SymbolDataParserErrorIssue;
|
|
17
|
+
}
|
|
18
|
+
return data;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.checkerArrayMax = checkerArrayMax;
|
|
23
|
+
exports.dataParserCheckerArrayMaxKind = dataParserCheckerArrayMaxKind;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Kind } from "../../../../common";
|
|
2
|
+
import { type DataParserCheckerDefinition, type DataParserChecker } from "../../../../dataParser/base";
|
|
3
|
+
export interface DataParserCheckerDefinitionArrayMax extends DataParserCheckerDefinition {
|
|
4
|
+
max: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const dataParserCheckerArrayMaxKind: import("../../../../common").KindHandler<import("../../../../common").KindDefinition<"data-parser-checker-array-max", unknown>>;
|
|
7
|
+
type _DataParserCheckerArrayMax = (Kind<typeof dataParserCheckerArrayMaxKind.definition> & DataParserChecker<DataParserCheckerDefinitionArrayMax, unknown[]>);
|
|
8
|
+
export interface DataParserCheckerArrayMax extends _DataParserCheckerArrayMax {
|
|
9
|
+
}
|
|
10
|
+
export declare function checkerArrayMax(max: number, definition?: Partial<Omit<DataParserCheckerDefinitionArrayMax, "max">>): DataParserCheckerArrayMax;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createKind } from '../../../../common/kind.mjs';
|
|
2
|
+
import { dataParserCheckerInit } from '../../../base.mjs';
|
|
3
|
+
import { SymbolDataParserErrorIssue } from '../../../error.mjs';
|
|
4
|
+
|
|
5
|
+
const dataParserCheckerArrayMaxKind = createKind("data-parser-checker-array-max");
|
|
6
|
+
function checkerArrayMax(max, definition = {}) {
|
|
7
|
+
return dataParserCheckerInit(dataParserCheckerArrayMaxKind, {
|
|
8
|
+
definition: {
|
|
9
|
+
...definition,
|
|
10
|
+
max,
|
|
11
|
+
},
|
|
12
|
+
}, (data, self) => {
|
|
13
|
+
if (data.length > self.definition.max) {
|
|
14
|
+
return SymbolDataParserErrorIssue;
|
|
15
|
+
}
|
|
16
|
+
return data;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { checkerArrayMax, dataParserCheckerArrayMaxKind };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kind = require('../../../../common/kind.cjs');
|
|
4
|
+
var base = require('../../../base.cjs');
|
|
5
|
+
var error = require('../../../error.cjs');
|
|
6
|
+
|
|
7
|
+
const dataParserCheckerArrayMinKind = kind.createKind("data-parser-checker-array-min");
|
|
8
|
+
function checkerArrayMin(min, definition = {}) {
|
|
9
|
+
return base.dataParserCheckerInit(dataParserCheckerArrayMinKind, {
|
|
10
|
+
definition: {
|
|
11
|
+
...definition,
|
|
12
|
+
min,
|
|
13
|
+
},
|
|
14
|
+
}, (data, self) => {
|
|
15
|
+
if (data.length < self.definition.min) {
|
|
16
|
+
return error.SymbolDataParserErrorIssue;
|
|
17
|
+
}
|
|
18
|
+
return data;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.checkerArrayMin = checkerArrayMin;
|
|
23
|
+
exports.dataParserCheckerArrayMinKind = dataParserCheckerArrayMinKind;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Kind } from "../../../../common";
|
|
2
|
+
import { type DataParserCheckerDefinition, type DataParserChecker } from "../../../../dataParser/base";
|
|
3
|
+
export interface DataParserCheckerDefinitionArrayMin extends DataParserCheckerDefinition {
|
|
4
|
+
min: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const dataParserCheckerArrayMinKind: import("../../../../common").KindHandler<import("../../../../common").KindDefinition<"data-parser-checker-array-min", unknown>>;
|
|
7
|
+
type _DataParserCheckerArrayMin = (Kind<typeof dataParserCheckerArrayMinKind.definition> & DataParserChecker<DataParserCheckerDefinitionArrayMin, unknown[]>);
|
|
8
|
+
export interface DataParserCheckerArrayMin extends _DataParserCheckerArrayMin {
|
|
9
|
+
}
|
|
10
|
+
export declare function checkerArrayMin(min: number, definition?: Partial<Omit<DataParserCheckerDefinitionArrayMin, "min">>): DataParserCheckerArrayMin;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createKind } from '../../../../common/kind.mjs';
|
|
2
|
+
import { dataParserCheckerInit } from '../../../base.mjs';
|
|
3
|
+
import { SymbolDataParserErrorIssue } from '../../../error.mjs';
|
|
4
|
+
|
|
5
|
+
const dataParserCheckerArrayMinKind = createKind("data-parser-checker-array-min");
|
|
6
|
+
function checkerArrayMin(min, definition = {}) {
|
|
7
|
+
return dataParserCheckerInit(dataParserCheckerArrayMinKind, {
|
|
8
|
+
definition: {
|
|
9
|
+
...definition,
|
|
10
|
+
min,
|
|
11
|
+
},
|
|
12
|
+
}, (data, self) => {
|
|
13
|
+
if (data.length < self.definition.min) {
|
|
14
|
+
return SymbolDataParserErrorIssue;
|
|
15
|
+
}
|
|
16
|
+
return data;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { checkerArrayMin, dataParserCheckerArrayMinKind };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kind = require('../../../common/kind.cjs');
|
|
4
|
+
var base = require('../../base.cjs');
|
|
5
|
+
var error = require('../../error.cjs');
|
|
6
|
+
|
|
7
|
+
const dataParserArrayKind = kind.createKind("data-parser-array");
|
|
8
|
+
function array(element, definition) {
|
|
9
|
+
return base.dataParserInit(dataParserArrayKind, {
|
|
10
|
+
definition: {
|
|
11
|
+
errorMessage: definition?.errorMessage,
|
|
12
|
+
checkers: definition?.checkers ?? [],
|
|
13
|
+
element,
|
|
14
|
+
},
|
|
15
|
+
}, {
|
|
16
|
+
sync: (data, error$1, self) => {
|
|
17
|
+
if (!(data instanceof Array)) {
|
|
18
|
+
return error.SymbolDataParserErrorIssue;
|
|
19
|
+
}
|
|
20
|
+
let output = [];
|
|
21
|
+
const currentIndexPath = error$1.currentPath.length;
|
|
22
|
+
for (let index = 0; index < data.length; index++) {
|
|
23
|
+
error.setErrorPath(error$1, `[${index}]`, currentIndexPath);
|
|
24
|
+
const result = self
|
|
25
|
+
.definition
|
|
26
|
+
.element
|
|
27
|
+
.exec(data[index], error$1);
|
|
28
|
+
if (result === base.SymbolDataParserError) {
|
|
29
|
+
output = base.SymbolDataParserError;
|
|
30
|
+
}
|
|
31
|
+
else if (output !== base.SymbolDataParserError) {
|
|
32
|
+
output.push(result);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
error.popErrorPath(error$1);
|
|
36
|
+
return output;
|
|
37
|
+
},
|
|
38
|
+
async: async (data, error$1, self) => {
|
|
39
|
+
if (!(data instanceof Array)) {
|
|
40
|
+
return error.SymbolDataParserErrorIssue;
|
|
41
|
+
}
|
|
42
|
+
let output = [];
|
|
43
|
+
const currentIndexPath = error$1.currentPath.length;
|
|
44
|
+
for (let index = 0; index < data.length; index++) {
|
|
45
|
+
error.setErrorPath(error$1, `[${index}]`, currentIndexPath);
|
|
46
|
+
const result = await self
|
|
47
|
+
.definition
|
|
48
|
+
.element
|
|
49
|
+
.asyncExec(data[index], error$1);
|
|
50
|
+
if (result === base.SymbolDataParserError) {
|
|
51
|
+
output = base.SymbolDataParserError;
|
|
52
|
+
}
|
|
53
|
+
else if (output !== base.SymbolDataParserError) {
|
|
54
|
+
output.push(result);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
error.popErrorPath(error$1);
|
|
58
|
+
return output;
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
exports.array = array;
|
|
64
|
+
exports.dataParserArrayKind = dataParserArrayKind;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type NeverCoalescing, type Kind } from "../../../common";
|
|
2
|
+
import { type DataParserDefinition, type DataParser, type Output, type Input } from "../../base";
|
|
3
|
+
import { type AddCheckersToDefinition, type DataParsers, type MergeDefinition } from "../../../dataParser/types";
|
|
4
|
+
import { type DataParserCheckerArrayMin, type DataParserCheckerArrayMax } from "./checkers";
|
|
5
|
+
export * from "./checkers";
|
|
6
|
+
export type DataParserArrayCheckers = (DataParserCheckerArrayMin | DataParserCheckerArrayMax);
|
|
7
|
+
export interface DataParserDefinitionArray extends DataParserDefinition<DataParserArrayCheckers> {
|
|
8
|
+
readonly element: DataParsers;
|
|
9
|
+
}
|
|
10
|
+
export declare const dataParserArrayKind: import("../../../common").KindHandler<import("../../../common").KindDefinition<"data-parser-array", unknown>>;
|
|
11
|
+
type _DataParserArray<GenericDefinition extends DataParserDefinitionArray> = (DataParser<GenericDefinition, Output<GenericDefinition["element"]>[], Input<GenericDefinition["element"]>[]> & Kind<typeof dataParserArrayKind.definition>);
|
|
12
|
+
export interface DataParserArray<GenericDefinition extends DataParserDefinitionArray = DataParserDefinitionArray> extends _DataParserArray<GenericDefinition> {
|
|
13
|
+
addChecker<GenericChecker extends readonly [
|
|
14
|
+
DataParserArrayCheckers,
|
|
15
|
+
...DataParserArrayCheckers[]
|
|
16
|
+
]>(...args: GenericChecker): DataParserArray<AddCheckersToDefinition<GenericDefinition, GenericChecker>>;
|
|
17
|
+
}
|
|
18
|
+
export declare function array<GenericElement extends DataParsers, const GenericDefinition extends Partial<Omit<DataParserDefinitionArray, "element">> = never>(element: GenericElement, definition?: GenericDefinition): DataParserArray<MergeDefinition<DataParserDefinitionArray, NeverCoalescing<GenericDefinition, {}> & {
|
|
19
|
+
element: GenericElement;
|
|
20
|
+
}>>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createKind } from '../../../common/kind.mjs';
|
|
2
|
+
import { dataParserInit, SymbolDataParserError } from '../../base.mjs';
|
|
3
|
+
import { SymbolDataParserErrorIssue, setErrorPath, popErrorPath } from '../../error.mjs';
|
|
4
|
+
|
|
5
|
+
const dataParserArrayKind = createKind("data-parser-array");
|
|
6
|
+
function array(element, definition) {
|
|
7
|
+
return dataParserInit(dataParserArrayKind, {
|
|
8
|
+
definition: {
|
|
9
|
+
errorMessage: definition?.errorMessage,
|
|
10
|
+
checkers: definition?.checkers ?? [],
|
|
11
|
+
element,
|
|
12
|
+
},
|
|
13
|
+
}, {
|
|
14
|
+
sync: (data, error, self) => {
|
|
15
|
+
if (!(data instanceof Array)) {
|
|
16
|
+
return SymbolDataParserErrorIssue;
|
|
17
|
+
}
|
|
18
|
+
let output = [];
|
|
19
|
+
const currentIndexPath = error.currentPath.length;
|
|
20
|
+
for (let index = 0; index < data.length; index++) {
|
|
21
|
+
setErrorPath(error, `[${index}]`, currentIndexPath);
|
|
22
|
+
const result = self
|
|
23
|
+
.definition
|
|
24
|
+
.element
|
|
25
|
+
.exec(data[index], error);
|
|
26
|
+
if (result === SymbolDataParserError) {
|
|
27
|
+
output = SymbolDataParserError;
|
|
28
|
+
}
|
|
29
|
+
else if (output !== SymbolDataParserError) {
|
|
30
|
+
output.push(result);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
popErrorPath(error);
|
|
34
|
+
return output;
|
|
35
|
+
},
|
|
36
|
+
async: async (data, error, self) => {
|
|
37
|
+
if (!(data instanceof Array)) {
|
|
38
|
+
return SymbolDataParserErrorIssue;
|
|
39
|
+
}
|
|
40
|
+
let output = [];
|
|
41
|
+
const currentIndexPath = error.currentPath.length;
|
|
42
|
+
for (let index = 0; index < data.length; index++) {
|
|
43
|
+
setErrorPath(error, `[${index}]`, currentIndexPath);
|
|
44
|
+
const result = await self
|
|
45
|
+
.definition
|
|
46
|
+
.element
|
|
47
|
+
.asyncExec(data[index], error);
|
|
48
|
+
if (result === SymbolDataParserError) {
|
|
49
|
+
output = SymbolDataParserError;
|
|
50
|
+
}
|
|
51
|
+
else if (output !== SymbolDataParserError) {
|
|
52
|
+
output.push(result);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
popErrorPath(error);
|
|
56
|
+
return output;
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { array, dataParserArrayKind };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kind = require('../../../../common/kind.cjs');
|
|
4
|
+
var base = require('../../../base.cjs');
|
|
5
|
+
var error = require('../../../error.cjs');
|
|
6
|
+
|
|
7
|
+
const dataParserCheckerBigIntMaxKind = kind.createKind("data-parser-checker-bigint-max");
|
|
8
|
+
function checkerBigIntMax(max, definition = {}) {
|
|
9
|
+
return base.dataParserCheckerInit(dataParserCheckerBigIntMaxKind, {
|
|
10
|
+
definition: {
|
|
11
|
+
...definition,
|
|
12
|
+
max,
|
|
13
|
+
},
|
|
14
|
+
}, (value, self) => {
|
|
15
|
+
if (value > self.definition.max) {
|
|
16
|
+
return error.SymbolDataParserErrorIssue;
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.checkerBigIntMax = checkerBigIntMax;
|
|
23
|
+
exports.dataParserCheckerBigIntMaxKind = dataParserCheckerBigIntMaxKind;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Kind } from "../../../../common";
|
|
2
|
+
import { type DataParserCheckerDefinition, type DataParserChecker } from "../../../../dataParser/base";
|
|
3
|
+
export interface DataParserCheckerDefinitionBigIntMax extends DataParserCheckerDefinition {
|
|
4
|
+
max: bigint;
|
|
5
|
+
}
|
|
6
|
+
export declare const dataParserCheckerBigIntMaxKind: import("../../../../common").KindHandler<import("../../../../common").KindDefinition<"data-parser-checker-bigint-max", unknown>>;
|
|
7
|
+
type _DataParserCheckerBigIntMax = (Kind<typeof dataParserCheckerBigIntMaxKind.definition> & DataParserChecker<DataParserCheckerDefinitionBigIntMax, bigint>);
|
|
8
|
+
export interface DataParserCheckerBigIntMax extends _DataParserCheckerBigIntMax {
|
|
9
|
+
}
|
|
10
|
+
export declare function checkerBigIntMax(max: bigint, definition?: Partial<Omit<DataParserCheckerDefinitionBigIntMax, "max">>): DataParserCheckerBigIntMax;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createKind } from '../../../../common/kind.mjs';
|
|
2
|
+
import { dataParserCheckerInit } from '../../../base.mjs';
|
|
3
|
+
import { SymbolDataParserErrorIssue } from '../../../error.mjs';
|
|
4
|
+
|
|
5
|
+
const dataParserCheckerBigIntMaxKind = createKind("data-parser-checker-bigint-max");
|
|
6
|
+
function checkerBigIntMax(max, definition = {}) {
|
|
7
|
+
return dataParserCheckerInit(dataParserCheckerBigIntMaxKind, {
|
|
8
|
+
definition: {
|
|
9
|
+
...definition,
|
|
10
|
+
max,
|
|
11
|
+
},
|
|
12
|
+
}, (value, self) => {
|
|
13
|
+
if (value > self.definition.max) {
|
|
14
|
+
return SymbolDataParserErrorIssue;
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { checkerBigIntMax, dataParserCheckerBigIntMaxKind };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kind = require('../../../../common/kind.cjs');
|
|
4
|
+
var base = require('../../../base.cjs');
|
|
5
|
+
var error = require('../../../error.cjs');
|
|
6
|
+
|
|
7
|
+
const dataParserCheckerBigIntMinKind = kind.createKind("data-parser-checker-bigint-min");
|
|
8
|
+
function checkerBigIntMin(min, definition = {}) {
|
|
9
|
+
return base.dataParserCheckerInit(dataParserCheckerBigIntMinKind, {
|
|
10
|
+
definition: {
|
|
11
|
+
...definition,
|
|
12
|
+
min,
|
|
13
|
+
},
|
|
14
|
+
}, (value, self) => {
|
|
15
|
+
if (value < self.definition.min) {
|
|
16
|
+
return error.SymbolDataParserErrorIssue;
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
exports.checkerBigIntMin = checkerBigIntMin;
|
|
23
|
+
exports.dataParserCheckerBigIntMinKind = dataParserCheckerBigIntMinKind;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Kind } from "../../../../common";
|
|
2
|
+
import { type DataParserCheckerDefinition, type DataParserChecker } from "../../../../dataParser/base";
|
|
3
|
+
export interface DataParserCheckerDefinitionBigIntMin extends DataParserCheckerDefinition {
|
|
4
|
+
min: bigint;
|
|
5
|
+
}
|
|
6
|
+
export declare const dataParserCheckerBigIntMinKind: import("../../../../common").KindHandler<import("../../../../common").KindDefinition<"data-parser-checker-bigint-min", unknown>>;
|
|
7
|
+
type _DataParserCheckerBigIntMin = (Kind<typeof dataParserCheckerBigIntMinKind.definition> & DataParserChecker<DataParserCheckerDefinitionBigIntMin, bigint>);
|
|
8
|
+
export interface DataParserCheckerBigIntMin extends _DataParserCheckerBigIntMin {
|
|
9
|
+
}
|
|
10
|
+
export declare function checkerBigIntMin(min: bigint, definition?: Partial<Omit<DataParserCheckerDefinitionBigIntMin, "min">>): DataParserCheckerBigIntMin;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createKind } from '../../../../common/kind.mjs';
|
|
2
|
+
import { dataParserCheckerInit } from '../../../base.mjs';
|
|
3
|
+
import { SymbolDataParserErrorIssue } from '../../../error.mjs';
|
|
4
|
+
|
|
5
|
+
const dataParserCheckerBigIntMinKind = createKind("data-parser-checker-bigint-min");
|
|
6
|
+
function checkerBigIntMin(min, definition = {}) {
|
|
7
|
+
return dataParserCheckerInit(dataParserCheckerBigIntMinKind, {
|
|
8
|
+
definition: {
|
|
9
|
+
...definition,
|
|
10
|
+
min,
|
|
11
|
+
},
|
|
12
|
+
}, (value, self) => {
|
|
13
|
+
if (value < self.definition.min) {
|
|
14
|
+
return SymbolDataParserErrorIssue;
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { checkerBigIntMin, dataParserCheckerBigIntMinKind };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kind = require('../../../common/kind.cjs');
|
|
4
|
+
var base = require('../../base.cjs');
|
|
5
|
+
var error = require('../../error.cjs');
|
|
6
|
+
|
|
7
|
+
const dataParserBigIntKind = kind.createKind("data-parser-bigint");
|
|
8
|
+
function bigint(definition) {
|
|
9
|
+
return base.dataParserInit(dataParserBigIntKind, {
|
|
10
|
+
definition: {
|
|
11
|
+
errorMessage: definition?.errorMessage,
|
|
12
|
+
checkers: definition?.checkers ?? [],
|
|
13
|
+
coerce: definition?.coerce ?? false,
|
|
14
|
+
},
|
|
15
|
+
}, (data, _error, self) => {
|
|
16
|
+
if (self.definition.coerce) {
|
|
17
|
+
try {
|
|
18
|
+
// eslint-disable-next-line no-param-reassign
|
|
19
|
+
data = BigInt(data);
|
|
20
|
+
}
|
|
21
|
+
catch { }
|
|
22
|
+
}
|
|
23
|
+
if (typeof data === "bigint") {
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
return error.SymbolDataParserErrorIssue;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.bigint = bigint;
|
|
31
|
+
exports.dataParserBigIntKind = dataParserBigIntKind;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type NeverCoalescing, type Kind } from "../../../common";
|
|
2
|
+
import { type DataParserDefinition, type DataParser } from "../../base";
|
|
3
|
+
import { type AddCheckersToDefinition, type MergeDefinition } from "../../../dataParser/types";
|
|
4
|
+
import { type DataParserCheckerBigIntMin, type DataParserCheckerBigIntMax } from "./checkers";
|
|
5
|
+
export * from "./checkers";
|
|
6
|
+
export type DataParserBigIntCheckers = (DataParserCheckerBigIntMin | DataParserCheckerBigIntMax);
|
|
7
|
+
export interface DataParserDefinitionBigInt extends DataParserDefinition<DataParserBigIntCheckers> {
|
|
8
|
+
readonly coerce: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const dataParserBigIntKind: import("../../../common").KindHandler<import("../../../common").KindDefinition<"data-parser-bigint", unknown>>;
|
|
11
|
+
type _DataParserBigInt<GenericDefinition extends DataParserDefinitionBigInt> = (DataParser<GenericDefinition, bigint, bigint> & Kind<typeof dataParserBigIntKind.definition>);
|
|
12
|
+
export interface DataParserBigInt<GenericDefinition extends DataParserDefinitionBigInt = DataParserDefinitionBigInt> extends _DataParserBigInt<GenericDefinition> {
|
|
13
|
+
addChecker<GenericChecker extends readonly [
|
|
14
|
+
DataParserBigIntCheckers,
|
|
15
|
+
...DataParserBigIntCheckers[]
|
|
16
|
+
]>(...args: GenericChecker): DataParserBigInt<AddCheckersToDefinition<GenericDefinition, GenericChecker>>;
|
|
17
|
+
}
|
|
18
|
+
export declare function bigint<const GenericDefinition extends Partial<DataParserDefinitionBigInt> = never>(definition?: GenericDefinition): DataParserBigInt<MergeDefinition<DataParserDefinitionBigInt, NeverCoalescing<GenericDefinition, {}>>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createKind } from '../../../common/kind.mjs';
|
|
2
|
+
import { dataParserInit } from '../../base.mjs';
|
|
3
|
+
import { SymbolDataParserErrorIssue } from '../../error.mjs';
|
|
4
|
+
|
|
5
|
+
const dataParserBigIntKind = createKind("data-parser-bigint");
|
|
6
|
+
function bigint(definition) {
|
|
7
|
+
return dataParserInit(dataParserBigIntKind, {
|
|
8
|
+
definition: {
|
|
9
|
+
errorMessage: definition?.errorMessage,
|
|
10
|
+
checkers: definition?.checkers ?? [],
|
|
11
|
+
coerce: definition?.coerce ?? false,
|
|
12
|
+
},
|
|
13
|
+
}, (data, _error, self) => {
|
|
14
|
+
if (self.definition.coerce) {
|
|
15
|
+
try {
|
|
16
|
+
// eslint-disable-next-line no-param-reassign
|
|
17
|
+
data = BigInt(data);
|
|
18
|
+
}
|
|
19
|
+
catch { }
|
|
20
|
+
}
|
|
21
|
+
if (typeof data === "bigint") {
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
return SymbolDataParserErrorIssue;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { bigint, dataParserBigIntKind };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kind = require('../../common/kind.cjs');
|
|
4
|
+
var base = require('../base.cjs');
|
|
5
|
+
var error = require('../error.cjs');
|
|
6
|
+
|
|
7
|
+
const dataParserBooleanKind = kind.createKind("data-parser-boolean");
|
|
8
|
+
function boolean(definition) {
|
|
9
|
+
return base.dataParserInit(dataParserBooleanKind, {
|
|
10
|
+
definition: {
|
|
11
|
+
errorMessage: definition?.errorMessage,
|
|
12
|
+
checkers: definition?.checkers ?? [],
|
|
13
|
+
coerce: definition?.coerce ?? false,
|
|
14
|
+
},
|
|
15
|
+
}, (data, _error, self) => {
|
|
16
|
+
if (typeof data === "boolean") {
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
else if (self.definition.coerce) {
|
|
20
|
+
if (typeof data === "string") {
|
|
21
|
+
const lower = data.trim().toLowerCase();
|
|
22
|
+
if (lower === "true" || lower === "false") {
|
|
23
|
+
return lower === "true";
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return error.SymbolDataParserErrorIssue;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else if (typeof data === "number"
|
|
30
|
+
&& (data === 0
|
|
31
|
+
|| data === 1)) {
|
|
32
|
+
return data === 1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return error.SymbolDataParserErrorIssue;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.boolean = boolean;
|
|
40
|
+
exports.dataParserBooleanKind = dataParserBooleanKind;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type NeverCoalescing, type Kind } from "../../common";
|
|
2
|
+
import { type DataParserDefinition, type DataParser } from "../base";
|
|
3
|
+
import { type MergeDefinition } from "../../dataParser/types";
|
|
4
|
+
export interface DataParserDefinitionBoolean extends DataParserDefinition<never> {
|
|
5
|
+
readonly coerce: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const dataParserBooleanKind: import("../../common").KindHandler<import("../../common").KindDefinition<"data-parser-boolean", unknown>>;
|
|
8
|
+
type _DataParserBoolean<GenericDefinition extends DataParserDefinitionBoolean> = (DataParser<GenericDefinition, boolean, boolean> & Kind<typeof dataParserBooleanKind.definition>);
|
|
9
|
+
export interface DataParserBoolean<GenericDefinition extends DataParserDefinitionBoolean = DataParserDefinitionBoolean> extends _DataParserBoolean<GenericDefinition> {
|
|
10
|
+
}
|
|
11
|
+
export declare function boolean<const GenericDefinition extends Partial<DataParserDefinitionBoolean> = never>(definition?: GenericDefinition): DataParserBoolean<MergeDefinition<DataParserDefinitionBoolean, NeverCoalescing<GenericDefinition, {}>>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createKind } from '../../common/kind.mjs';
|
|
2
|
+
import { dataParserInit } from '../base.mjs';
|
|
3
|
+
import { SymbolDataParserErrorIssue } from '../error.mjs';
|
|
4
|
+
|
|
5
|
+
const dataParserBooleanKind = createKind("data-parser-boolean");
|
|
6
|
+
function boolean(definition) {
|
|
7
|
+
return dataParserInit(dataParserBooleanKind, {
|
|
8
|
+
definition: {
|
|
9
|
+
errorMessage: definition?.errorMessage,
|
|
10
|
+
checkers: definition?.checkers ?? [],
|
|
11
|
+
coerce: definition?.coerce ?? false,
|
|
12
|
+
},
|
|
13
|
+
}, (data, _error, self) => {
|
|
14
|
+
if (typeof data === "boolean") {
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
else if (self.definition.coerce) {
|
|
18
|
+
if (typeof data === "string") {
|
|
19
|
+
const lower = data.trim().toLowerCase();
|
|
20
|
+
if (lower === "true" || lower === "false") {
|
|
21
|
+
return lower === "true";
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return SymbolDataParserErrorIssue;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else if (typeof data === "number"
|
|
28
|
+
&& (data === 0
|
|
29
|
+
|| data === 1)) {
|
|
30
|
+
return data === 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return SymbolDataParserErrorIssue;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { boolean, dataParserBooleanKind };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type NeverCoalescing } from "../../../common";
|
|
2
|
+
import { type MergeDefinition } from "../../types";
|
|
3
|
+
import * as dataParsers from "..";
|
|
4
|
+
export declare function bigint<const GenericDefinition extends Partial<Omit<dataParsers.DataParserDefinitionBigInt, "coerce">> = never>(definition?: GenericDefinition): dataParsers.DataParserBigInt<MergeDefinition<dataParsers.DataParserDefinitionBigInt, NeverCoalescing<GenericDefinition, {}> & {
|
|
5
|
+
coerce: true;
|
|
6
|
+
}>>;
|