MCPcopy Create free account
hub / github.com/Effect-TS/effect / numberToJson

Function numberToJson

packages/effect/src/SchemaAST.ts:1457–1469  ·  view source on GitHub ↗
(checks: Checks | undefined)

Source from the content-addressed store, hash-verified

1455}
1456
1457function numberToJson(checks: Checks | undefined): Link {
1458 const encodedFinite = !checks
1459 ? finite
1460 : appendChecks(finite, checks)
1461
1462 return new Link(
1463 new Union([encodedFinite, nonFiniteLiterals], "anyOf"),
1464 new SchemaTransformation.Transformation(
1465 SchemaGetter.Number(),
1466 SchemaGetter.transform((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))
1467 )
1468 )
1469}
1470
1471/**
1472 * Provides the singleton {@link Number} AST instance.

Callers 1

toCodecJsonMethod · 0.85

Calls 2

appendChecksFunction · 0.70
transformMethod · 0.65

Tested by

no test coverage detected