2.0.5 • Published 2 months ago

@zerodep/address-zip v2.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@zerodep/address-zip

version language types license

CodeFactor Known Vulnerabilities

A parser to find where zip/postal codes (and US 5-digit extensions) are in a string.

Full documentation is available at the zerodep.app page.

NOTE: currently supports US and CA zip/postal codes

Examples

All @zerodep packages support both ESM and CJS.

import { addressZip } from '@zerodep/address-zip';
// or
const { addressZip } = require('@zerodep/address-zip');

Well Formatted Case

addressZip('1234 Main St, Los Angeles CA, US 90210-1234');
//  [
//    {
//      zip: '90210',
//      zipExt: '1234',
//      countryIso2s: ['US'],
//      source: '90210-1234',
//      ndx: 34,
//      length: 10,
//    },
//  ]

Canadian and American Codes

addressZip('12345 Main Street, Toronto ON, Canada M4A 3B6');
// [
//   {
//     zip: 'M4A 3B6',
//     countryIso2s: ['CA'],
//     source: 'M4A 3B6',
//     ndx: 38,
//     length: 7,
//   },
//   {
//     zip: '12345',
//     countryIso2s: ['US'],
//     source: '12345',
//     ndx: 0,
//     length: 5,
//   },
// ]
2.0.5

2 months ago

2.0.3

2 months ago

2.0.2

7 months ago

2.0.1

8 months ago

2.0.0

10 months ago