NeXTSTEP Programming Mastermind

npm

Need private packages and team management tools?Check out npm Orgs. »

typeguard-composer

0.9.9 • Public • Published

typeguard-composer Build Status codecov

Performant and composable type guards for runtime data validation.

import { validate } from 'typeguard-composer';
import { isString, isNumber } from 'typeguard-composer/validators';
import { AddressSchema } from './address.schema';
 
const PersonSchema = {
  name: isString,
  age: isNumber,
  addresses: [AddressSchema]
}
 
validate(PersonSchema, { name: 'Test Elek', age: 18, addresses: []});

Install

To install run npm i typeguard-composer.

Built in validators

This libary inculdes validators for the basic primitives only. You can (soon) use the typeguard-composer-validators package to match against various other types.

License

MIT Licensed

install

npm i typeguard-composer

Downloadsweekly downloads

18

version

0.9.9

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability