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

2.3.4 • Public • Published

@zerodep/address-country

version language types license

CodeFactor Known Vulnerabilities

A parser to find where a country name or abbreviation is in a string.

Full documentation is available at the zerodep.app page.

Examples

All @zerodep packages support both ESM and CJS.

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

Well Formatted Case

addressCountry('1234 Main Street, Los Angeles CA, America');
//  [
//    {
//      countryIso2: 'US',
//      source: 'America',
//      ndx: 34,
//      length: 7,
//    },
//  ]

With Check-in-Middle Flag Enabled

const CHECK_IN_MIDDLE = true;
addressCountry('1234 Main Street, Los Angeles CA, United States 90210', CHECK_IN_MIDDLE);
// [
//   {
//     countryIso2: 'US',
//     source: 'United States',
//     ndx: 34,
//     length: 13,
//   },
//   {
//     countryIso2: 'CA',
//     source: 'CA',
//     ndx: 30,
//     length: 2,
//   },
// ]

Readme

Keywords

Package Sidebar

Install

npm i @zerodep/address-country

Homepage

zerodep.app

Weekly Downloads

8

Version

2.3.4

License

MIT

Unpacked Size

25 kB

Total Files

7

Last publish

Collaborators

  • cdepage