Hyperlinkv0.8.0-beta.28

Schema

Schema.isFinitefunctioneffect/Schema.ts:7084
(annotations?: Annotations.Filter): SchemaAST.Filter<number>

Validates that a number is finite (not Infinity, -Infinity, or NaN).

Details

JSON Schema:

This check does not have a direct JSON Schema equivalent, but ensures the number is valid and finite.

Arbitrary:

When generating test data with fast-check, this applies noNaN: true and noInfinity: true constraints to ensure generated numbers are finite.

Number checks
Source effect/Schema.ts:708418 lines
export function isFinite(annotations?: Annotations.Filter) {
  return makeFilter(
    (n: number) => globalThis.Number.isFinite(n),
    {
      expected: "a finite number",
      meta: {
        _tag: "isFinite"
      },
      arbitrary: {
        constraint: {
          noInfinity: true,
          noNaN: true
        }
      },
      ...annotations
    }
  )
}
Referenced by 2 symbols