max<T extends {}>(max: T, reason?: string): Object
max: T
reason: string = ...
import * as x from 'unhoax'// works with datesconst refineNowOrBefore = x.max(new Date(), 'now or before')const dateNowOrBefore = refineNowOrBefore(x.date)// works with numbersconst refineAsNegativeOrZero = x.max(0, 'Negative or zero')const negativeOrZero = refineAsNegativeOrZero(x.number)// or, using pipeimport pipe from 'just-pipe'const negativeNumber = pipe( x.number, x.max(0, 'NegativeOrZero'),) // Schema<number> Copy
import * as x from 'unhoax'// works with datesconst refineNowOrBefore = x.max(new Date(), 'now or before')const dateNowOrBefore = refineNowOrBefore(x.date)// works with numbersconst refineAsNegativeOrZero = x.max(0, 'Negative or zero')const negativeOrZero = refineAsNegativeOrZero(x.number)// or, using pipeimport pipe from 'just-pipe'const negativeNumber = pipe( x.number, x.max(0, 'NegativeOrZero'),) // Schema<number>
Example