Search


Search something to see results

refine

Type Parameters

  • S extends Schema<any, unknown>

Parameters

  • name: string
  • refine: Object
  • Optionalmeta: unknown

Returns Object

import * as x from 'unhoax'

declare const isEmail: (input: string) => boolean

const refineAsEmail = x.refine('Email', isEmail)
const emailSchema = refineAsEmail(x.string) // Schema<string>

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

const emailSchema: Schema<string> = pipe(
x.string,
x.refine('Email', isEmail),
)

Type Parameters

Parameters

  • name: string
  • refine: Object
  • Optionalmeta: unknown

Returns Object

import * as x from 'unhoax'

declare const isEmail: (input: string) => boolean

const refineAsEmail = x.refine('Email', isEmail)
const emailSchema = refineAsEmail(x.string) // Schema<string>

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

const emailSchema: Schema<string> = pipe(
x.string,
x.refine('Email', isEmail),
)