0.3.2 • Published 9 months ago

@pacote/validation v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@pacote/validation

version minified minified + gzip

The Validation<T, E> data type is a Result that accumulates multiple errors.

Installation

yarn add @pacote/validation

Example

import { validation, lift } from '@pacote/validation'
import { Ok, Err } from '@pacote/result'

const hasLetter = lift((s: string) =>
  s.match(/[a-z]/i) ? Ok(s) : Err('no letters')
)
const hasDigit = lift((s: string) =>
  s.match(/[0-9]/) ? Ok(s) : Err('no digits')
)

const validate = validation(hasLetter, hasDigit)

validate('-') // => Err(['no letters', 'no digits'])

License

MIT © Luís Rodrigues.

0.3.2

9 months ago

0.3.0

1 year ago

0.3.1

1 year ago

0.2.0

1 year ago

0.1.5

2 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago