joi-country-extension

A Joi extension for validation of ISO 3166-1 alpha-2 country codes

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
joi-country-extension
731.2.04 years ago5 years agoMinified + gzip package size for joi-country-extension in KB

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