New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

joi-postalcode

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi-postalcode

Joi extension for validating postal codes worldwide using postal-codes-js

latest
Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
820
1.61%
Maintainers
1
Weekly downloads
 
Created
Source

joi-postalcode

Joi extension for validating postal codes worldwide using postal-codes-js.

Versions

  • Version 1.X is for Joi < v14
  • Version 2.X (latest) is for Joi > v14

How to Use

Get the required packages:

npm install joi joi-postalcode

Create an extended instance of Joi, then specify the 2-letter ISO country code as a parameter to postalCode in your schema:

const Joi = require('joi')
const joiPostalCode = Joi.extend(require('joi-postalcode'))
joiPostalCode.string().postalCode('CA').validate('A1A 1A1') // Canada
joiPostalCode.string().postalCode('').validate('90210') // Default country is US
joiPostalCode.string().postalCode('TR').validate('33150') // Turkey

See List of postal codes for a list of postal code formats and supported countries.

Keywords

joi

FAQs

Package last updated on 08 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts