@ewarren/extra-validation

0.1.1 • Public • Published

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('ewarren@gmail.com') // null
checkEmailDomain('ewarren@gmai.com') // gmail.com
checkEmailDomain('EWARREN@GMAI.COM') // 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

Readme

Keywords

none

Package Sidebar

Install

npm i @ewarren/extra-validation

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

161 kB

Total Files

15

Last publish

Collaborators

  • itsjoekent
  • jschultz21
  • jjandoc