joi-us-zipcode
v3.0.11
Published
Joi extension to validate USA zip codes
Downloads
129
Maintainers
Readme
joi-us-zipcode
Joi extension to validate USA zip codes.
The list of codes is copied from the source of https://github.com/davglass/zipcodes.
const BaseJoi = require('joi');
const Extension = require('joi-us-zipcode');
const Joi = BaseJoi.extend(Extension);
const schema = {
zip: Joi.string().usZipCode(),
};
const object = {
zip: '75001',
};
Joi.validate(schema, object);