NumberProvides the singleton Number AST instance.
When to use
Use when you need the canonical SchemaAST node for schemas that accept any
JavaScript number value.
Source effect/SchemaAST.ts:14191 lines
export const const number: Numberconst number: {
_tag: 'Number';
getParser: () => SchemaParser.Parser;
matchKey: (s: string, options: ParseOptions) => number | undefined;
matchPart: (s: string, options: ParseOptions) => number | undefined;
_match: (regexp: RegExp, s: string, options: ParseOptions) => number | undefined;
toCodecJson: () => AST;
toCodecStringTree: () => AST;
getExpected: () => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
Provides the singleton
Number
AST instance.
When to use
Use when you need the canonical SchemaAST node for schemas that accept any
JavaScript number value.
number = new constructor Number(annotations?: Schema.Annotations.Annotations | undefined, checks?: Checks | undefined, encoding?: Encoding | undefined, context?: Context | undefined): NumberAST node matching any number value (including NaN, Infinity,
-Infinity).
Details
Default JSON serialization:
- Finite numbers are serialized as JSON numbers.
Infinity, -Infinity, and NaN are serialized as JSON strings.
If the node has an isFinite or isInt check, the string fallback is
skipped since non-finite values cannot occur.
Number()Referenced by 1 symbols