@depup/sinclair__typebox 0.34.48-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/build/cjs/compiler/compiler.d.ts +55 -0
- package/build/cjs/compiler/compiler.js +670 -0
- package/build/cjs/compiler/index.d.ts +2 -0
- package/build/cjs/compiler/index.js +22 -0
- package/build/cjs/errors/errors.d.ts +91 -0
- package/build/cjs/errors/errors.js +599 -0
- package/build/cjs/errors/function.d.ts +21 -0
- package/build/cjs/errors/function.js +153 -0
- package/build/cjs/errors/index.d.ts +2 -0
- package/build/cjs/errors/index.js +19 -0
- package/build/cjs/index.d.ts +71 -0
- package/build/cjs/index.js +97 -0
- package/build/cjs/parser/index.d.ts +2 -0
- package/build/cjs/parser/index.js +39 -0
- package/build/cjs/parser/runtime/guard.d.ts +23 -0
- package/build/cjs/parser/runtime/guard.js +86 -0
- package/build/cjs/parser/runtime/index.d.ts +5 -0
- package/build/cjs/parser/runtime/index.js +45 -0
- package/build/cjs/parser/runtime/module.d.ts +9 -0
- package/build/cjs/parser/runtime/module.js +22 -0
- package/build/cjs/parser/runtime/parse.d.ts +9 -0
- package/build/cjs/parser/runtime/parse.js +160 -0
- package/build/cjs/parser/runtime/token.d.ts +8 -0
- package/build/cjs/parser/runtime/token.js +230 -0
- package/build/cjs/parser/runtime/types.d.ts +98 -0
- package/build/cjs/parser/runtime/types.js +71 -0
- package/build/cjs/parser/static/index.d.ts +3 -0
- package/build/cjs/parser/static/index.js +43 -0
- package/build/cjs/parser/static/parse.d.ts +20 -0
- package/build/cjs/parser/static/parse.js +3 -0
- package/build/cjs/parser/static/token.d.ts +108 -0
- package/build/cjs/parser/static/token.js +3 -0
- package/build/cjs/parser/static/types.d.ts +69 -0
- package/build/cjs/parser/static/types.js +3 -0
- package/build/cjs/syntax/index.d.ts +1 -0
- package/build/cjs/syntax/index.js +18 -0
- package/build/cjs/syntax/mapping.d.ts +167 -0
- package/build/cjs/syntax/mapping.js +491 -0
- package/build/cjs/syntax/parser.d.ts +162 -0
- package/build/cjs/syntax/parser.js +191 -0
- package/build/cjs/syntax/syntax.d.ts +12 -0
- package/build/cjs/syntax/syntax.js +54 -0
- package/build/cjs/system/index.d.ts +2 -0
- package/build/cjs/system/index.js +19 -0
- package/build/cjs/system/policy.d.ts +29 -0
- package/build/cjs/system/policy.js +58 -0
- package/build/cjs/system/system.d.ts +16 -0
- package/build/cjs/system/system.js +43 -0
- package/build/cjs/type/any/any.d.ts +8 -0
- package/build/cjs/type/any/any.js +10 -0
- package/build/cjs/type/any/index.d.ts +1 -0
- package/build/cjs/type/any/index.js +18 -0
- package/build/cjs/type/argument/argument.d.ts +9 -0
- package/build/cjs/type/argument/argument.js +10 -0
- package/build/cjs/type/argument/index.d.ts +1 -0
- package/build/cjs/type/argument/index.js +18 -0
- package/build/cjs/type/array/array.d.ts +28 -0
- package/build/cjs/type/array/array.js +10 -0
- package/build/cjs/type/array/index.d.ts +1 -0
- package/build/cjs/type/array/index.js +18 -0
- package/build/cjs/type/async-iterator/async-iterator.d.ts +11 -0
- package/build/cjs/type/async-iterator/async-iterator.js +10 -0
- package/build/cjs/type/async-iterator/index.d.ts +1 -0
- package/build/cjs/type/async-iterator/index.js +18 -0
- package/build/cjs/type/awaited/awaited.d.ts +14 -0
- package/build/cjs/type/awaited/awaited.js +41 -0
- package/build/cjs/type/awaited/index.d.ts +1 -0
- package/build/cjs/type/awaited/index.js +18 -0
- package/build/cjs/type/bigint/bigint.d.ts +16 -0
- package/build/cjs/type/bigint/bigint.js +10 -0
- package/build/cjs/type/bigint/index.d.ts +1 -0
- package/build/cjs/type/bigint/index.js +18 -0
- package/build/cjs/type/boolean/boolean.d.ts +9 -0
- package/build/cjs/type/boolean/boolean.js +10 -0
- package/build/cjs/type/boolean/index.d.ts +1 -0
- package/build/cjs/type/boolean/index.js +18 -0
- package/build/cjs/type/clone/index.d.ts +2 -0
- package/build/cjs/type/clone/index.js +19 -0
- package/build/cjs/type/clone/type.d.ts +5 -0
- package/build/cjs/type/clone/type.js +14 -0
- package/build/cjs/type/clone/value.d.ts +2 -0
- package/build/cjs/type/clone/value.js +73 -0
- package/build/cjs/type/composite/composite.d.ts +18 -0
- package/build/cjs/type/composite/composite.js +46 -0
- package/build/cjs/type/composite/index.d.ts +1 -0
- package/build/cjs/type/composite/index.js +18 -0
- package/build/cjs/type/computed/computed.d.ts +9 -0
- package/build/cjs/type/computed/computed.js +10 -0
- package/build/cjs/type/computed/index.d.ts +1 -0
- package/build/cjs/type/computed/index.js +18 -0
- package/build/cjs/type/const/const.d.ts +27 -0
- package/build/cjs/type/const/const.js +58 -0
- package/build/cjs/type/const/index.d.ts +1 -0
- package/build/cjs/type/const/index.js +18 -0
- package/build/cjs/type/constructor/constructor.d.ts +23 -0
- package/build/cjs/type/constructor/constructor.js +10 -0
- package/build/cjs/type/constructor/index.d.ts +1 -0
- package/build/cjs/type/constructor/index.js +18 -0
- package/build/cjs/type/constructor-parameters/constructor-parameters.d.ts +7 -0
- package/build/cjs/type/constructor-parameters/constructor-parameters.js +44 -0
- package/build/cjs/type/constructor-parameters/index.d.ts +1 -0
- package/build/cjs/type/constructor-parameters/index.js +18 -0
- package/build/cjs/type/create/immutable.d.ts +2 -0
- package/build/cjs/type/create/immutable.js +70 -0
- package/build/cjs/type/create/index.d.ts +1 -0
- package/build/cjs/type/create/index.js +18 -0
- package/build/cjs/type/create/type.d.ts +3 -0
- package/build/cjs/type/create/type.js +19 -0
- package/build/cjs/type/date/date.d.ts +21 -0
- package/build/cjs/type/date/date.js +10 -0
- package/build/cjs/type/date/index.d.ts +1 -0
- package/build/cjs/type/date/index.js +18 -0
- package/build/cjs/type/discard/discard.d.ts +2 -0
- package/build/cjs/type/discard/discard.js +12 -0
- package/build/cjs/type/discard/index.d.ts +1 -0
- package/build/cjs/type/discard/index.js +18 -0
- package/build/cjs/type/enum/enum.d.ts +14 -0
- package/build/cjs/type/enum/enum.js +22 -0
- package/build/cjs/type/enum/index.d.ts +1 -0
- package/build/cjs/type/enum/index.js +18 -0
- package/build/cjs/type/error/error.d.ts +4 -0
- package/build/cjs/type/error/error.js +11 -0
- package/build/cjs/type/error/index.d.ts +1 -0
- package/build/cjs/type/error/index.js +18 -0
- package/build/cjs/type/exclude/exclude-from-mapped-result.d.ts +11 -0
- package/build/cjs/type/exclude/exclude-from-mapped-result.js +22 -0
- package/build/cjs/type/exclude/exclude-from-template-literal.d.ts +5 -0
- package/build/cjs/type/exclude/exclude-from-template-literal.js +9 -0
- package/build/cjs/type/exclude/exclude.d.ts +21 -0
- package/build/cjs/type/exclude/exclude.js +29 -0
- package/build/cjs/type/exclude/index.d.ts +3 -0
- package/build/cjs/type/exclude/index.js +20 -0
- package/build/cjs/type/extends/extends-check.d.ts +10 -0
- package/build/cjs/type/extends/extends-check.js +641 -0
- package/build/cjs/type/extends/extends-from-mapped-key.d.ts +14 -0
- package/build/cjs/type/extends/extends-from-mapped-key.js +29 -0
- package/build/cjs/type/extends/extends-from-mapped-result.d.ts +11 -0
- package/build/cjs/type/extends/extends-from-mapped-result.js +23 -0
- package/build/cjs/type/extends/extends-undefined.d.ts +3 -0
- package/build/cjs/type/extends/extends-undefined.js +24 -0
- package/build/cjs/type/extends/extends.d.ts +16 -0
- package/build/cjs/type/extends/extends.js +27 -0
- package/build/cjs/type/extends/index.d.ts +5 -0
- package/build/cjs/type/extends/index.js +22 -0
- package/build/cjs/type/extract/extract-from-mapped-result.d.ts +11 -0
- package/build/cjs/type/extract/extract-from-mapped-result.js +22 -0
- package/build/cjs/type/extract/extract-from-template-literal.d.ts +5 -0
- package/build/cjs/type/extract/extract-from-template-literal.js +9 -0
- package/build/cjs/type/extract/extract.d.ts +21 -0
- package/build/cjs/type/extract/extract.js +29 -0
- package/build/cjs/type/extract/index.d.ts +3 -0
- package/build/cjs/type/extract/index.js +20 -0
- package/build/cjs/type/function/function.d.ts +23 -0
- package/build/cjs/type/function/function.js +10 -0
- package/build/cjs/type/function/index.d.ts +1 -0
- package/build/cjs/type/function/index.js +18 -0
- package/build/cjs/type/guard/index.d.ts +3 -0
- package/build/cjs/type/guard/index.js +40 -0
- package/build/cjs/type/guard/kind.d.ts +147 -0
- package/build/cjs/type/guard/kind.js +320 -0
- package/build/cjs/type/guard/type.d.ts +152 -0
- package/build/cjs/type/guard/type.js +597 -0
- package/build/cjs/type/guard/value.d.ts +34 -0
- package/build/cjs/type/guard/value.js +89 -0
- package/build/cjs/type/helpers/helpers.d.ts +42 -0
- package/build/cjs/type/helpers/helpers.js +8 -0
- package/build/cjs/type/helpers/index.d.ts +1 -0
- package/build/cjs/type/helpers/index.js +18 -0
- package/build/cjs/type/index.d.ts +71 -0
- package/build/cjs/type/index.js +88 -0
- package/build/cjs/type/indexed/index.d.ts +4 -0
- package/build/cjs/type/indexed/index.js +21 -0
- package/build/cjs/type/indexed/indexed-from-mapped-key.d.ts +13 -0
- package/build/cjs/type/indexed/indexed-from-mapped-key.js +26 -0
- package/build/cjs/type/indexed/indexed-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/indexed/indexed-from-mapped-result.js +24 -0
- package/build/cjs/type/indexed/indexed-property-keys.d.ts +14 -0
- package/build/cjs/type/indexed/indexed-property-keys.js +36 -0
- package/build/cjs/type/indexed/indexed.d.ts +52 -0
- package/build/cjs/type/indexed/indexed.js +98 -0
- package/build/cjs/type/instance-type/index.d.ts +1 -0
- package/build/cjs/type/instance-type/index.js +18 -0
- package/build/cjs/type/instance-type/instance-type.d.ts +6 -0
- package/build/cjs/type/instance-type/instance-type.js +44 -0
- package/build/cjs/type/instantiate/index.d.ts +1 -0
- package/build/cjs/type/instantiate/index.js +18 -0
- package/build/cjs/type/instantiate/instantiate.d.ts +50 -0
- package/build/cjs/type/instantiate/instantiate.js +153 -0
- package/build/cjs/type/integer/index.d.ts +1 -0
- package/build/cjs/type/integer/index.js +18 -0
- package/build/cjs/type/integer/integer.d.ts +16 -0
- package/build/cjs/type/integer/integer.js +10 -0
- package/build/cjs/type/intersect/index.d.ts +3 -0
- package/build/cjs/type/intersect/index.js +20 -0
- package/build/cjs/type/intersect/intersect-create.d.ts +3 -0
- package/build/cjs/type/intersect/intersect-create.js +23 -0
- package/build/cjs/type/intersect/intersect-evaluated.d.ts +13 -0
- package/build/cjs/type/intersect/intersect-evaluated.js +42 -0
- package/build/cjs/type/intersect/intersect-type.d.ts +15 -0
- package/build/cjs/type/intersect/intersect-type.js +4 -0
- package/build/cjs/type/intersect/intersect.d.ts +6 -0
- package/build/cjs/type/intersect/intersect.js +21 -0
- package/build/cjs/type/intrinsic/capitalize.d.ts +5 -0
- package/build/cjs/type/intrinsic/capitalize.js +9 -0
- package/build/cjs/type/intrinsic/index.d.ts +6 -0
- package/build/cjs/type/intrinsic/index.js +23 -0
- package/build/cjs/type/intrinsic/intrinsic-from-mapped-key.d.ts +14 -0
- package/build/cjs/type/intrinsic/intrinsic-from-mapped-key.js +30 -0
- package/build/cjs/type/intrinsic/intrinsic.d.ts +16 -0
- package/build/cjs/type/intrinsic/intrinsic.js +68 -0
- package/build/cjs/type/intrinsic/lowercase.d.ts +5 -0
- package/build/cjs/type/intrinsic/lowercase.js +9 -0
- package/build/cjs/type/intrinsic/uncapitalize.d.ts +5 -0
- package/build/cjs/type/intrinsic/uncapitalize.js +9 -0
- package/build/cjs/type/intrinsic/uppercase.d.ts +5 -0
- package/build/cjs/type/intrinsic/uppercase.js +9 -0
- package/build/cjs/type/iterator/index.d.ts +1 -0
- package/build/cjs/type/iterator/index.js +18 -0
- package/build/cjs/type/iterator/iterator.d.ts +11 -0
- package/build/cjs/type/iterator/iterator.js +10 -0
- package/build/cjs/type/keyof/index.d.ts +4 -0
- package/build/cjs/type/keyof/index.js +21 -0
- package/build/cjs/type/keyof/keyof-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/keyof/keyof-from-mapped-result.js +23 -0
- package/build/cjs/type/keyof/keyof-property-entries.d.ts +7 -0
- package/build/cjs/type/keyof/keyof-property-entries.js +16 -0
- package/build/cjs/type/keyof/keyof-property-keys.d.ts +24 -0
- package/build/cjs/type/keyof/keyof-property-keys.js +78 -0
- package/build/cjs/type/keyof/keyof.d.ts +21 -0
- package/build/cjs/type/keyof/keyof.js +40 -0
- package/build/cjs/type/literal/index.d.ts +1 -0
- package/build/cjs/type/literal/index.js +18 -0
- package/build/cjs/type/literal/literal.d.ts +10 -0
- package/build/cjs/type/literal/literal.js +14 -0
- package/build/cjs/type/mapped/index.d.ts +3 -0
- package/build/cjs/type/mapped/index.js +20 -0
- package/build/cjs/type/mapped/mapped-key.d.ts +8 -0
- package/build/cjs/type/mapped/mapped-key.js +13 -0
- package/build/cjs/type/mapped/mapped-result.d.ts +9 -0
- package/build/cjs/type/mapped/mapped-result.js +13 -0
- package/build/cjs/type/mapped/mapped.d.ts +47 -0
- package/build/cjs/type/mapped/mapped.js +107 -0
- package/build/cjs/type/module/compute.d.ts +59 -0
- package/build/cjs/type/module/compute.js +205 -0
- package/build/cjs/type/module/index.d.ts +1 -0
- package/build/cjs/type/module/index.js +18 -0
- package/build/cjs/type/module/infer.d.ts +49 -0
- package/build/cjs/type/module/infer.js +3 -0
- package/build/cjs/type/module/module.d.ts +27 -0
- package/build/cjs/type/module/module.js +38 -0
- package/build/cjs/type/never/index.d.ts +1 -0
- package/build/cjs/type/never/index.js +18 -0
- package/build/cjs/type/never/never.d.ts +9 -0
- package/build/cjs/type/never/never.js +10 -0
- package/build/cjs/type/not/index.d.ts +1 -0
- package/build/cjs/type/not/index.js +18 -0
- package/build/cjs/type/not/not.d.ts +10 -0
- package/build/cjs/type/not/not.js +10 -0
- package/build/cjs/type/null/index.d.ts +1 -0
- package/build/cjs/type/null/index.js +18 -0
- package/build/cjs/type/null/null.d.ts +9 -0
- package/build/cjs/type/null/null.js +10 -0
- package/build/cjs/type/number/index.d.ts +1 -0
- package/build/cjs/type/number/index.js +18 -0
- package/build/cjs/type/number/number.d.ts +16 -0
- package/build/cjs/type/number/number.js +10 -0
- package/build/cjs/type/object/index.d.ts +1 -0
- package/build/cjs/type/object/index.js +18 -0
- package/build/cjs/type/object/object.d.ts +51 -0
- package/build/cjs/type/object/object.js +22 -0
- package/build/cjs/type/omit/index.d.ts +3 -0
- package/build/cjs/type/omit/index.js +20 -0
- package/build/cjs/type/omit/omit-from-mapped-key.d.ts +12 -0
- package/build/cjs/type/omit/omit-from-mapped-key.js +26 -0
- package/build/cjs/type/omit/omit-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/omit/omit-from-mapped-result.js +23 -0
- package/build/cjs/type/omit/omit.d.ts +36 -0
- package/build/cjs/type/omit/omit.js +75 -0
- package/build/cjs/type/optional/index.d.ts +2 -0
- package/build/cjs/type/optional/index.js +19 -0
- package/build/cjs/type/optional/optional-from-mapped-result.d.ts +10 -0
- package/build/cjs/type/optional/optional-from-mapped-result.js +22 -0
- package/build/cjs/type/optional/optional.d.ts +20 -0
- package/build/cjs/type/optional/optional.js +26 -0
- package/build/cjs/type/parameters/index.d.ts +1 -0
- package/build/cjs/type/parameters/index.js +18 -0
- package/build/cjs/type/parameters/parameters.d.ts +7 -0
- package/build/cjs/type/parameters/parameters.js +44 -0
- package/build/cjs/type/partial/index.d.ts +2 -0
- package/build/cjs/type/partial/index.js +19 -0
- package/build/cjs/type/partial/partial-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/partial/partial-from-mapped-result.js +23 -0
- package/build/cjs/type/partial/partial.d.ts +35 -0
- package/build/cjs/type/partial/partial.js +111 -0
- package/build/cjs/type/patterns/index.d.ts +1 -0
- package/build/cjs/type/patterns/index.js +18 -0
- package/build/cjs/type/patterns/patterns.d.ts +8 -0
- package/build/cjs/type/patterns/patterns.js +12 -0
- package/build/cjs/type/pick/index.d.ts +3 -0
- package/build/cjs/type/pick/index.js +20 -0
- package/build/cjs/type/pick/pick-from-mapped-key.d.ts +12 -0
- package/build/cjs/type/pick/pick-from-mapped-key.js +28 -0
- package/build/cjs/type/pick/pick-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/pick/pick-from-mapped-result.js +23 -0
- package/build/cjs/type/pick/pick.d.ts +36 -0
- package/build/cjs/type/pick/pick.js +70 -0
- package/build/cjs/type/promise/index.d.ts +1 -0
- package/build/cjs/type/promise/index.js +18 -0
- package/build/cjs/type/promise/promise.d.ts +11 -0
- package/build/cjs/type/promise/promise.js +10 -0
- package/build/cjs/type/readonly/index.d.ts +2 -0
- package/build/cjs/type/readonly/index.js +19 -0
- package/build/cjs/type/readonly/readonly-from-mapped-result.d.ts +10 -0
- package/build/cjs/type/readonly/readonly-from-mapped-result.js +22 -0
- package/build/cjs/type/readonly/readonly.d.ts +20 -0
- package/build/cjs/type/readonly/readonly.js +26 -0
- package/build/cjs/type/readonly-optional/index.d.ts +1 -0
- package/build/cjs/type/readonly-optional/index.js +18 -0
- package/build/cjs/type/readonly-optional/readonly-optional.d.ts +6 -0
- package/build/cjs/type/readonly-optional/readonly-optional.js +10 -0
- package/build/cjs/type/record/index.d.ts +1 -0
- package/build/cjs/type/record/index.js +18 -0
- package/build/cjs/type/record/record.d.ts +71 -0
- package/build/cjs/type/record/record.js +123 -0
- package/build/cjs/type/recursive/index.d.ts +1 -0
- package/build/cjs/type/recursive/index.js +18 -0
- package/build/cjs/type/recursive/recursive.d.ts +16 -0
- package/build/cjs/type/recursive/recursive.js +19 -0
- package/build/cjs/type/ref/index.d.ts +1 -0
- package/build/cjs/type/ref/index.js +18 -0
- package/build/cjs/type/ref/ref.d.ts +41 -0
- package/build/cjs/type/ref/ref.js +14 -0
- package/build/cjs/type/regexp/index.d.ts +1 -0
- package/build/cjs/type/regexp/index.js +18 -0
- package/build/cjs/type/regexp/regexp.d.ts +20 -0
- package/build/cjs/type/regexp/regexp.js +12 -0
- package/build/cjs/type/registry/format.d.ts +13 -0
- package/build/cjs/type/registry/format.js +35 -0
- package/build/cjs/type/registry/index.d.ts +2 -0
- package/build/cjs/type/registry/index.js +39 -0
- package/build/cjs/type/registry/type.d.ts +13 -0
- package/build/cjs/type/registry/type.js +35 -0
- package/build/cjs/type/required/index.d.ts +2 -0
- package/build/cjs/type/required/index.js +19 -0
- package/build/cjs/type/required/required-from-mapped-result.d.ts +12 -0
- package/build/cjs/type/required/required-from-mapped-result.js +22 -0
- package/build/cjs/type/required/required.d.ts +35 -0
- package/build/cjs/type/required/required.js +110 -0
- package/build/cjs/type/rest/index.d.ts +1 -0
- package/build/cjs/type/rest/index.js +18 -0
- package/build/cjs/type/rest/rest.d.ts +10 -0
- package/build/cjs/type/rest/rest.js +19 -0
- package/build/cjs/type/return-type/index.d.ts +1 -0
- package/build/cjs/type/return-type/index.js +18 -0
- package/build/cjs/type/return-type/return-type.d.ts +6 -0
- package/build/cjs/type/return-type/return-type.js +44 -0
- package/build/cjs/type/schema/anyschema.d.ts +33 -0
- package/build/cjs/type/schema/anyschema.js +3 -0
- package/build/cjs/type/schema/index.d.ts +2 -0
- package/build/cjs/type/schema/index.js +19 -0
- package/build/cjs/type/schema/schema.d.ts +29 -0
- package/build/cjs/type/schema/schema.js +4 -0
- package/build/cjs/type/sets/index.d.ts +1 -0
- package/build/cjs/type/sets/index.js +18 -0
- package/build/cjs/type/sets/set.d.ts +28 -0
- package/build/cjs/type/sets/set.js +59 -0
- package/build/cjs/type/static/index.d.ts +1 -0
- package/build/cjs/type/static/index.js +18 -0
- package/build/cjs/type/static/static.d.ts +39 -0
- package/build/cjs/type/static/static.js +3 -0
- package/build/cjs/type/string/index.d.ts +1 -0
- package/build/cjs/type/string/index.js +18 -0
- package/build/cjs/type/string/string.d.ts +25 -0
- package/build/cjs/type/string/string.js +10 -0
- package/build/cjs/type/symbol/index.d.ts +1 -0
- package/build/cjs/type/symbol/index.js +18 -0
- package/build/cjs/type/symbol/symbol.d.ts +10 -0
- package/build/cjs/type/symbol/symbol.js +10 -0
- package/build/cjs/type/symbols/index.d.ts +1 -0
- package/build/cjs/type/symbols/index.js +18 -0
- package/build/cjs/type/symbols/symbols.d.ts +10 -0
- package/build/cjs/type/symbols/symbols.js +14 -0
- package/build/cjs/type/template-literal/finite.d.ts +19 -0
- package/build/cjs/type/template-literal/finite.js +56 -0
- package/build/cjs/type/template-literal/generate.d.ts +21 -0
- package/build/cjs/type/template-literal/generate.js +60 -0
- package/build/cjs/type/template-literal/index.d.ts +7 -0
- package/build/cjs/type/template-literal/index.js +24 -0
- package/build/cjs/type/template-literal/parse.d.ts +20 -0
- package/build/cjs/type/template-literal/parse.js +174 -0
- package/build/cjs/type/template-literal/pattern.d.ts +5 -0
- package/build/cjs/type/template-literal/pattern.js +39 -0
- package/build/cjs/type/template-literal/syntax.d.ts +20 -0
- package/build/cjs/type/template-literal/syntax.js +59 -0
- package/build/cjs/type/template-literal/template-literal.d.ts +30 -0
- package/build/cjs/type/template-literal/template-literal.js +17 -0
- package/build/cjs/type/template-literal/union.d.ts +9 -0
- package/build/cjs/type/template-literal/union.js +13 -0
- package/build/cjs/type/transform/index.d.ts +1 -0
- package/build/cjs/type/transform/index.js +18 -0
- package/build/cjs/type/transform/transform.d.ts +30 -0
- package/build/cjs/type/transform/transform.js +47 -0
- package/build/cjs/type/tuple/index.d.ts +1 -0
- package/build/cjs/type/tuple/index.js +18 -0
- package/build/cjs/type/tuple/tuple.d.ts +16 -0
- package/build/cjs/type/tuple/tuple.js +13 -0
- package/build/cjs/type/type/index.d.ts +6 -0
- package/build/cjs/type/type/index.js +51 -0
- package/build/cjs/type/type/javascript.d.ts +64 -0
- package/build/cjs/type/type/javascript.js +104 -0
- package/build/cjs/type/type/json.d.ts +208 -0
- package/build/cjs/type/type/json.js +226 -0
- package/build/cjs/type/type/type.d.ts +59 -0
- package/build/cjs/type/type/type.js +129 -0
- package/build/cjs/type/uint8array/index.d.ts +1 -0
- package/build/cjs/type/uint8array/index.js +18 -0
- package/build/cjs/type/uint8array/uint8array.d.ts +13 -0
- package/build/cjs/type/uint8array/uint8array.js +10 -0
- package/build/cjs/type/undefined/index.d.ts +1 -0
- package/build/cjs/type/undefined/index.js +18 -0
- package/build/cjs/type/undefined/undefined.d.ts +9 -0
- package/build/cjs/type/undefined/undefined.js +10 -0
- package/build/cjs/type/union/index.d.ts +3 -0
- package/build/cjs/type/union/index.js +20 -0
- package/build/cjs/type/union/union-create.d.ts +3 -0
- package/build/cjs/type/union/union-create.js +9 -0
- package/build/cjs/type/union/union-evaluated.d.ts +13 -0
- package/build/cjs/type/union/union-evaluated.js +40 -0
- package/build/cjs/type/union/union-type.d.ts +12 -0
- package/build/cjs/type/union/union-type.js +4 -0
- package/build/cjs/type/union/union.d.ts +6 -0
- package/build/cjs/type/union/union.js +14 -0
- package/build/cjs/type/unknown/index.d.ts +1 -0
- package/build/cjs/type/unknown/index.js +18 -0
- package/build/cjs/type/unknown/unknown.d.ts +8 -0
- package/build/cjs/type/unknown/unknown.js +10 -0
- package/build/cjs/type/unsafe/index.d.ts +1 -0
- package/build/cjs/type/unsafe/index.js +18 -0
- package/build/cjs/type/unsafe/unsafe.d.ts +11 -0
- package/build/cjs/type/unsafe/unsafe.js +10 -0
- package/build/cjs/type/void/index.d.ts +1 -0
- package/build/cjs/type/void/index.js +18 -0
- package/build/cjs/type/void/void.d.ts +9 -0
- package/build/cjs/type/void/void.js +10 -0
- package/build/cjs/value/assert/assert.d.ts +15 -0
- package/build/cjs/value/assert/assert.js +55 -0
- package/build/cjs/value/assert/index.d.ts +1 -0
- package/build/cjs/value/assert/index.js +18 -0
- package/build/cjs/value/cast/cast.d.ts +11 -0
- package/build/cjs/value/cast/cast.js +241 -0
- package/build/cjs/value/cast/index.d.ts +1 -0
- package/build/cjs/value/cast/index.js +18 -0
- package/build/cjs/value/check/check.d.ts +11 -0
- package/build/cjs/value/check/check.js +476 -0
- package/build/cjs/value/check/index.d.ts +1 -0
- package/build/cjs/value/check/index.js +18 -0
- package/build/cjs/value/clean/clean.d.ts +5 -0
- package/build/cjs/value/clean/clean.js +149 -0
- package/build/cjs/value/clean/index.d.ts +1 -0
- package/build/cjs/value/clean/index.js +18 -0
- package/build/cjs/value/clone/clone.d.ts +2 -0
- package/build/cjs/value/clone/clone.js +60 -0
- package/build/cjs/value/clone/index.d.ts +1 -0
- package/build/cjs/value/clone/index.js +18 -0
- package/build/cjs/value/convert/convert.d.ts +5 -0
- package/build/cjs/value/convert/convert.js +264 -0
- package/build/cjs/value/convert/index.d.ts +1 -0
- package/build/cjs/value/convert/index.js +18 -0
- package/build/cjs/value/create/create.d.ts +11 -0
- package/build/cjs/value/create/create.js +474 -0
- package/build/cjs/value/create/index.d.ts +1 -0
- package/build/cjs/value/create/index.js +18 -0
- package/build/cjs/value/decode/decode.d.ts +6 -0
- package/build/cjs/value/decode/decode.js +14 -0
- package/build/cjs/value/decode/index.d.ts +1 -0
- package/build/cjs/value/decode/index.js +18 -0
- package/build/cjs/value/default/default.d.ts +5 -0
- package/build/cjs/value/default/default.js +176 -0
- package/build/cjs/value/default/index.d.ts +1 -0
- package/build/cjs/value/default/index.js +18 -0
- package/build/cjs/value/delta/delta.d.ts +32 -0
- package/build/cjs/value/delta/delta.js +178 -0
- package/build/cjs/value/delta/index.d.ts +1 -0
- package/build/cjs/value/delta/index.js +18 -0
- package/build/cjs/value/deref/deref.d.ts +12 -0
- package/build/cjs/value/deref/deref.js +36 -0
- package/build/cjs/value/deref/index.d.ts +1 -0
- package/build/cjs/value/deref/index.js +18 -0
- package/build/cjs/value/encode/encode.d.ts +6 -0
- package/build/cjs/value/encode/encode.js +15 -0
- package/build/cjs/value/encode/index.d.ts +1 -0
- package/build/cjs/value/encode/index.js +18 -0
- package/build/cjs/value/equal/equal.d.ts +2 -0
- package/build/cjs/value/equal/equal.js +50 -0
- package/build/cjs/value/equal/index.d.ts +1 -0
- package/build/cjs/value/equal/index.js +18 -0
- package/build/cjs/value/guard/guard.d.ts +74 -0
- package/build/cjs/value/guard/guard.js +195 -0
- package/build/cjs/value/guard/index.d.ts +1 -0
- package/build/cjs/value/guard/index.js +18 -0
- package/build/cjs/value/hash/hash.d.ts +7 -0
- package/build/cjs/value/hash/hash.js +152 -0
- package/build/cjs/value/hash/index.d.ts +1 -0
- package/build/cjs/value/hash/index.js +18 -0
- package/build/cjs/value/index.d.ts +20 -0
- package/build/cjs/value/index.js +53 -0
- package/build/cjs/value/mutate/index.d.ts +1 -0
- package/build/cjs/value/mutate/index.js +18 -0
- package/build/cjs/value/mutate/mutate.d.ts +9 -0
- package/build/cjs/value/mutate/mutate.js +104 -0
- package/build/cjs/value/parse/index.d.ts +1 -0
- package/build/cjs/value/parse/index.js +18 -0
- package/build/cjs/value/parse/parse.d.ts +22 -0
- package/build/cjs/value/parse/parse.js +87 -0
- package/build/cjs/value/pointer/index.d.ts +1 -0
- package/build/cjs/value/pointer/index.js +38 -0
- package/build/cjs/value/pointer/pointer.d.ts +22 -0
- package/build/cjs/value/pointer/pointer.js +126 -0
- package/build/cjs/value/transform/decode.d.ts +22 -0
- package/build/cjs/value/transform/decode.js +214 -0
- package/build/cjs/value/transform/encode.d.ts +23 -0
- package/build/cjs/value/transform/encode.js +225 -0
- package/build/cjs/value/transform/has.d.ts +3 -0
- package/build/cjs/value/transform/has.js +133 -0
- package/build/cjs/value/transform/index.d.ts +3 -0
- package/build/cjs/value/transform/index.js +20 -0
- package/build/cjs/value/value/index.d.ts +1 -0
- package/build/cjs/value/value/index.js +38 -0
- package/build/cjs/value/value/value.d.ts +16 -0
- package/build/cjs/value/value/value.js +39 -0
- package/build/esm/compiler/compiler.d.mts +55 -0
- package/build/esm/compiler/compiler.mjs +663 -0
- package/build/esm/compiler/index.d.mts +2 -0
- package/build/esm/compiler/index.mjs +2 -0
- package/build/esm/errors/errors.d.mts +91 -0
- package/build/esm/errors/errors.mjs +592 -0
- package/build/esm/errors/function.d.mts +21 -0
- package/build/esm/errors/function.mjs +147 -0
- package/build/esm/errors/index.d.mts +2 -0
- package/build/esm/errors/index.mjs +2 -0
- package/build/esm/index.d.mts +71 -0
- package/build/esm/index.mjs +80 -0
- package/build/esm/parser/index.d.mts +2 -0
- package/build/esm/parser/index.mjs +2 -0
- package/build/esm/parser/runtime/guard.d.mts +23 -0
- package/build/esm/parser/runtime/guard.mjs +72 -0
- package/build/esm/parser/runtime/index.d.mts +5 -0
- package/build/esm/parser/runtime/index.mjs +5 -0
- package/build/esm/parser/runtime/module.d.mts +9 -0
- package/build/esm/parser/runtime/module.mjs +17 -0
- package/build/esm/parser/runtime/parse.d.mts +9 -0
- package/build/esm/parser/runtime/parse.mjs +123 -0
- package/build/esm/parser/runtime/token.d.mts +8 -0
- package/build/esm/parser/runtime/token.mjs +223 -0
- package/build/esm/parser/runtime/types.d.mts +98 -0
- package/build/esm/parser/runtime/types.mjs +55 -0
- package/build/esm/parser/static/index.d.mts +3 -0
- package/build/esm/parser/static/index.mjs +3 -0
- package/build/esm/parser/static/parse.d.mts +20 -0
- package/build/esm/parser/static/parse.mjs +1 -0
- package/build/esm/parser/static/token.d.mts +108 -0
- package/build/esm/parser/static/token.mjs +1 -0
- package/build/esm/parser/static/types.d.mts +69 -0
- package/build/esm/parser/static/types.mjs +1 -0
- package/build/esm/syntax/index.d.mts +1 -0
- package/build/esm/syntax/index.mjs +1 -0
- package/build/esm/syntax/mapping.d.mts +167 -0
- package/build/esm/syntax/mapping.mjs +386 -0
- package/build/esm/syntax/parser.d.mts +162 -0
- package/build/esm/syntax/parser.mjs +78 -0
- package/build/esm/syntax/syntax.d.mts +12 -0
- package/build/esm/syntax/syntax.mjs +16 -0
- package/build/esm/system/index.d.mts +2 -0
- package/build/esm/system/index.mjs +2 -0
- package/build/esm/system/policy.d.mts +29 -0
- package/build/esm/system/policy.mjs +54 -0
- package/build/esm/system/system.d.mts +16 -0
- package/build/esm/system/system.mjs +37 -0
- package/build/esm/type/any/any.d.mts +8 -0
- package/build/esm/type/any/any.mjs +6 -0
- package/build/esm/type/any/index.d.mts +1 -0
- package/build/esm/type/any/index.mjs +1 -0
- package/build/esm/type/argument/argument.d.mts +9 -0
- package/build/esm/type/argument/argument.mjs +6 -0
- package/build/esm/type/argument/index.d.mts +1 -0
- package/build/esm/type/argument/index.mjs +1 -0
- package/build/esm/type/array/array.d.mts +28 -0
- package/build/esm/type/array/array.mjs +6 -0
- package/build/esm/type/array/index.d.mts +1 -0
- package/build/esm/type/array/index.mjs +1 -0
- package/build/esm/type/async-iterator/async-iterator.d.mts +11 -0
- package/build/esm/type/async-iterator/async-iterator.mjs +6 -0
- package/build/esm/type/async-iterator/index.d.mts +1 -0
- package/build/esm/type/async-iterator/index.mjs +1 -0
- package/build/esm/type/awaited/awaited.d.mts +14 -0
- package/build/esm/type/awaited/awaited.mjs +37 -0
- package/build/esm/type/awaited/index.d.mts +1 -0
- package/build/esm/type/awaited/index.mjs +1 -0
- package/build/esm/type/bigint/bigint.d.mts +16 -0
- package/build/esm/type/bigint/bigint.mjs +6 -0
- package/build/esm/type/bigint/index.d.mts +1 -0
- package/build/esm/type/bigint/index.mjs +1 -0
- package/build/esm/type/boolean/boolean.d.mts +9 -0
- package/build/esm/type/boolean/boolean.mjs +6 -0
- package/build/esm/type/boolean/index.d.mts +1 -0
- package/build/esm/type/boolean/index.mjs +1 -0
- package/build/esm/type/clone/index.d.mts +2 -0
- package/build/esm/type/clone/index.mjs +2 -0
- package/build/esm/type/clone/type.d.mts +5 -0
- package/build/esm/type/clone/type.mjs +9 -0
- package/build/esm/type/clone/value.d.mts +2 -0
- package/build/esm/type/clone/value.mjs +36 -0
- package/build/esm/type/composite/composite.d.mts +18 -0
- package/build/esm/type/composite/composite.mjs +42 -0
- package/build/esm/type/composite/index.d.mts +1 -0
- package/build/esm/type/composite/index.mjs +1 -0
- package/build/esm/type/computed/computed.d.mts +9 -0
- package/build/esm/type/computed/computed.mjs +6 -0
- package/build/esm/type/computed/index.d.mts +1 -0
- package/build/esm/type/computed/index.mjs +1 -0
- package/build/esm/type/const/const.d.mts +27 -0
- package/build/esm/type/const/const.mjs +54 -0
- package/build/esm/type/const/index.d.mts +1 -0
- package/build/esm/type/const/index.mjs +1 -0
- package/build/esm/type/constructor/constructor.d.mts +23 -0
- package/build/esm/type/constructor/constructor.mjs +6 -0
- package/build/esm/type/constructor/index.d.mts +1 -0
- package/build/esm/type/constructor/index.mjs +1 -0
- package/build/esm/type/constructor-parameters/constructor-parameters.d.mts +7 -0
- package/build/esm/type/constructor-parameters/constructor-parameters.mjs +7 -0
- package/build/esm/type/constructor-parameters/index.d.mts +1 -0
- package/build/esm/type/constructor-parameters/index.mjs +1 -0
- package/build/esm/type/create/immutable.d.mts +2 -0
- package/build/esm/type/create/immutable.mjs +33 -0
- package/build/esm/type/create/index.d.mts +1 -0
- package/build/esm/type/create/index.mjs +1 -0
- package/build/esm/type/create/type.d.mts +3 -0
- package/build/esm/type/create/type.mjs +15 -0
- package/build/esm/type/date/date.d.mts +21 -0
- package/build/esm/type/date/date.mjs +6 -0
- package/build/esm/type/date/index.d.mts +1 -0
- package/build/esm/type/date/index.mjs +1 -0
- package/build/esm/type/discard/discard.d.mts +2 -0
- package/build/esm/type/discard/discard.mjs +8 -0
- package/build/esm/type/discard/index.d.mts +1 -0
- package/build/esm/type/discard/index.mjs +1 -0
- package/build/esm/type/enum/enum.d.mts +14 -0
- package/build/esm/type/enum/enum.mjs +18 -0
- package/build/esm/type/enum/index.d.mts +1 -0
- package/build/esm/type/enum/index.mjs +1 -0
- package/build/esm/type/error/error.d.mts +4 -0
- package/build/esm/type/error/error.mjs +6 -0
- package/build/esm/type/error/index.d.mts +1 -0
- package/build/esm/type/error/index.mjs +1 -0
- package/build/esm/type/exclude/exclude-from-mapped-result.d.mts +11 -0
- package/build/esm/type/exclude/exclude-from-mapped-result.mjs +18 -0
- package/build/esm/type/exclude/exclude-from-template-literal.d.mts +5 -0
- package/build/esm/type/exclude/exclude-from-template-literal.mjs +5 -0
- package/build/esm/type/exclude/exclude.d.mts +21 -0
- package/build/esm/type/exclude/exclude.mjs +25 -0
- package/build/esm/type/exclude/index.d.mts +3 -0
- package/build/esm/type/exclude/index.mjs +3 -0
- package/build/esm/type/extends/extends-check.d.mts +10 -0
- package/build/esm/type/extends/extends-check.mjs +635 -0
- package/build/esm/type/extends/extends-from-mapped-key.d.mts +14 -0
- package/build/esm/type/extends/extends-from-mapped-key.mjs +25 -0
- package/build/esm/type/extends/extends-from-mapped-result.d.mts +11 -0
- package/build/esm/type/extends/extends-from-mapped-result.mjs +19 -0
- package/build/esm/type/extends/extends-undefined.d.mts +3 -0
- package/build/esm/type/extends/extends-undefined.mjs +20 -0
- package/build/esm/type/extends/extends.d.mts +16 -0
- package/build/esm/type/extends/extends.mjs +23 -0
- package/build/esm/type/extends/index.d.mts +5 -0
- package/build/esm/type/extends/index.mjs +5 -0
- package/build/esm/type/extract/extract-from-mapped-result.d.mts +11 -0
- package/build/esm/type/extract/extract-from-mapped-result.mjs +18 -0
- package/build/esm/type/extract/extract-from-template-literal.d.mts +5 -0
- package/build/esm/type/extract/extract-from-template-literal.mjs +5 -0
- package/build/esm/type/extract/extract.d.mts +21 -0
- package/build/esm/type/extract/extract.mjs +25 -0
- package/build/esm/type/extract/index.d.mts +3 -0
- package/build/esm/type/extract/index.mjs +3 -0
- package/build/esm/type/function/function.d.mts +23 -0
- package/build/esm/type/function/function.mjs +6 -0
- package/build/esm/type/function/index.d.mts +1 -0
- package/build/esm/type/function/index.mjs +1 -0
- package/build/esm/type/guard/index.d.mts +3 -0
- package/build/esm/type/guard/index.mjs +3 -0
- package/build/esm/type/guard/kind.d.mts +147 -0
- package/build/esm/type/guard/kind.mjs +235 -0
- package/build/esm/type/guard/type.d.mts +152 -0
- package/build/esm/type/guard/type.mjs +509 -0
- package/build/esm/type/guard/value.d.mts +34 -0
- package/build/esm/type/guard/value.mjs +70 -0
- package/build/esm/type/helpers/helpers.d.mts +42 -0
- package/build/esm/type/helpers/helpers.mjs +4 -0
- package/build/esm/type/helpers/index.d.mts +1 -0
- package/build/esm/type/helpers/index.mjs +1 -0
- package/build/esm/type/index.d.mts +71 -0
- package/build/esm/type/index.mjs +71 -0
- package/build/esm/type/indexed/index.d.mts +4 -0
- package/build/esm/type/indexed/index.mjs +4 -0
- package/build/esm/type/indexed/indexed-from-mapped-key.d.mts +13 -0
- package/build/esm/type/indexed/indexed-from-mapped-key.mjs +22 -0
- package/build/esm/type/indexed/indexed-from-mapped-result.d.mts +12 -0
- package/build/esm/type/indexed/indexed-from-mapped-result.mjs +20 -0
- package/build/esm/type/indexed/indexed-property-keys.d.mts +14 -0
- package/build/esm/type/indexed/indexed-property-keys.mjs +32 -0
- package/build/esm/type/indexed/indexed.d.mts +52 -0
- package/build/esm/type/indexed/indexed.mjs +91 -0
- package/build/esm/type/instance-type/index.d.mts +1 -0
- package/build/esm/type/instance-type/index.mjs +1 -0
- package/build/esm/type/instance-type/instance-type.d.mts +6 -0
- package/build/esm/type/instance-type/instance-type.mjs +7 -0
- package/build/esm/type/instantiate/index.d.mts +1 -0
- package/build/esm/type/instantiate/index.mjs +1 -0
- package/build/esm/type/instantiate/instantiate.d.mts +50 -0
- package/build/esm/type/instantiate/instantiate.mjs +115 -0
- package/build/esm/type/integer/index.d.mts +1 -0
- package/build/esm/type/integer/index.mjs +1 -0
- package/build/esm/type/integer/integer.d.mts +16 -0
- package/build/esm/type/integer/integer.mjs +6 -0
- package/build/esm/type/intersect/index.d.mts +3 -0
- package/build/esm/type/intersect/index.mjs +3 -0
- package/build/esm/type/intersect/intersect-create.d.mts +3 -0
- package/build/esm/type/intersect/intersect-create.mjs +19 -0
- package/build/esm/type/intersect/intersect-evaluated.d.mts +13 -0
- package/build/esm/type/intersect/intersect-evaluated.mjs +38 -0
- package/build/esm/type/intersect/intersect-type.d.mts +15 -0
- package/build/esm/type/intersect/intersect-type.mjs +1 -0
- package/build/esm/type/intersect/intersect.d.mts +6 -0
- package/build/esm/type/intersect/intersect.mjs +17 -0
- package/build/esm/type/intrinsic/capitalize.d.mts +5 -0
- package/build/esm/type/intrinsic/capitalize.mjs +5 -0
- package/build/esm/type/intrinsic/index.d.mts +6 -0
- package/build/esm/type/intrinsic/index.mjs +6 -0
- package/build/esm/type/intrinsic/intrinsic-from-mapped-key.d.mts +14 -0
- package/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs +26 -0
- package/build/esm/type/intrinsic/intrinsic.d.mts +16 -0
- package/build/esm/type/intrinsic/intrinsic.mjs +64 -0
- package/build/esm/type/intrinsic/lowercase.d.mts +5 -0
- package/build/esm/type/intrinsic/lowercase.mjs +5 -0
- package/build/esm/type/intrinsic/uncapitalize.d.mts +5 -0
- package/build/esm/type/intrinsic/uncapitalize.mjs +5 -0
- package/build/esm/type/intrinsic/uppercase.d.mts +5 -0
- package/build/esm/type/intrinsic/uppercase.mjs +5 -0
- package/build/esm/type/iterator/index.d.mts +1 -0
- package/build/esm/type/iterator/index.mjs +1 -0
- package/build/esm/type/iterator/iterator.d.mts +11 -0
- package/build/esm/type/iterator/iterator.mjs +6 -0
- package/build/esm/type/keyof/index.d.mts +4 -0
- package/build/esm/type/keyof/index.mjs +4 -0
- package/build/esm/type/keyof/keyof-from-mapped-result.d.mts +12 -0
- package/build/esm/type/keyof/keyof-from-mapped-result.mjs +19 -0
- package/build/esm/type/keyof/keyof-property-entries.d.mts +7 -0
- package/build/esm/type/keyof/keyof-property-entries.mjs +12 -0
- package/build/esm/type/keyof/keyof-property-keys.d.mts +24 -0
- package/build/esm/type/keyof/keyof-property-keys.mjs +73 -0
- package/build/esm/type/keyof/keyof.d.mts +21 -0
- package/build/esm/type/keyof/keyof.mjs +35 -0
- package/build/esm/type/literal/index.d.mts +1 -0
- package/build/esm/type/literal/index.mjs +1 -0
- package/build/esm/type/literal/literal.d.mts +10 -0
- package/build/esm/type/literal/literal.mjs +10 -0
- package/build/esm/type/mapped/index.d.mts +3 -0
- package/build/esm/type/mapped/index.mjs +3 -0
- package/build/esm/type/mapped/mapped-key.d.mts +8 -0
- package/build/esm/type/mapped/mapped-key.mjs +9 -0
- package/build/esm/type/mapped/mapped-result.d.mts +9 -0
- package/build/esm/type/mapped/mapped-result.mjs +9 -0
- package/build/esm/type/mapped/mapped.d.mts +47 -0
- package/build/esm/type/mapped/mapped.mjs +102 -0
- package/build/esm/type/module/compute.d.mts +59 -0
- package/build/esm/type/module/compute.mjs +166 -0
- package/build/esm/type/module/index.d.mts +1 -0
- package/build/esm/type/module/index.mjs +1 -0
- package/build/esm/type/module/infer.d.mts +49 -0
- package/build/esm/type/module/infer.mjs +1 -0
- package/build/esm/type/module/module.d.mts +27 -0
- package/build/esm/type/module/module.mjs +32 -0
- package/build/esm/type/never/index.d.mts +1 -0
- package/build/esm/type/never/index.mjs +1 -0
- package/build/esm/type/never/never.d.mts +9 -0
- package/build/esm/type/never/never.mjs +6 -0
- package/build/esm/type/not/index.d.mts +1 -0
- package/build/esm/type/not/index.mjs +1 -0
- package/build/esm/type/not/not.d.mts +10 -0
- package/build/esm/type/not/not.mjs +6 -0
- package/build/esm/type/null/index.d.mts +1 -0
- package/build/esm/type/null/index.mjs +1 -0
- package/build/esm/type/null/null.d.mts +9 -0
- package/build/esm/type/null/null.mjs +6 -0
- package/build/esm/type/number/index.d.mts +1 -0
- package/build/esm/type/number/index.mjs +1 -0
- package/build/esm/type/number/number.d.mts +16 -0
- package/build/esm/type/number/number.mjs +6 -0
- package/build/esm/type/object/index.d.mts +1 -0
- package/build/esm/type/object/index.mjs +1 -0
- package/build/esm/type/object/object.d.mts +51 -0
- package/build/esm/type/object/object.mjs +18 -0
- package/build/esm/type/omit/index.d.mts +3 -0
- package/build/esm/type/omit/index.mjs +3 -0
- package/build/esm/type/omit/omit-from-mapped-key.d.mts +12 -0
- package/build/esm/type/omit/omit-from-mapped-key.mjs +22 -0
- package/build/esm/type/omit/omit-from-mapped-result.d.mts +12 -0
- package/build/esm/type/omit/omit-from-mapped-result.mjs +19 -0
- package/build/esm/type/omit/omit.d.mts +36 -0
- package/build/esm/type/omit/omit.mjs +71 -0
- package/build/esm/type/optional/index.d.mts +2 -0
- package/build/esm/type/optional/index.mjs +2 -0
- package/build/esm/type/optional/optional-from-mapped-result.d.mts +10 -0
- package/build/esm/type/optional/optional-from-mapped-result.mjs +18 -0
- package/build/esm/type/optional/optional.d.mts +20 -0
- package/build/esm/type/optional/optional.mjs +22 -0
- package/build/esm/type/parameters/index.d.mts +1 -0
- package/build/esm/type/parameters/index.mjs +1 -0
- package/build/esm/type/parameters/parameters.d.mts +7 -0
- package/build/esm/type/parameters/parameters.mjs +7 -0
- package/build/esm/type/partial/index.d.mts +2 -0
- package/build/esm/type/partial/index.mjs +2 -0
- package/build/esm/type/partial/partial-from-mapped-result.d.mts +12 -0
- package/build/esm/type/partial/partial-from-mapped-result.mjs +19 -0
- package/build/esm/type/partial/partial.d.mts +35 -0
- package/build/esm/type/partial/partial.mjs +74 -0
- package/build/esm/type/patterns/index.d.mts +1 -0
- package/build/esm/type/patterns/index.mjs +1 -0
- package/build/esm/type/patterns/patterns.d.mts +8 -0
- package/build/esm/type/patterns/patterns.mjs +8 -0
- package/build/esm/type/pick/index.d.mts +3 -0
- package/build/esm/type/pick/index.mjs +3 -0
- package/build/esm/type/pick/pick-from-mapped-key.d.mts +12 -0
- package/build/esm/type/pick/pick-from-mapped-key.mjs +24 -0
- package/build/esm/type/pick/pick-from-mapped-result.d.mts +12 -0
- package/build/esm/type/pick/pick-from-mapped-result.mjs +19 -0
- package/build/esm/type/pick/pick.d.mts +36 -0
- package/build/esm/type/pick/pick.mjs +66 -0
- package/build/esm/type/promise/index.d.mts +1 -0
- package/build/esm/type/promise/index.mjs +1 -0
- package/build/esm/type/promise/promise.d.mts +11 -0
- package/build/esm/type/promise/promise.mjs +6 -0
- package/build/esm/type/readonly/index.d.mts +2 -0
- package/build/esm/type/readonly/index.mjs +2 -0
- package/build/esm/type/readonly/readonly-from-mapped-result.d.mts +10 -0
- package/build/esm/type/readonly/readonly-from-mapped-result.mjs +18 -0
- package/build/esm/type/readonly/readonly.d.mts +20 -0
- package/build/esm/type/readonly/readonly.mjs +22 -0
- package/build/esm/type/readonly-optional/index.d.mts +1 -0
- package/build/esm/type/readonly-optional/index.mjs +1 -0
- package/build/esm/type/readonly-optional/readonly-optional.d.mts +6 -0
- package/build/esm/type/readonly-optional/readonly-optional.mjs +6 -0
- package/build/esm/type/record/index.d.mts +1 -0
- package/build/esm/type/record/index.mjs +1 -0
- package/build/esm/type/record/record.d.mts +71 -0
- package/build/esm/type/record/record.mjs +116 -0
- package/build/esm/type/recursive/index.d.mts +1 -0
- package/build/esm/type/recursive/index.mjs +1 -0
- package/build/esm/type/recursive/recursive.d.mts +16 -0
- package/build/esm/type/recursive/recursive.mjs +15 -0
- package/build/esm/type/ref/index.d.mts +1 -0
- package/build/esm/type/ref/index.mjs +1 -0
- package/build/esm/type/ref/ref.d.mts +41 -0
- package/build/esm/type/ref/ref.mjs +10 -0
- package/build/esm/type/regexp/index.d.mts +1 -0
- package/build/esm/type/regexp/index.mjs +1 -0
- package/build/esm/type/regexp/regexp.d.mts +20 -0
- package/build/esm/type/regexp/regexp.mjs +8 -0
- package/build/esm/type/registry/format.d.mts +13 -0
- package/build/esm/type/registry/format.mjs +26 -0
- package/build/esm/type/registry/index.d.mts +2 -0
- package/build/esm/type/registry/index.mjs +2 -0
- package/build/esm/type/registry/type.d.mts +13 -0
- package/build/esm/type/registry/type.mjs +26 -0
- package/build/esm/type/required/index.d.mts +2 -0
- package/build/esm/type/required/index.mjs +2 -0
- package/build/esm/type/required/required-from-mapped-result.d.mts +12 -0
- package/build/esm/type/required/required-from-mapped-result.mjs +18 -0
- package/build/esm/type/required/required.d.mts +35 -0
- package/build/esm/type/required/required.mjs +73 -0
- package/build/esm/type/rest/index.d.mts +1 -0
- package/build/esm/type/rest/index.mjs +1 -0
- package/build/esm/type/rest/rest.d.mts +10 -0
- package/build/esm/type/rest/rest.mjs +15 -0
- package/build/esm/type/return-type/index.d.mts +1 -0
- package/build/esm/type/return-type/index.mjs +1 -0
- package/build/esm/type/return-type/return-type.d.mts +6 -0
- package/build/esm/type/return-type/return-type.mjs +7 -0
- package/build/esm/type/schema/anyschema.d.mts +33 -0
- package/build/esm/type/schema/anyschema.mjs +1 -0
- package/build/esm/type/schema/index.d.mts +2 -0
- package/build/esm/type/schema/index.mjs +2 -0
- package/build/esm/type/schema/schema.d.mts +29 -0
- package/build/esm/type/schema/schema.mjs +1 -0
- package/build/esm/type/sets/index.d.mts +1 -0
- package/build/esm/type/sets/index.mjs +1 -0
- package/build/esm/type/sets/set.d.mts +28 -0
- package/build/esm/type/sets/set.mjs +48 -0
- package/build/esm/type/static/index.d.mts +1 -0
- package/build/esm/type/static/index.mjs +1 -0
- package/build/esm/type/static/static.d.mts +39 -0
- package/build/esm/type/static/static.mjs +1 -0
- package/build/esm/type/string/index.d.mts +1 -0
- package/build/esm/type/string/index.mjs +1 -0
- package/build/esm/type/string/string.d.mts +25 -0
- package/build/esm/type/string/string.mjs +6 -0
- package/build/esm/type/symbol/index.d.mts +1 -0
- package/build/esm/type/symbol/index.mjs +1 -0
- package/build/esm/type/symbol/symbol.d.mts +10 -0
- package/build/esm/type/symbol/symbol.mjs +6 -0
- package/build/esm/type/symbols/index.d.mts +1 -0
- package/build/esm/type/symbols/index.mjs +1 -0
- package/build/esm/type/symbols/symbols.d.mts +10 -0
- package/build/esm/type/symbols/symbols.mjs +10 -0
- package/build/esm/type/template-literal/finite.d.mts +19 -0
- package/build/esm/type/template-literal/finite.mjs +49 -0
- package/build/esm/type/template-literal/generate.d.mts +21 -0
- package/build/esm/type/template-literal/generate.mjs +53 -0
- package/build/esm/type/template-literal/index.d.mts +7 -0
- package/build/esm/type/template-literal/index.mjs +7 -0
- package/build/esm/type/template-literal/parse.d.mts +20 -0
- package/build/esm/type/template-literal/parse.mjs +167 -0
- package/build/esm/type/template-literal/pattern.d.mts +5 -0
- package/build/esm/type/template-literal/pattern.mjs +33 -0
- package/build/esm/type/template-literal/syntax.d.mts +20 -0
- package/build/esm/type/template-literal/syntax.mjs +55 -0
- package/build/esm/type/template-literal/template-literal.d.mts +30 -0
- package/build/esm/type/template-literal/template-literal.mjs +13 -0
- package/build/esm/type/template-literal/union.d.mts +9 -0
- package/build/esm/type/template-literal/union.mjs +9 -0
- package/build/esm/type/transform/index.d.mts +1 -0
- package/build/esm/type/transform/index.mjs +1 -0
- package/build/esm/type/transform/transform.d.mts +30 -0
- package/build/esm/type/transform/transform.mjs +40 -0
- package/build/esm/type/tuple/index.d.mts +1 -0
- package/build/esm/type/tuple/index.mjs +1 -0
- package/build/esm/type/tuple/tuple.d.mts +16 -0
- package/build/esm/type/tuple/tuple.mjs +9 -0
- package/build/esm/type/type/index.d.mts +6 -0
- package/build/esm/type/type/index.mjs +13 -0
- package/build/esm/type/type/javascript.d.mts +64 -0
- package/build/esm/type/type/javascript.mjs +99 -0
- package/build/esm/type/type/json.d.mts +208 -0
- package/build/esm/type/type/json.mjs +221 -0
- package/build/esm/type/type/type.d.mts +59 -0
- package/build/esm/type/type/type.mjs +62 -0
- package/build/esm/type/uint8array/index.d.mts +1 -0
- package/build/esm/type/uint8array/index.mjs +1 -0
- package/build/esm/type/uint8array/uint8array.d.mts +13 -0
- package/build/esm/type/uint8array/uint8array.mjs +6 -0
- package/build/esm/type/undefined/index.d.mts +1 -0
- package/build/esm/type/undefined/index.mjs +1 -0
- package/build/esm/type/undefined/undefined.d.mts +9 -0
- package/build/esm/type/undefined/undefined.mjs +6 -0
- package/build/esm/type/union/index.d.mts +3 -0
- package/build/esm/type/union/index.mjs +3 -0
- package/build/esm/type/union/union-create.d.mts +3 -0
- package/build/esm/type/union/union-create.mjs +5 -0
- package/build/esm/type/union/union-evaluated.d.mts +13 -0
- package/build/esm/type/union/union-evaluated.mjs +36 -0
- package/build/esm/type/union/union-type.d.mts +12 -0
- package/build/esm/type/union/union-type.mjs +1 -0
- package/build/esm/type/union/union.d.mts +6 -0
- package/build/esm/type/union/union.mjs +10 -0
- package/build/esm/type/unknown/index.d.mts +1 -0
- package/build/esm/type/unknown/index.mjs +1 -0
- package/build/esm/type/unknown/unknown.d.mts +8 -0
- package/build/esm/type/unknown/unknown.mjs +6 -0
- package/build/esm/type/unsafe/index.d.mts +1 -0
- package/build/esm/type/unsafe/index.mjs +1 -0
- package/build/esm/type/unsafe/unsafe.d.mts +11 -0
- package/build/esm/type/unsafe/unsafe.mjs +6 -0
- package/build/esm/type/void/index.d.mts +1 -0
- package/build/esm/type/void/index.mjs +1 -0
- package/build/esm/type/void/void.d.mts +9 -0
- package/build/esm/type/void/void.mjs +6 -0
- package/build/esm/value/assert/assert.d.mts +15 -0
- package/build/esm/value/assert/assert.mjs +49 -0
- package/build/esm/value/assert/index.d.mts +1 -0
- package/build/esm/value/assert/index.mjs +1 -0
- package/build/esm/value/cast/cast.d.mts +11 -0
- package/build/esm/value/cast/cast.mjs +235 -0
- package/build/esm/value/cast/index.d.mts +1 -0
- package/build/esm/value/cast/index.mjs +1 -0
- package/build/esm/value/check/check.d.mts +11 -0
- package/build/esm/value/check/check.mjs +470 -0
- package/build/esm/value/check/index.d.mts +1 -0
- package/build/esm/value/check/index.mjs +1 -0
- package/build/esm/value/clean/clean.d.mts +5 -0
- package/build/esm/value/clean/clean.mjs +145 -0
- package/build/esm/value/clean/index.d.mts +1 -0
- package/build/esm/value/clean/index.mjs +1 -0
- package/build/esm/value/clone/clone.d.mts +2 -0
- package/build/esm/value/clone/clone.mjs +56 -0
- package/build/esm/value/clone/index.d.mts +1 -0
- package/build/esm/value/clone/index.mjs +1 -0
- package/build/esm/value/convert/convert.d.mts +5 -0
- package/build/esm/value/convert/convert.mjs +260 -0
- package/build/esm/value/convert/index.d.mts +1 -0
- package/build/esm/value/convert/index.mjs +1 -0
- package/build/esm/value/create/create.d.mts +11 -0
- package/build/esm/value/create/create.mjs +468 -0
- package/build/esm/value/create/index.d.mts +1 -0
- package/build/esm/value/create/index.mjs +1 -0
- package/build/esm/value/decode/decode.d.mts +6 -0
- package/build/esm/value/decode/decode.mjs +10 -0
- package/build/esm/value/decode/index.d.mts +1 -0
- package/build/esm/value/decode/index.mjs +1 -0
- package/build/esm/value/default/default.d.mts +5 -0
- package/build/esm/value/default/default.mjs +172 -0
- package/build/esm/value/default/index.d.mts +1 -0
- package/build/esm/value/default/index.mjs +1 -0
- package/build/esm/value/delta/delta.d.mts +32 -0
- package/build/esm/value/delta/delta.mjs +171 -0
- package/build/esm/value/delta/index.d.mts +1 -0
- package/build/esm/value/delta/index.mjs +1 -0
- package/build/esm/value/deref/deref.d.mts +12 -0
- package/build/esm/value/deref/deref.mjs +29 -0
- package/build/esm/value/deref/index.d.mts +1 -0
- package/build/esm/value/deref/index.mjs +1 -0
- package/build/esm/value/encode/encode.d.mts +6 -0
- package/build/esm/value/encode/encode.mjs +11 -0
- package/build/esm/value/encode/index.d.mts +1 -0
- package/build/esm/value/encode/index.mjs +1 -0
- package/build/esm/value/equal/equal.d.mts +2 -0
- package/build/esm/value/equal/equal.mjs +46 -0
- package/build/esm/value/equal/index.d.mts +1 -0
- package/build/esm/value/equal/index.mjs +1 -0
- package/build/esm/value/guard/guard.d.mts +74 -0
- package/build/esm/value/guard/guard.mjs +158 -0
- package/build/esm/value/guard/index.d.mts +1 -0
- package/build/esm/value/guard/index.mjs +1 -0
- package/build/esm/value/hash/hash.d.mts +7 -0
- package/build/esm/value/hash/hash.mjs +146 -0
- package/build/esm/value/hash/index.d.mts +1 -0
- package/build/esm/value/hash/index.mjs +1 -0
- package/build/esm/value/index.d.mts +20 -0
- package/build/esm/value/index.mjs +32 -0
- package/build/esm/value/mutate/index.d.mts +1 -0
- package/build/esm/value/mutate/index.mjs +1 -0
- package/build/esm/value/mutate/mutate.d.mts +9 -0
- package/build/esm/value/mutate/mutate.mjs +98 -0
- package/build/esm/value/parse/index.d.mts +1 -0
- package/build/esm/value/parse/index.mjs +1 -0
- package/build/esm/value/parse/parse.d.mts +22 -0
- package/build/esm/value/parse/parse.mjs +81 -0
- package/build/esm/value/pointer/index.d.mts +1 -0
- package/build/esm/value/pointer/index.mjs +1 -0
- package/build/esm/value/pointer/pointer.d.mts +22 -0
- package/build/esm/value/pointer/pointer.mjs +115 -0
- package/build/esm/value/transform/decode.d.mts +22 -0
- package/build/esm/value/transform/decode.mjs +207 -0
- package/build/esm/value/transform/encode.d.mts +23 -0
- package/build/esm/value/transform/encode.mjs +218 -0
- package/build/esm/value/transform/has.d.mts +3 -0
- package/build/esm/value/transform/has.mjs +129 -0
- package/build/esm/value/transform/index.d.mts +3 -0
- package/build/esm/value/transform/index.mjs +3 -0
- package/build/esm/value/value/index.d.mts +1 -0
- package/build/esm/value/value/index.mjs +1 -0
- package/build/esm/value/value/value.d.mts +16 -0
- package/build/esm/value/value/value.mjs +16 -0
- package/changes.json +5 -0
- package/compiler/package.json +4 -0
- package/errors/package.json +4 -0
- package/license +25 -0
- package/package.json +128 -0
- package/parser/package.json +4 -0
- package/readme.md +1865 -0
- package/syntax/package.json +4 -0
- package/system/package.json +4 -0
- package/type/package.json +4 -0
- package/value/package.json +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TSchema } from '../type/schema/index.mjs';
|
|
2
|
+
import { ValueErrorIterator, ValueErrorType } from './errors.mjs';
|
|
3
|
+
/** Creates an error message using en-US as the default locale */
|
|
4
|
+
export declare function DefaultErrorFunction(error: ErrorFunctionParameter): string;
|
|
5
|
+
export type ErrorFunctionParameter = {
|
|
6
|
+
/** The type of validation error */
|
|
7
|
+
errorType: ValueErrorType;
|
|
8
|
+
/** The path of the error */
|
|
9
|
+
path: string;
|
|
10
|
+
/** The schema associated with the error */
|
|
11
|
+
schema: TSchema;
|
|
12
|
+
/** The value associated with the error */
|
|
13
|
+
value: unknown;
|
|
14
|
+
/** Interior errors for this error */
|
|
15
|
+
errors: ValueErrorIterator[];
|
|
16
|
+
};
|
|
17
|
+
export type ErrorFunction = (parameter: ErrorFunctionParameter) => string;
|
|
18
|
+
/** Sets the error function used to generate error messages. */
|
|
19
|
+
export declare function SetErrorFunction(callback: ErrorFunction): void;
|
|
20
|
+
/** Gets the error function used to generate error messages */
|
|
21
|
+
export declare function GetErrorFunction(): ErrorFunction;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Kind } from '../type/symbols/index.mjs';
|
|
2
|
+
import { ValueErrorType } from './errors.mjs';
|
|
3
|
+
/** Creates an error message using en-US as the default locale */
|
|
4
|
+
export function DefaultErrorFunction(error) {
|
|
5
|
+
switch (error.errorType) {
|
|
6
|
+
case ValueErrorType.ArrayContains:
|
|
7
|
+
return 'Expected array to contain at least one matching value';
|
|
8
|
+
case ValueErrorType.ArrayMaxContains:
|
|
9
|
+
return `Expected array to contain no more than ${error.schema.maxContains} matching values`;
|
|
10
|
+
case ValueErrorType.ArrayMinContains:
|
|
11
|
+
return `Expected array to contain at least ${error.schema.minContains} matching values`;
|
|
12
|
+
case ValueErrorType.ArrayMaxItems:
|
|
13
|
+
return `Expected array length to be less or equal to ${error.schema.maxItems}`;
|
|
14
|
+
case ValueErrorType.ArrayMinItems:
|
|
15
|
+
return `Expected array length to be greater or equal to ${error.schema.minItems}`;
|
|
16
|
+
case ValueErrorType.ArrayUniqueItems:
|
|
17
|
+
return 'Expected array elements to be unique';
|
|
18
|
+
case ValueErrorType.Array:
|
|
19
|
+
return 'Expected array';
|
|
20
|
+
case ValueErrorType.AsyncIterator:
|
|
21
|
+
return 'Expected AsyncIterator';
|
|
22
|
+
case ValueErrorType.BigIntExclusiveMaximum:
|
|
23
|
+
return `Expected bigint to be less than ${error.schema.exclusiveMaximum}`;
|
|
24
|
+
case ValueErrorType.BigIntExclusiveMinimum:
|
|
25
|
+
return `Expected bigint to be greater than ${error.schema.exclusiveMinimum}`;
|
|
26
|
+
case ValueErrorType.BigIntMaximum:
|
|
27
|
+
return `Expected bigint to be less or equal to ${error.schema.maximum}`;
|
|
28
|
+
case ValueErrorType.BigIntMinimum:
|
|
29
|
+
return `Expected bigint to be greater or equal to ${error.schema.minimum}`;
|
|
30
|
+
case ValueErrorType.BigIntMultipleOf:
|
|
31
|
+
return `Expected bigint to be a multiple of ${error.schema.multipleOf}`;
|
|
32
|
+
case ValueErrorType.BigInt:
|
|
33
|
+
return 'Expected bigint';
|
|
34
|
+
case ValueErrorType.Boolean:
|
|
35
|
+
return 'Expected boolean';
|
|
36
|
+
case ValueErrorType.DateExclusiveMinimumTimestamp:
|
|
37
|
+
return `Expected Date timestamp to be greater than ${error.schema.exclusiveMinimumTimestamp}`;
|
|
38
|
+
case ValueErrorType.DateExclusiveMaximumTimestamp:
|
|
39
|
+
return `Expected Date timestamp to be less than ${error.schema.exclusiveMaximumTimestamp}`;
|
|
40
|
+
case ValueErrorType.DateMinimumTimestamp:
|
|
41
|
+
return `Expected Date timestamp to be greater or equal to ${error.schema.minimumTimestamp}`;
|
|
42
|
+
case ValueErrorType.DateMaximumTimestamp:
|
|
43
|
+
return `Expected Date timestamp to be less or equal to ${error.schema.maximumTimestamp}`;
|
|
44
|
+
case ValueErrorType.DateMultipleOfTimestamp:
|
|
45
|
+
return `Expected Date timestamp to be a multiple of ${error.schema.multipleOfTimestamp}`;
|
|
46
|
+
case ValueErrorType.Date:
|
|
47
|
+
return 'Expected Date';
|
|
48
|
+
case ValueErrorType.Function:
|
|
49
|
+
return 'Expected function';
|
|
50
|
+
case ValueErrorType.IntegerExclusiveMaximum:
|
|
51
|
+
return `Expected integer to be less than ${error.schema.exclusiveMaximum}`;
|
|
52
|
+
case ValueErrorType.IntegerExclusiveMinimum:
|
|
53
|
+
return `Expected integer to be greater than ${error.schema.exclusiveMinimum}`;
|
|
54
|
+
case ValueErrorType.IntegerMaximum:
|
|
55
|
+
return `Expected integer to be less or equal to ${error.schema.maximum}`;
|
|
56
|
+
case ValueErrorType.IntegerMinimum:
|
|
57
|
+
return `Expected integer to be greater or equal to ${error.schema.minimum}`;
|
|
58
|
+
case ValueErrorType.IntegerMultipleOf:
|
|
59
|
+
return `Expected integer to be a multiple of ${error.schema.multipleOf}`;
|
|
60
|
+
case ValueErrorType.Integer:
|
|
61
|
+
return 'Expected integer';
|
|
62
|
+
case ValueErrorType.IntersectUnevaluatedProperties:
|
|
63
|
+
return 'Unexpected property';
|
|
64
|
+
case ValueErrorType.Intersect:
|
|
65
|
+
return 'Expected all values to match';
|
|
66
|
+
case ValueErrorType.Iterator:
|
|
67
|
+
return 'Expected Iterator';
|
|
68
|
+
case ValueErrorType.Literal:
|
|
69
|
+
return `Expected ${typeof error.schema.const === 'string' ? `'${error.schema.const}'` : error.schema.const}`;
|
|
70
|
+
case ValueErrorType.Never:
|
|
71
|
+
return 'Never';
|
|
72
|
+
case ValueErrorType.Not:
|
|
73
|
+
return 'Value should not match';
|
|
74
|
+
case ValueErrorType.Null:
|
|
75
|
+
return 'Expected null';
|
|
76
|
+
case ValueErrorType.NumberExclusiveMaximum:
|
|
77
|
+
return `Expected number to be less than ${error.schema.exclusiveMaximum}`;
|
|
78
|
+
case ValueErrorType.NumberExclusiveMinimum:
|
|
79
|
+
return `Expected number to be greater than ${error.schema.exclusiveMinimum}`;
|
|
80
|
+
case ValueErrorType.NumberMaximum:
|
|
81
|
+
return `Expected number to be less or equal to ${error.schema.maximum}`;
|
|
82
|
+
case ValueErrorType.NumberMinimum:
|
|
83
|
+
return `Expected number to be greater or equal to ${error.schema.minimum}`;
|
|
84
|
+
case ValueErrorType.NumberMultipleOf:
|
|
85
|
+
return `Expected number to be a multiple of ${error.schema.multipleOf}`;
|
|
86
|
+
case ValueErrorType.Number:
|
|
87
|
+
return 'Expected number';
|
|
88
|
+
case ValueErrorType.Object:
|
|
89
|
+
return 'Expected object';
|
|
90
|
+
case ValueErrorType.ObjectAdditionalProperties:
|
|
91
|
+
return 'Unexpected property';
|
|
92
|
+
case ValueErrorType.ObjectMaxProperties:
|
|
93
|
+
return `Expected object to have no more than ${error.schema.maxProperties} properties`;
|
|
94
|
+
case ValueErrorType.ObjectMinProperties:
|
|
95
|
+
return `Expected object to have at least ${error.schema.minProperties} properties`;
|
|
96
|
+
case ValueErrorType.ObjectRequiredProperty:
|
|
97
|
+
return 'Expected required property';
|
|
98
|
+
case ValueErrorType.Promise:
|
|
99
|
+
return 'Expected Promise';
|
|
100
|
+
case ValueErrorType.RegExp:
|
|
101
|
+
return 'Expected string to match regular expression';
|
|
102
|
+
case ValueErrorType.StringFormatUnknown:
|
|
103
|
+
return `Unknown format '${error.schema.format}'`;
|
|
104
|
+
case ValueErrorType.StringFormat:
|
|
105
|
+
return `Expected string to match '${error.schema.format}' format`;
|
|
106
|
+
case ValueErrorType.StringMaxLength:
|
|
107
|
+
return `Expected string length less or equal to ${error.schema.maxLength}`;
|
|
108
|
+
case ValueErrorType.StringMinLength:
|
|
109
|
+
return `Expected string length greater or equal to ${error.schema.minLength}`;
|
|
110
|
+
case ValueErrorType.StringPattern:
|
|
111
|
+
return `Expected string to match '${error.schema.pattern}'`;
|
|
112
|
+
case ValueErrorType.String:
|
|
113
|
+
return 'Expected string';
|
|
114
|
+
case ValueErrorType.Symbol:
|
|
115
|
+
return 'Expected symbol';
|
|
116
|
+
case ValueErrorType.TupleLength:
|
|
117
|
+
return `Expected tuple to have ${error.schema.maxItems || 0} elements`;
|
|
118
|
+
case ValueErrorType.Tuple:
|
|
119
|
+
return 'Expected tuple';
|
|
120
|
+
case ValueErrorType.Uint8ArrayMaxByteLength:
|
|
121
|
+
return `Expected byte length less or equal to ${error.schema.maxByteLength}`;
|
|
122
|
+
case ValueErrorType.Uint8ArrayMinByteLength:
|
|
123
|
+
return `Expected byte length greater or equal to ${error.schema.minByteLength}`;
|
|
124
|
+
case ValueErrorType.Uint8Array:
|
|
125
|
+
return 'Expected Uint8Array';
|
|
126
|
+
case ValueErrorType.Undefined:
|
|
127
|
+
return 'Expected undefined';
|
|
128
|
+
case ValueErrorType.Union:
|
|
129
|
+
return 'Expected union value';
|
|
130
|
+
case ValueErrorType.Void:
|
|
131
|
+
return 'Expected void';
|
|
132
|
+
case ValueErrorType.Kind:
|
|
133
|
+
return `Expected kind '${error.schema[Kind]}'`;
|
|
134
|
+
default:
|
|
135
|
+
return 'Unknown error type';
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/** Manages error message providers */
|
|
139
|
+
let errorFunction = DefaultErrorFunction;
|
|
140
|
+
/** Sets the error function used to generate error messages. */
|
|
141
|
+
export function SetErrorFunction(callback) {
|
|
142
|
+
errorFunction = callback;
|
|
143
|
+
}
|
|
144
|
+
/** Gets the error function used to generate error messages */
|
|
145
|
+
export function GetErrorFunction() {
|
|
146
|
+
return errorFunction;
|
|
147
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export * from './type/clone/index.mjs';
|
|
2
|
+
export * from './type/create/index.mjs';
|
|
3
|
+
export * from './type/error/index.mjs';
|
|
4
|
+
export * from './type/guard/index.mjs';
|
|
5
|
+
export * from './type/helpers/index.mjs';
|
|
6
|
+
export * from './type/patterns/index.mjs';
|
|
7
|
+
export * from './type/registry/index.mjs';
|
|
8
|
+
export * from './type/sets/index.mjs';
|
|
9
|
+
export * from './type/symbols/index.mjs';
|
|
10
|
+
export * from './type/any/index.mjs';
|
|
11
|
+
export * from './type/array/index.mjs';
|
|
12
|
+
export * from './type/argument/index.mjs';
|
|
13
|
+
export * from './type/async-iterator/index.mjs';
|
|
14
|
+
export * from './type/awaited/index.mjs';
|
|
15
|
+
export * from './type/bigint/index.mjs';
|
|
16
|
+
export * from './type/boolean/index.mjs';
|
|
17
|
+
export * from './type/composite/index.mjs';
|
|
18
|
+
export * from './type/const/index.mjs';
|
|
19
|
+
export * from './type/constructor/index.mjs';
|
|
20
|
+
export * from './type/constructor-parameters/index.mjs';
|
|
21
|
+
export * from './type/date/index.mjs';
|
|
22
|
+
export * from './type/enum/index.mjs';
|
|
23
|
+
export * from './type/exclude/index.mjs';
|
|
24
|
+
export * from './type/extends/index.mjs';
|
|
25
|
+
export * from './type/extract/index.mjs';
|
|
26
|
+
export * from './type/function/index.mjs';
|
|
27
|
+
export * from './type/indexed/index.mjs';
|
|
28
|
+
export * from './type/instance-type/index.mjs';
|
|
29
|
+
export * from './type/instantiate/index.mjs';
|
|
30
|
+
export * from './type/integer/index.mjs';
|
|
31
|
+
export * from './type/intersect/index.mjs';
|
|
32
|
+
export * from './type/iterator/index.mjs';
|
|
33
|
+
export * from './type/intrinsic/index.mjs';
|
|
34
|
+
export * from './type/keyof/index.mjs';
|
|
35
|
+
export * from './type/literal/index.mjs';
|
|
36
|
+
export * from './type/module/index.mjs';
|
|
37
|
+
export * from './type/mapped/index.mjs';
|
|
38
|
+
export * from './type/never/index.mjs';
|
|
39
|
+
export * from './type/not/index.mjs';
|
|
40
|
+
export * from './type/null/index.mjs';
|
|
41
|
+
export * from './type/number/index.mjs';
|
|
42
|
+
export * from './type/object/index.mjs';
|
|
43
|
+
export * from './type/omit/index.mjs';
|
|
44
|
+
export * from './type/optional/index.mjs';
|
|
45
|
+
export * from './type/parameters/index.mjs';
|
|
46
|
+
export * from './type/partial/index.mjs';
|
|
47
|
+
export * from './type/pick/index.mjs';
|
|
48
|
+
export * from './type/promise/index.mjs';
|
|
49
|
+
export * from './type/readonly/index.mjs';
|
|
50
|
+
export * from './type/readonly-optional/index.mjs';
|
|
51
|
+
export * from './type/record/index.mjs';
|
|
52
|
+
export * from './type/recursive/index.mjs';
|
|
53
|
+
export * from './type/ref/index.mjs';
|
|
54
|
+
export * from './type/regexp/index.mjs';
|
|
55
|
+
export * from './type/required/index.mjs';
|
|
56
|
+
export * from './type/rest/index.mjs';
|
|
57
|
+
export * from './type/return-type/index.mjs';
|
|
58
|
+
export * from './type/schema/index.mjs';
|
|
59
|
+
export * from './type/static/index.mjs';
|
|
60
|
+
export * from './type/string/index.mjs';
|
|
61
|
+
export * from './type/symbol/index.mjs';
|
|
62
|
+
export * from './type/template-literal/index.mjs';
|
|
63
|
+
export * from './type/transform/index.mjs';
|
|
64
|
+
export * from './type/tuple/index.mjs';
|
|
65
|
+
export * from './type/uint8array/index.mjs';
|
|
66
|
+
export * from './type/undefined/index.mjs';
|
|
67
|
+
export * from './type/union/index.mjs';
|
|
68
|
+
export * from './type/unknown/index.mjs';
|
|
69
|
+
export * from './type/unsafe/index.mjs';
|
|
70
|
+
export * from './type/void/index.mjs';
|
|
71
|
+
export * from './type/type/index.mjs';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// ------------------------------------------------------------------
|
|
2
|
+
// Infrastructure
|
|
3
|
+
// ------------------------------------------------------------------
|
|
4
|
+
export * from './type/clone/index.mjs';
|
|
5
|
+
export * from './type/create/index.mjs';
|
|
6
|
+
export * from './type/error/index.mjs';
|
|
7
|
+
export * from './type/guard/index.mjs';
|
|
8
|
+
export * from './type/helpers/index.mjs';
|
|
9
|
+
export * from './type/patterns/index.mjs';
|
|
10
|
+
export * from './type/registry/index.mjs';
|
|
11
|
+
export * from './type/sets/index.mjs';
|
|
12
|
+
export * from './type/symbols/index.mjs';
|
|
13
|
+
// ------------------------------------------------------------------
|
|
14
|
+
// Types
|
|
15
|
+
// ------------------------------------------------------------------
|
|
16
|
+
export * from './type/any/index.mjs';
|
|
17
|
+
export * from './type/array/index.mjs';
|
|
18
|
+
export * from './type/argument/index.mjs';
|
|
19
|
+
export * from './type/async-iterator/index.mjs';
|
|
20
|
+
export * from './type/awaited/index.mjs';
|
|
21
|
+
export * from './type/bigint/index.mjs';
|
|
22
|
+
export * from './type/boolean/index.mjs';
|
|
23
|
+
export * from './type/composite/index.mjs';
|
|
24
|
+
export * from './type/const/index.mjs';
|
|
25
|
+
export * from './type/constructor/index.mjs';
|
|
26
|
+
export * from './type/constructor-parameters/index.mjs';
|
|
27
|
+
export * from './type/date/index.mjs';
|
|
28
|
+
export * from './type/enum/index.mjs';
|
|
29
|
+
export * from './type/exclude/index.mjs';
|
|
30
|
+
export * from './type/extends/index.mjs';
|
|
31
|
+
export * from './type/extract/index.mjs';
|
|
32
|
+
export * from './type/function/index.mjs';
|
|
33
|
+
export * from './type/indexed/index.mjs';
|
|
34
|
+
export * from './type/instance-type/index.mjs';
|
|
35
|
+
export * from './type/instantiate/index.mjs';
|
|
36
|
+
export * from './type/integer/index.mjs';
|
|
37
|
+
export * from './type/intersect/index.mjs';
|
|
38
|
+
export * from './type/iterator/index.mjs';
|
|
39
|
+
export * from './type/intrinsic/index.mjs';
|
|
40
|
+
export * from './type/keyof/index.mjs';
|
|
41
|
+
export * from './type/literal/index.mjs';
|
|
42
|
+
export * from './type/module/index.mjs';
|
|
43
|
+
export * from './type/mapped/index.mjs';
|
|
44
|
+
export * from './type/never/index.mjs';
|
|
45
|
+
export * from './type/not/index.mjs';
|
|
46
|
+
export * from './type/null/index.mjs';
|
|
47
|
+
export * from './type/number/index.mjs';
|
|
48
|
+
export * from './type/object/index.mjs';
|
|
49
|
+
export * from './type/omit/index.mjs';
|
|
50
|
+
export * from './type/optional/index.mjs';
|
|
51
|
+
export * from './type/parameters/index.mjs';
|
|
52
|
+
export * from './type/partial/index.mjs';
|
|
53
|
+
export * from './type/pick/index.mjs';
|
|
54
|
+
export * from './type/promise/index.mjs';
|
|
55
|
+
export * from './type/readonly/index.mjs';
|
|
56
|
+
export * from './type/readonly-optional/index.mjs';
|
|
57
|
+
export * from './type/record/index.mjs';
|
|
58
|
+
export * from './type/recursive/index.mjs';
|
|
59
|
+
export * from './type/ref/index.mjs';
|
|
60
|
+
export * from './type/regexp/index.mjs';
|
|
61
|
+
export * from './type/required/index.mjs';
|
|
62
|
+
export * from './type/rest/index.mjs';
|
|
63
|
+
export * from './type/return-type/index.mjs';
|
|
64
|
+
export * from './type/schema/index.mjs';
|
|
65
|
+
export * from './type/static/index.mjs';
|
|
66
|
+
export * from './type/string/index.mjs';
|
|
67
|
+
export * from './type/symbol/index.mjs';
|
|
68
|
+
export * from './type/template-literal/index.mjs';
|
|
69
|
+
export * from './type/transform/index.mjs';
|
|
70
|
+
export * from './type/tuple/index.mjs';
|
|
71
|
+
export * from './type/uint8array/index.mjs';
|
|
72
|
+
export * from './type/undefined/index.mjs';
|
|
73
|
+
export * from './type/union/index.mjs';
|
|
74
|
+
export * from './type/unknown/index.mjs';
|
|
75
|
+
export * from './type/unsafe/index.mjs';
|
|
76
|
+
export * from './type/void/index.mjs';
|
|
77
|
+
// ------------------------------------------------------------------
|
|
78
|
+
// Type.*
|
|
79
|
+
// ------------------------------------------------------------------
|
|
80
|
+
export * from './type/type/index.mjs';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IArray, IConst, IContext, IIdent, INumber, IOptional, IRef, IString, ITuple, IUnion } from './types.mjs';
|
|
2
|
+
/** Returns true if the value is a Array Parser */
|
|
3
|
+
export declare function IsArray(value: unknown): value is IArray;
|
|
4
|
+
/** Returns true if the value is a Const Parser */
|
|
5
|
+
export declare function IsConst(value: unknown): value is IConst;
|
|
6
|
+
/** Returns true if the value is a Context Parser */
|
|
7
|
+
export declare function IsContext(value: unknown): value is IContext;
|
|
8
|
+
/** Returns true if the value is a Ident Parser */
|
|
9
|
+
export declare function IsIdent(value: unknown): value is IIdent;
|
|
10
|
+
/** Returns true if the value is a Number Parser */
|
|
11
|
+
export declare function IsNumber(value: unknown): value is INumber;
|
|
12
|
+
/** Returns true if the value is a Optional Parser */
|
|
13
|
+
export declare function IsOptional(value: unknown): value is IOptional;
|
|
14
|
+
/** Returns true if the value is a Ref Parser */
|
|
15
|
+
export declare function IsRef(value: unknown): value is IRef;
|
|
16
|
+
/** Returns true if the value is a String Parser */
|
|
17
|
+
export declare function IsString(value: unknown): value is IString;
|
|
18
|
+
/** Returns true if the value is a Tuple Parser */
|
|
19
|
+
export declare function IsTuple(value: unknown): value is ITuple;
|
|
20
|
+
/** Returns true if the value is a Union Parser */
|
|
21
|
+
export declare function IsUnion(value: unknown): value is IUnion;
|
|
22
|
+
/** Returns true if the value is a Parser */
|
|
23
|
+
export declare function IsParser(value: unknown): value is IContext<unknown> | IUnion<unknown> | IArray<unknown> | IConst<unknown> | IIdent<unknown> | INumber<unknown> | IOptional<unknown> | IRef<unknown> | IString<unknown> | ITuple<unknown>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// ------------------------------------------------------------------
|
|
2
|
+
// Value Guard
|
|
3
|
+
// ------------------------------------------------------------------
|
|
4
|
+
// prettier-ignore
|
|
5
|
+
function HasPropertyKey(value, key) {
|
|
6
|
+
return key in value;
|
|
7
|
+
}
|
|
8
|
+
// prettier-ignore
|
|
9
|
+
function IsObjectValue(value) {
|
|
10
|
+
return typeof value === 'object' && value !== null;
|
|
11
|
+
}
|
|
12
|
+
// prettier-ignore
|
|
13
|
+
function IsArrayValue(value) {
|
|
14
|
+
return globalThis.Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
// ------------------------------------------------------------------
|
|
17
|
+
// Parser Guard
|
|
18
|
+
// ------------------------------------------------------------------
|
|
19
|
+
/** Returns true if the value is a Array Parser */
|
|
20
|
+
export function IsArray(value) {
|
|
21
|
+
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Array' && HasPropertyKey(value, 'parser') && IsObjectValue(value.parser);
|
|
22
|
+
}
|
|
23
|
+
/** Returns true if the value is a Const Parser */
|
|
24
|
+
export function IsConst(value) {
|
|
25
|
+
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Const' && HasPropertyKey(value, 'value') && typeof value.value === 'string';
|
|
26
|
+
}
|
|
27
|
+
/** Returns true if the value is a Context Parser */
|
|
28
|
+
export function IsContext(value) {
|
|
29
|
+
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Context' && HasPropertyKey(value, 'left') && IsParser(value.left) && HasPropertyKey(value, 'right') && IsParser(value.right);
|
|
30
|
+
}
|
|
31
|
+
/** Returns true if the value is a Ident Parser */
|
|
32
|
+
export function IsIdent(value) {
|
|
33
|
+
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Ident';
|
|
34
|
+
}
|
|
35
|
+
/** Returns true if the value is a Number Parser */
|
|
36
|
+
export function IsNumber(value) {
|
|
37
|
+
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Number';
|
|
38
|
+
}
|
|
39
|
+
/** Returns true if the value is a Optional Parser */
|
|
40
|
+
export function IsOptional(value) {
|
|
41
|
+
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Optional' && HasPropertyKey(value, 'parser') && IsObjectValue(value.parser);
|
|
42
|
+
}
|
|
43
|
+
/** Returns true if the value is a Ref Parser */
|
|
44
|
+
export function IsRef(value) {
|
|
45
|
+
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Ref' && HasPropertyKey(value, 'ref') && typeof value.ref === 'string';
|
|
46
|
+
}
|
|
47
|
+
/** Returns true if the value is a String Parser */
|
|
48
|
+
export function IsString(value) {
|
|
49
|
+
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'String' && HasPropertyKey(value, 'options') && IsArrayValue(value.options);
|
|
50
|
+
}
|
|
51
|
+
/** Returns true if the value is a Tuple Parser */
|
|
52
|
+
export function IsTuple(value) {
|
|
53
|
+
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Tuple' && HasPropertyKey(value, 'parsers') && IsArrayValue(value.parsers);
|
|
54
|
+
}
|
|
55
|
+
/** Returns true if the value is a Union Parser */
|
|
56
|
+
export function IsUnion(value) {
|
|
57
|
+
return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Union' && HasPropertyKey(value, 'parsers') && IsArrayValue(value.parsers);
|
|
58
|
+
}
|
|
59
|
+
/** Returns true if the value is a Parser */
|
|
60
|
+
export function IsParser(value) {
|
|
61
|
+
// prettier-ignore
|
|
62
|
+
return (IsArray(value) ||
|
|
63
|
+
IsConst(value) ||
|
|
64
|
+
IsContext(value) ||
|
|
65
|
+
IsIdent(value) ||
|
|
66
|
+
IsNumber(value) ||
|
|
67
|
+
IsOptional(value) ||
|
|
68
|
+
IsRef(value) ||
|
|
69
|
+
IsString(value) ||
|
|
70
|
+
IsTuple(value) ||
|
|
71
|
+
IsUnion(value));
|
|
72
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as Types from './types.mjs';
|
|
2
|
+
export declare class Module<Properties extends Types.IModuleProperties = Types.IModuleProperties> {
|
|
3
|
+
private readonly properties;
|
|
4
|
+
constructor(properties: Properties);
|
|
5
|
+
/** Parses using one of the parsers defined on this instance */
|
|
6
|
+
Parse<Key extends keyof Properties>(key: Key, content: string, context: unknown): [] | [Types.StaticParser<Properties[Key]>, string];
|
|
7
|
+
/** Parses using one of the parsers defined on this instance */
|
|
8
|
+
Parse<Key extends keyof Properties>(key: Key, content: string): [] | [Types.StaticParser<Properties[Key]>, string];
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Parse } from './parse.mjs';
|
|
2
|
+
// ------------------------------------------------------------------
|
|
3
|
+
// Module
|
|
4
|
+
// ------------------------------------------------------------------
|
|
5
|
+
export class Module {
|
|
6
|
+
constructor(properties) {
|
|
7
|
+
this.properties = properties;
|
|
8
|
+
}
|
|
9
|
+
/** Parses using one of the parsers defined on this instance */
|
|
10
|
+
Parse(...args) {
|
|
11
|
+
// prettier-ignore
|
|
12
|
+
const [key, content, context] = (args.length === 3 ? [args[0], args[1], args[2]] :
|
|
13
|
+
args.length === 2 ? [args[0], args[1], undefined] :
|
|
14
|
+
(() => { throw Error('Invalid parse arguments'); })());
|
|
15
|
+
return Parse(this.properties, this.properties[key], content, context);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as Types from './types.mjs';
|
|
2
|
+
/** Parses content using the given Parser */
|
|
3
|
+
export declare function Parse<Parser extends Types.IParser>(moduleProperties: Types.IModuleProperties, parser: Parser, code: string, context: unknown): [] | [Types.StaticParser<Parser>, string];
|
|
4
|
+
/** Parses content using the given Parser */
|
|
5
|
+
export declare function Parse<Parser extends Types.IParser>(moduleProperties: Types.IModuleProperties, parser: Parser, code: string): [] | [Types.StaticParser<Parser>, string];
|
|
6
|
+
/** Parses content using the given Parser */
|
|
7
|
+
export declare function Parse<Parser extends Types.IParser>(parser: Parser, content: string, context: unknown): [] | [Types.StaticParser<Parser>, string];
|
|
8
|
+
/** Parses content using the given Parser */
|
|
9
|
+
export declare function Parse<Parser extends Types.IParser>(parser: Parser, content: string): [] | [Types.StaticParser<Parser>, string];
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as Guard from './guard.mjs';
|
|
2
|
+
import * as Token from './token.mjs';
|
|
3
|
+
// ------------------------------------------------------------------
|
|
4
|
+
// Context
|
|
5
|
+
// ------------------------------------------------------------------
|
|
6
|
+
function ParseContext(moduleProperties, left, right, code, context) {
|
|
7
|
+
const result = ParseParser(moduleProperties, left, code, context);
|
|
8
|
+
return result.length === 2 ? ParseParser(moduleProperties, right, result[1], result[0]) : [];
|
|
9
|
+
}
|
|
10
|
+
// ------------------------------------------------------------------
|
|
11
|
+
// Array
|
|
12
|
+
// ------------------------------------------------------------------
|
|
13
|
+
function ParseArray(moduleProperties, parser, code, context) {
|
|
14
|
+
const buffer = [];
|
|
15
|
+
let rest = code;
|
|
16
|
+
while (rest.length > 0) {
|
|
17
|
+
const result = ParseParser(moduleProperties, parser, rest, context);
|
|
18
|
+
if (result.length === 0)
|
|
19
|
+
return [buffer, rest];
|
|
20
|
+
buffer.push(result[0]);
|
|
21
|
+
rest = result[1];
|
|
22
|
+
}
|
|
23
|
+
return [buffer, rest];
|
|
24
|
+
}
|
|
25
|
+
// ------------------------------------------------------------------
|
|
26
|
+
// Const
|
|
27
|
+
// ------------------------------------------------------------------
|
|
28
|
+
function ParseConst(value, code, context) {
|
|
29
|
+
return Token.Const(value, code);
|
|
30
|
+
}
|
|
31
|
+
// ------------------------------------------------------------------
|
|
32
|
+
// Ident
|
|
33
|
+
// ------------------------------------------------------------------
|
|
34
|
+
function ParseIdent(code, _context) {
|
|
35
|
+
return Token.Ident(code);
|
|
36
|
+
}
|
|
37
|
+
// ------------------------------------------------------------------
|
|
38
|
+
// Number
|
|
39
|
+
// ------------------------------------------------------------------
|
|
40
|
+
// prettier-ignore
|
|
41
|
+
function ParseNumber(code, _context) {
|
|
42
|
+
return Token.Number(code);
|
|
43
|
+
}
|
|
44
|
+
// ------------------------------------------------------------------
|
|
45
|
+
// Optional
|
|
46
|
+
// ------------------------------------------------------------------
|
|
47
|
+
function ParseOptional(moduleProperties, parser, code, context) {
|
|
48
|
+
const result = ParseParser(moduleProperties, parser, code, context);
|
|
49
|
+
return (result.length === 2 ? [[result[0]], result[1]] : [[], code]);
|
|
50
|
+
}
|
|
51
|
+
// ------------------------------------------------------------------
|
|
52
|
+
// Ref
|
|
53
|
+
// ------------------------------------------------------------------
|
|
54
|
+
function ParseRef(moduleProperties, ref, code, context) {
|
|
55
|
+
const parser = moduleProperties[ref];
|
|
56
|
+
if (!Guard.IsParser(parser))
|
|
57
|
+
throw Error(`Cannot dereference Parser '${ref}'`);
|
|
58
|
+
return ParseParser(moduleProperties, parser, code, context);
|
|
59
|
+
}
|
|
60
|
+
// ------------------------------------------------------------------
|
|
61
|
+
// String
|
|
62
|
+
// ------------------------------------------------------------------
|
|
63
|
+
// prettier-ignore
|
|
64
|
+
function ParseString(options, code, _context) {
|
|
65
|
+
return Token.String(options, code);
|
|
66
|
+
}
|
|
67
|
+
// ------------------------------------------------------------------
|
|
68
|
+
// Tuple
|
|
69
|
+
// ------------------------------------------------------------------
|
|
70
|
+
function ParseTuple(moduleProperties, parsers, code, context) {
|
|
71
|
+
const buffer = [];
|
|
72
|
+
let rest = code;
|
|
73
|
+
for (const parser of parsers) {
|
|
74
|
+
const result = ParseParser(moduleProperties, parser, rest, context);
|
|
75
|
+
if (result.length === 0)
|
|
76
|
+
return [];
|
|
77
|
+
buffer.push(result[0]);
|
|
78
|
+
rest = result[1];
|
|
79
|
+
}
|
|
80
|
+
return [buffer, rest];
|
|
81
|
+
}
|
|
82
|
+
// ------------------------------------------------------------------
|
|
83
|
+
// Union
|
|
84
|
+
// ------------------------------------------------------------------
|
|
85
|
+
// prettier-ignore
|
|
86
|
+
function ParseUnion(moduleProperties, parsers, code, context) {
|
|
87
|
+
for (const parser of parsers) {
|
|
88
|
+
const result = ParseParser(moduleProperties, parser, code, context);
|
|
89
|
+
if (result.length === 0)
|
|
90
|
+
continue;
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
// ------------------------------------------------------------------
|
|
96
|
+
// Parser
|
|
97
|
+
// ------------------------------------------------------------------
|
|
98
|
+
// prettier-ignore
|
|
99
|
+
function ParseParser(moduleProperties, parser, code, context) {
|
|
100
|
+
const result = (Guard.IsContext(parser) ? ParseContext(moduleProperties, parser.left, parser.right, code, context) :
|
|
101
|
+
Guard.IsArray(parser) ? ParseArray(moduleProperties, parser.parser, code, context) :
|
|
102
|
+
Guard.IsConst(parser) ? ParseConst(parser.value, code, context) :
|
|
103
|
+
Guard.IsIdent(parser) ? ParseIdent(code, context) :
|
|
104
|
+
Guard.IsNumber(parser) ? ParseNumber(code, context) :
|
|
105
|
+
Guard.IsOptional(parser) ? ParseOptional(moduleProperties, parser.parser, code, context) :
|
|
106
|
+
Guard.IsRef(parser) ? ParseRef(moduleProperties, parser.ref, code, context) :
|
|
107
|
+
Guard.IsString(parser) ? ParseString(parser.options, code, context) :
|
|
108
|
+
Guard.IsTuple(parser) ? ParseTuple(moduleProperties, parser.parsers, code, context) :
|
|
109
|
+
Guard.IsUnion(parser) ? ParseUnion(moduleProperties, parser.parsers, code, context) :
|
|
110
|
+
[]);
|
|
111
|
+
return (result.length === 2
|
|
112
|
+
? [parser.mapping(result[0], context), result[1]]
|
|
113
|
+
: result);
|
|
114
|
+
}
|
|
115
|
+
/** Parses content using the given parser */
|
|
116
|
+
// prettier-ignore
|
|
117
|
+
export function Parse(...args) {
|
|
118
|
+
const withModuleProperties = typeof args[1] === 'string' ? false : true;
|
|
119
|
+
const [moduleProperties, parser, content, context] = withModuleProperties
|
|
120
|
+
? [args[0], args[1], args[2], args[3]]
|
|
121
|
+
: [{}, args[0], args[1], args[2]];
|
|
122
|
+
return ParseParser(moduleProperties, parser, content, context);
|
|
123
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Takes the next constant string value skipping any whitespace */
|
|
2
|
+
export declare function Const(value: string, code: string): [] | [string, string];
|
|
3
|
+
/** Scans for the next Ident token */
|
|
4
|
+
export declare function Ident(code: string): [] | [string, string];
|
|
5
|
+
/** Scans for the next number token */
|
|
6
|
+
export declare function Number(code: string): [string, string] | [];
|
|
7
|
+
/** Scans the next Literal String value */
|
|
8
|
+
export declare function String(options: string[], code: string): [string, string] | [];
|