0.9.0 • Published 2 years ago

@normed/refinements v0.9.0

Weekly downloads
1
License
MIT
Repository
gitlab
Last release
2 years ago

Refinements

Guard unknown data with refinement calls. Typescript compatible.

This is a typescript compatible full pass composable refinement module, based on the premise that a refinement function is of the form <T>(path: Array<string>, v: mixed): T | RefinementError.

Here the unknown value v is refined to the type T. If the refinement fails a RefinementError is returned. The path argument is used to provide a better contextual understanding of where a refinement error occurred.

Refinement functions are commonly called via the provided attemptRefine or useRefine functions. attemptRefine is of the form <T>(RefinementFunction<T>, path: Array<string>, v: any, fallback: T) => T, while useRefine is of the form <T>(RefinementFunction<T>) => (path: Array<string>, v: any) => T

Standard refinement functions and refinement utility functions are provided.

Development

  • yarn run build

  • yarn run format

  • yarn run publish

0.9.0

2 years ago

0.8.0

3 years ago

0.7.0

4 years ago

0.6.5

4 years ago

0.6.4

4 years ago

0.6.3

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago