Skip to content

gunshi / combinators / float

Function: float()

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

Experimental

Create a floating-point argument schema with optional range validation.

Rejects NaN and Infinity values.

Parameters

ParameterTypeDescription
opts?FloatOptionsRange options.

Returns

CombinatorSchema<number>

A combinator schema that resolves to number (float).

Example

ts
const args = {
  ratio: float({ min: 0, max: 1 })
}

Released under the MIT License.