fallback
fallback<T>(fallback: T): Object
Type Parameters
Parameters
fallback: T
Returns Object
Example
import * as x from 'unhoax'
const orString = x.fallback('not a number')
const schema = orString(x.number)
// or, using pipe
import pipe from 'just-pipe'
const schema = pipe(x.number, x.fallback('not a number'))
schema.parse(42) // { success: true, value: 42 }
schema.parse('toto') // { success: true, value: 'not a number' }
Built on top of recover