Skip to content

gunshi / combinators / number

Function: number()

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

Experimental

Create a number argument schema with optional range validation.

Accepts any numeric value (integer or float).

Parameters

ParameterTypeDescription
opts?NumberOptionsRange options.

Returns

CombinatorSchema<number>

A combinator schema that resolves to number.

Example

ts
const args = {
  timeout: number({ min: 0, max: 30000 })
}

Released under the MIT License.