Skip to content

International zipcodes validator based on Regex for Node.js and the browser.

License

Notifications You must be signed in to change notification settings

sarcadass/i18n-zipcodes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

53 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

i18n-zipcodes Build Status codecov

International zipcodes validator in Javascript, based on Regex for Node.js and the browser.

Install

For Node.js:

$ npm install i18n-zipcodes

For the browser:

  • Download the script in the dist folder

Usage

i18nZipcodes(countryCode: string, zipCode: string): boolean
// countryCode param is case insensitive

For Node.js

// CommonJS Syntax
const i18nZipcodes = require('i18n-zipcodes');
// or ES Syntax
import i18nZipcodes from 'i18n-zipcodes';

i18nZipcodes('US', '90210'); // true

i18nZipcodes('fr', '5632'); // false

For the browser

<script src="i18n-zipcodes.min.js"></script>
<script>
    console.log(i18nZipcodes('fr', '75014')); // true
</script>

115 Countries supported

Country codes use the ISO 3166-1 format.

A

  • ๐Ÿ‡ฆ๐Ÿ‡ฉ (AD) Andorra
  • ๐Ÿ‡ฆ๐Ÿ‡ฒ (AM) Armenia
  • ๐Ÿ‡ฆ๐Ÿ‡ท (AR) Argentina
  • ๐Ÿ‡ฆ๐Ÿ‡ธ (AS) American Samoa
  • ๐Ÿ‡ฆ๐Ÿ‡น (AT) Austria
  • ๐Ÿ‡ฆ๐Ÿ‡บ (AU) Australia
  • ๐Ÿ‡ฆ๐Ÿ‡ฟ (AZ) Azerbaijan

B

  • ๐Ÿ‡ง๐Ÿ‡ฆ (BA) Bosnia and Herzegovina
  • ๐Ÿ‡ง๐Ÿ‡ฉ (BD) Bangladesh
  • ๐Ÿ‡ง๐Ÿ‡ช (BE) Belgium
  • ๐Ÿ‡ง๐Ÿ‡ฌ (BG) Bulgaria
  • ๐Ÿ‡ง๐Ÿ‡ฏ (BJ) Benin
  • ๐Ÿ‡ง๐Ÿ‡ฒ (BM) Bermuda
  • ๐Ÿ‡ง๐Ÿ‡ณ (BN) Brunei
  • ๐Ÿ‡ง๐Ÿ‡ท (BR) Brazil
  • ๐Ÿ‡ง๐Ÿ‡พ (BY) Belarus

C

  • ๐Ÿ‡จ๐Ÿ‡ฆ (CA) Canada
  • ๐Ÿ‡จ๐Ÿ‡ญ (CH) Switzerland
  • ๐Ÿ‡จ๐Ÿ‡ณ (CN) China
  • ๐Ÿ‡จ๐Ÿ‡บ (CU) Cuba
  • ๐Ÿ‡จ๐Ÿ‡ฝ (CX) Christmas Island
  • ๐Ÿ‡จ๐Ÿ‡พ (CY) Cyprus
  • ๐Ÿ‡จ๐Ÿ‡ฟ (CZ) Czechia

D

  • ๐Ÿ‡ฉ๐Ÿ‡ช (DE) Germany
  • ๐Ÿ‡ฉ๐Ÿ‡ฐ (DK) Denmark
  • ๐Ÿ‡ฉ๐Ÿ‡ฟ (DZ) Algeria

E

  • ๐Ÿ‡ช๐Ÿ‡ช (EE) Estonia
  • ๐Ÿ‡ช๐Ÿ‡ธ (ES) Spain

F

  • ๐Ÿ‡ซ๐Ÿ‡ฎ (FI) Finland
  • ๐Ÿ‡ซ๐Ÿ‡ฒ (FM) Micronesia
  • ๐Ÿ‡ซ๐Ÿ‡ด (FO) Faroe Islands
  • ๐Ÿ‡ซ๐Ÿ‡ท (FR) France

G

  • ๐Ÿ‡ฌ๐Ÿ‡ช (GE) Georgia
  • ๐Ÿ‡ฌ๐Ÿ‡ซ (GF) French Guiana
  • ๐Ÿ‡ฌ๐Ÿ‡ฑ (GL) Greenland
  • ๐Ÿ‡ฌ๐Ÿ‡ต (GP) Guadeloupe
  • ๐Ÿ‡ฌ๐Ÿ‡ท (GR) Greece
  • ๐Ÿ‡ฌ๐Ÿ‡น (GT) Guatemala
  • ๐Ÿ‡ฌ๐Ÿ‡บ (GU) Guam
  • ๐Ÿ‡ฌ๐Ÿ‡ผ (GW) Guinea-Bissau

H

  • ๐Ÿ‡ญ๐Ÿ‡ท (HR) Croatia
  • ๐Ÿ‡ญ๐Ÿ‡บ (HU) Hungary

I

  • ๐Ÿ‡ฎ๐Ÿ‡จ (IC) Canary Islands
  • ๐Ÿ‡ฎ๐Ÿ‡ฉ (ID) Indonesia
  • ๐Ÿ‡ฎ๐Ÿ‡ช (IE) Ireland
  • ๐Ÿ‡ฎ๐Ÿ‡ฑ (IL) Israel
  • ๐Ÿ‡ฎ๐Ÿ‡ณ (IN) Inde
  • ๐Ÿ‡ฎ๐Ÿ‡ธ (IS) Iceland
  • ๐Ÿ‡ฎ๐Ÿ‡น (IT) Italy

J

  • ๐Ÿ‡ฏ๐Ÿ‡ต (JP) Japan

K

  • ๐Ÿ‡ฐ๐Ÿ‡ช (KE) Kenya
  • ๐Ÿ‡ฐ๐Ÿ‡ฌ (KG) Kyrgyzstan
  • ๐Ÿ‡ฐ๐Ÿ‡ท (KR) South Korea
  • ๐Ÿ‡ฐ๐Ÿ‡ผ (KW) Kuwait
  • ๐Ÿ‡ฐ๐Ÿ‡ฟ (KZ) Kazakhstan

L

  • ๐Ÿ‡ฑ๐Ÿ‡ฎ (LI) Liechtenstein
  • ๐Ÿ‡ฑ๐Ÿ‡น (LT) Lithuania
  • ๐Ÿ‡ฑ๐Ÿ‡บ (LU) Luxembourg
  • ๐Ÿ‡ฑ๐Ÿ‡ป (LV) Latvia

M

  • ๐Ÿ‡ฒ๐Ÿ‡ฆ (MA) Morocco
  • ๐Ÿ‡ฒ๐Ÿ‡ฉ (MD) Moldova
  • ๐Ÿ‡ฒ๐Ÿ‡ช (ME) Montenegro
  • ๐Ÿ‡ฒ๐Ÿ‡ฌ (MG) Madagascar
  • ๐Ÿ‡ฒ๐Ÿ‡ญ (MH) Marshall Islands
  • ๐Ÿ‡ฒ๐Ÿ‡ฐ (MK) North Macedonia
  • ๐Ÿ‡ฒ๐Ÿ‡ฒ (MM) Myanmar
  • ๐Ÿ‡ฒ๐Ÿ‡ณ (MN) Mongolia
  • ๐Ÿ‡ฒ๐Ÿ‡ต (MP) Northern Mariana Islands
  • ๐Ÿ‡ฒ๐Ÿ‡ถ (MQ) Martinique
  • ๐Ÿ‡ฒ๐Ÿ‡น (MT) Malta
  • ๐Ÿ‡ฒ๐Ÿ‡ป (MV) Maldives
  • ๐Ÿ‡ฒ๐Ÿ‡ฝ (MX) Mexico
  • ๐Ÿ‡ฒ๐Ÿ‡พ (MY) Malaysia
  • ๐Ÿ‡ฒ๐Ÿ‡ฟ (MZ) Mozambique

N

  • ๐Ÿ‡ณ๐Ÿ‡ฑ (NL) Netherlands
  • ๐Ÿ‡ณ๐Ÿ‡ด (NO) Norway
  • ๐Ÿ‡ณ๐Ÿ‡ฟ (NZ) New Zealand

P

  • ๐Ÿ‡ต๐Ÿ‡ญ (PH) Philippines
  • ๐Ÿ‡ต๐Ÿ‡ฐ (PK) Pakistan
  • ๐Ÿ‡ต๐Ÿ‡ฑ (PL) Poland
  • ๐Ÿ‡ซ๐Ÿ‡ท (PM) Saint Pierre and Miquelon
  • ๐Ÿ‡ต๐Ÿ‡ท (PR) Puerto Rico
  • ๐Ÿ‡ต๐Ÿ‡ธ (PS) Palestine
  • ๐Ÿ‡ต๐Ÿ‡น (PT) Portugal
  • ๐Ÿ‡ต๐Ÿ‡ผ (PW) Palau

R

  • ๐Ÿ‡ท๐Ÿ‡ช (RE) Rรฉunion
  • ๐Ÿ‡ท๐Ÿ‡ด (RO) Romania
  • ๐Ÿ‡ท๐Ÿ‡ธ (RS) Serbia
  • ๐Ÿ‡ท๐Ÿ‡บ (RU) Russian Federation

S

  • ๐Ÿ‡ธ๐Ÿ‡ฆ (SA) Saudi Arabia
  • ๐Ÿ‡ธ๐Ÿ‡ฉ (SD) Sudan
  • ๐Ÿ‡ธ๐Ÿ‡ช (SE) Sweden
  • ๐Ÿ‡ธ๐Ÿ‡ฌ (SG) Singapore
  • ๐Ÿ‡ธ๐Ÿ‡ฎ (SI) Slovenia
  • ๐Ÿ‡ธ๐Ÿ‡ฐ (SK) Slovakia
  • ๐Ÿ‡ธ๐Ÿ‡ฒ (SM) San Marino
  • ๐Ÿ‡ธ๐Ÿ‡ฟ (SZ) Swaziland

T

  • ๐Ÿ‡น๐Ÿ‡ญ (TH) Thailand
  • ๐Ÿ‡น๐Ÿ‡ฏ (TJ) Tajikistan
  • ๐Ÿ‡น๐Ÿ‡ฒ (TM) Turkmenistan
  • ๐Ÿ‡น๐Ÿ‡ณ (TN) Tunisia
  • ๐Ÿ‡น๐Ÿ‡ท (TR) Turkey
  • ๐Ÿ‡น๐Ÿ‡ผ (TW) Taiwan

U

  • ๐Ÿ‡บ๐Ÿ‡ฆ (UA) Ukraine
  • ๐Ÿ‡ฌ๐Ÿ‡ง (UK) United Kingdom
  • ๐Ÿ‡บ๐Ÿ‡ธ (US) United States of America
  • ๐Ÿ‡บ๐Ÿ‡พ (UY) Uruguay
  • ๐Ÿ‡บ๐Ÿ‡ฟ (UZ) Uzbekistan

V

  • ๐Ÿ‡ป๐Ÿ‡ช (VE) Venezuela
  • ๐Ÿ‡ป๐Ÿ‡ฎ (VI) Virgin Islands (U.S.)
  • ๐Ÿ‡ป๐Ÿ‡ณ (VN) Viet Nam

X

  • ๐Ÿ‡ฝ๐Ÿ‡ฐ (XK) Kosovo

Y

  • (YU) Yugoslavia

Z

  • ๐Ÿ‡ฟ๐Ÿ‡ฆ (ZA) South Africa
  • ๐Ÿ‡ฟ๐Ÿ‡ฒ (ZM) Zambia

About

International zipcodes validator based on Regex for Node.js and the browser.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published