joi-country-extension
v1.2.0
Published
A Joi extension for validation of ISO 3166-1 alpha-2 country codes
Downloads
1,734
Readme
Joi Country Extension
A Joi extension for validation of ISO 3166-1 alpha-2 country codes.
Installation
npm install --save joi-country-extension
Usage
const BaseJoi = require('joi')
const JoiCountryExtension = require('joi-country-extension')
const Joi = BaseJoi.extend(JoiCountryExtension)
const schema = Joi.string().country()
const result = await schema.validate('gb')
console.log(result) // GB