npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

flow-runtime-validators

0.17.0

@codemix

npmHomeRepoSnykSocket
Downloads:855
$ npm install flow-runtime-validators
DailyWeeklyMonthlyYearly

flow-runtime-validators

Common validators for use with flow-runtime.

See the docs at https://codemix.github.io/flow-runtime/#/flow-runtime-validators

Installation

npm install flow-runtime-validators

or

yarn add flow-runtime-validators

Usage

import t from 'flow-runtime';
import * as validators from 'flow-runtime-validators';

type EmailAddress = string;

EmailAddress.addConstraint(
  validators.length({max: 250}),
  validators.email()
);

EmailAddress.assert("foo@example.com"); // ok
EmailAddress.assert("nope.com"); // throws