Hyperlinkv0.8.0-beta.28

Schema

Schema.isIntfunctioneffect/Schema.ts:7515
(annotations?: Annotations.Filter): SchemaAST.Filter<number>

Validates that a number is a safe integer (within the safe integer range that can be exactly represented in JavaScript).

Details

JSON Schema:

This check corresponds to the type: "integer" constraint in JSON Schema.

Arbitrary:

When generating test data with fast-check, this applies an integer: true constraint to ensure generated numbers are integers.

Integer checks
Source effect/Schema.ts:751517 lines
export function isInt(annotations?: Annotations.Filter) {
  return makeFilter(
    (n: number) => globalThis.Number.isSafeInteger(n),
    {
      expected: "an integer",
      meta: {
        _tag: "isInt"
      },
      arbitrary: {
        constraint: {
          integer: true
        }
      },
      ...annotations
    }
  )
}
Referenced by 4 symbols