Const
import * as S from "@effect/schema/Schema"
const is = S.is(S.JsonNumber)
assert.deepStrictEqual(is(42), true)
assert.deepStrictEqual(is(Number.NaN), false)
assert.deepStrictEqual(is(Number.POSITIVE_INFINITY), false)
assert.deepStrictEqual(is(Number.NEGATIVE_INFINITY), false)
1.0.0
The
JsonNumber
is a schema for representing JSON numbers. It ensures that the provided value is a valid number by filtering outNaN
and(+/-) Infinity
. This is useful when you want to validate and represent numbers in JSON format.