Skip to content

Check if a country has/uses postal codes โ€“ ISO 3166-1 ๐Ÿ‘Œ๐Ÿป

License

Notifications You must be signed in to change notification settings

angelcustodio/has-postalcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

has-postalcode

version status size downloads

Check if a country has (or uses) postal codes or not. Zero dependencies. Simple as that.

It's ISO 3166-1 compliant so you can use 2-3 characters/numeric country code or standarized english name. Standarization can be found in ISO OBP.

The package basically checks a list of no-postalcode countries. When checking for a country that is on the list, the returned value will be false. In case of checking for a country that is not included in the list it will return true. For non-compliant values with ISO 3166-1, it will return undefined.

Installation

$ npm install has-postalcode

How to use it

import hasPostalCode from 'has-postalcode'

hasPostalCode(772) // false
hasPostalCode('TK') // false
hasPostalCode('TKL') // false
hasPostalCode('Tokelau') // false

hasPostalCode('Spain') // true
hasPostalCode('Espaรฑita') // undefined
hasPostalCode('๐Ÿ’ฉ') // undefined

License

has-postalcode is released by Angel Custodio under MIT License

About

Check if a country has/uses postal codes โ€“ ISO 3166-1 ๐Ÿ‘Œ๐Ÿป

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published