typeguard-composer
TypeScript icon, indicating that this package has built-in type declarations

0.9.10 • Public • Published

typeguard-composer

CI 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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i typeguard-composer

      Weekly Downloads

      1

      Version

      0.9.10

      License

      MIT

      Unpacked Size

      18.5 kB

      Total Files

      55

      Last publish

      Collaborators

      • nonameprovided