2.1.1 • Published 9 months ago

predicatory v2.1.1

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

predicatory

Zero dependency type-safe user defined type guard factory.

Install

$ npm i predicatory

or

$ yarn add predicatory

How to use

import { guard } from 'predicatory'

// this inferred `(value: unknown) => value is string`
export const isString = guard((value, never) =>
  typeof value === 'string' ? value : never,
)

// this inferred `(value: any) => value is number`
export const isNumber = guard(Number)

License

MIT

2.1.1

9 months ago

2.1.0

10 months ago

2.0.1

10 months ago

2.0.0

11 months ago

1.0.0

1 year ago