Socket
Socket
Sign inDemoInstall

@zerodep/address-state

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zerodep/address-state

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


Version published
Maintainers
0
Created
Source

@zerodep/address-country

version language types license

CodeFactor Known Vulnerabilities

A parser to find where a state 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 { addressState } from '@zerodep/address-state';
// or
const { addressState } = require('@zerodep/address-state');

Well Formatted Case

// American address
addressState('1234 Main Street, Los Angeles California, 90210');
//  [
//    {
//      stateAbbr: 'CA',
//      source: 'California',
//      ndx: 30,
//      length: 10
//    },
//  ]

// Canadian address
addressState('13375 rue rita pierrefonds quebec h8z1j3');
// [
//   {
//     "stateAbbr": "QC",
//     "source": "quebec",
//     "ndx": 27,
//     "length": 6
//   }
// ]

With Multiple Results

addressCountry('#4 Washington Street, Portland OR 97603');
// [
//   {
//     "stateAbbr": "OR",
//     "source": "OR",
//     "ndx": 31,
//     "length": 2
//   },
//   {
//     "stateAbbr": "WA",
//     "source": "Washington",
//     "ndx": 3,
//     "length": 10
//   }
// ]

Successful Case - Mixed Countries

addressState('1234 oregon street, toronto ont');
// [
//   {
//     "stateAbbr": "ON",
//     "source": "ont",
//     "ndx": 28,
//     "length": 3
//   },
//   {
//     "stateAbbr": "OR",
//     "source": "oregon",
//     "ndx": 5,
//     "length": 6
//   }
// ]

Keywords

FAQs

Package last updated on 23 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc