Skip to content

Elizabeth-Warren/extra-validation

Repository files navigation

extra-validation

Validate form fields with special rules.

$ npm install @ewarren/extra-validation

WARNING: It is recommended to load this package asynchronously given the relatively large dataset (>150kb) that has to be loaded.

import('@ewarren/extra-validation').then(module => ...);

Real US Zipcode Validation

Covers all US states, territories and armed forces zip codes. Zip codes were imported from https://www.npmjs.com/package/zipcodes.

import { isRealZipcode } from '@ewarren/extra-validation';

isRealZipcode(10010) // true
isRealZipcode('10010') // true
isRealZipcode('10042') // false

Email Domain Recommendation

Check if the domain of an email input is likely meant to be something else. Common email domain providers pulled from the most common domains on the elizabeth warren email list.

import { checkEmailDomain } from '@ewarren/extra-validation';

checkEmailDomain('[email protected]') // null
checkEmailDomain('[email protected]') // gmail.com
checkEmailDomain('[email protected]') // gmail.com
checkEmailDomain('ewarren') // null

Local Development

# All commands require Docker

# Run test suite
$ make tests

# Build the library
$ make build-lib

# Build the data file
$ build-data

About

Validate form inputs with special rules ✍

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published