Helpers for intl. postal codes.
npm install postal-code-helpersLightweight helpers for working with international postal code data to extract, validate or locate postal codes based on GeoNames data.
```
npm i postal-code-helpers
`javascript`
import postalCodeHelpers from 'postal-code-helpers';
`javascript
postalCodeHelpers.extract('this is a postal code 10999', 'DE');
// ['10999']
postalCodeHelpers.extract('this .10247, is a r23412345341 postal code 10999', 'DE');
// ['10247', '10999']
postalCodeHelpers.extract('this is a post code 1099921342345 inside a 1024 string', 'DE');
// null
`
Validates a postal codes against the country pattern. Attention: This validation does not check whether a postal code actually exists!
`javascript
postalCodeHelpers.validate('10999', 'DE');
// true
postalCodeHelpers.validate('1234', 'DE');
// false
`
`javascript
postalCodeHelpers.locate('SE1 6DR');
// [ 'GB' ]
postalCodeHelpers.locate('this is not a postal code');
// null
``
AD, AL, AM, AR, AS, AT, AU, AX, AZ, BA, BB, BD, BE, BG, BH, BL, BM, BN, BR, BY, CA, CH, CL, CN, CO, CS, CR, CU, CV, CX, CY, CZ, DE, DK, DO, DZ, EC, EE, EG, ES, ET, FI, FM, FO, FR, GB, GE, GF, GG, GL, GP, GR, GT, GU, GW, HN, HR, HT, HU, ID, IE, IL, IM, IN, IQ, IR, IS, IT, JE, JO, JP, KE, KG, KH, KP, KR, KW, KZ, LA, LB, LI, LK, LR, LS, LT, LU, LV, MA, MC, MD, ME, MF, MG, MH, MK, MM, MN, MP, MQ, MT, MV, MW, MX, MY, MZ, NC, NE, NF, NG, NI, NL, NO, NP, NZ, OM, PF, PG, PH, PK, PL, PM, PR, PT, PW, PY, RE, RO, RS, RU, SA, SD, SE, SG, SH, SI, SJ, SK, SM, SN, SO, SV, SZ, TC, TH, TJ, TM, TN, TR, TW, UA, US, UY, UZ, VA, VE, VI, VN, WF, YT, ZA, ZM