@zerodep/address-zip
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

@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,
//   },
// ]

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @zerodep/address-zip

      Homepage

      zerodep.app

      Weekly Downloads

      1

      Version

      2.0.5

      License

      MIT

      Unpacked Size

      7.6 kB

      Total Files

      7

      Last publish

      Collaborators

      • cdepage