Skip to content

gunshi / combinators / integer

Function: integer()

ts
function integer(opts?): CombinatorSchema<number>;

Experimental

Create an integer argument schema with optional range validation.

Only accepts integer values (no decimals).

Parameters

ParameterTypeDescription
opts?IntegerOptionsRange options.

Returns

CombinatorSchema<number>

A combinator schema that resolves to number (integer).

Example

ts
const args = {
  retries: integer({ min: 0, max: 10 })
}

Released under the MIT License.