Search


Search something to see results

min

Type Parameters

  • T extends {}

Parameters

  • min: T
  • reason: string = ...

Returns Object

import * as x from 'unhoax'

// works with dates
const refineNowOrAfter = x.min(new Date(), 'now or after')
const dateNowOrAfter = refineNowOrAfter(x.date)

// works with numbers
const refineAsPositiveOrZero = x.min(0, 'PositiveOrZero')
const positiveOrZero = refineAsPositiveZero(x.number)

// or, using pipe
import pipe from 'just-pipe'

const positiveOrZeroNumber = pipe(
x.number,
x.min(0, 'PositiveOrZero'),
) // Schema<number>