{"id":13736,"library":"parse-address","title":"US Street Address Parser","description":"This package, `parse-address`, currently at version 1.1.2, provides a JavaScript port of the Perl Geo::StreetAddress::US module for parsing US street addresses. It is designed to be highly forgiving and robust, using a regex-based approach to extract components like street number, prefix, street name, type, city, state, and ZIP code from various user-provided address strings. Key features include handling directional prefixes and suffixes, fractional building numbers, building units, grid-based addresses, and both 5 and 9-digit ZIP codes, along with all official USPS abbreviations for street types and state names. The package's release cadence appears to be infrequent, with the last significant version jump (1.0.0) occurring after a long period. Its core differentiator is its direct port from a proven Perl library, emphasizing fault tolerance in parsing diverse address formats prevalent in the United States.","status":"active","version":"1.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/hassansin/parse-address","tags":["javascript","extract","address","parser","street","US","Geo::StreetAddress::US","geo"],"install":[{"cmd":"npm install parse-address","lang":"bash","label":"npm"},{"cmd":"yarn add parse-address","lang":"bash","label":"yarn"},{"cmd":"pnpm add parse-address","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The library is primarily a CommonJS module. The `require` call returns the main parser object.","wrong":"import parser from 'parse-address';","symbol":"parser","correct":"const parser = require('parse-address');"},{"note":"Direct named ESM imports will fail as the package does not provide explicit named exports for ESM consumers. The `parseLocation` method is accessed via the default exported parser object.","wrong":"import { parseLocation } from 'parse-address';","symbol":"parseLocation","correct":"const { parseLocation } = require('parse-address'); // If using object destructuring, requires the 'parser' object to be assigned first, then destructure if module.exports is an object with named keys.\n// More robust: const parser = require('parse-address'); const parsed = parser.parseLocation(...);"},{"note":"When included directly in the browser via a script tag, the library exposes a global `parseAddress` object.","symbol":"parseAddress (browser global)","correct":"<script type=\"text/javascript\" src=\"./node_modules/parse-address/parse-address.min.js\"></script>\n<script>\n  var parsed = parseAddress.parseLocation('1005 N Gravenstein Highway Sebastopol CA 95472');\n</script>"}],"quickstart":{"code":"const parser = require('parse-address');\n\nconst addressString = '1005 N Gravenstein Highway Sebastopol CA 95472';\nconst parsedAddress = parser.parseLocation(addressString);\n\nconsole.log('Original Address:', addressString);\nconsole.log('Parsed Address:', parsedAddress);\n\n// Example of another address type\nconst intersectionString = 'Main St & First Ave, Anytown CA';\nconst parsedIntersection = parser.parseLocation(intersectionString);\nconsole.log('Parsed Intersection:', parsedIntersection);\n\n// Demonstrating robustness with a less formal address\nconst informalAddress = '456 w Elm apt 3B, New York, NY 10001';\nconst parsedInformal = parser.parseLocation(informalAddress);\nconsole.log('Parsed Informal Address:', parsedInformal);","lang":"javascript","description":"Demonstrates how to import the parser and use `parseLocation` to extract components from US street addresses, including common and informal formats."},"warnings":[{"fix":"Use `const parser = require('parse-address');` for Node.js environments. For browser usage, include `parse-address.min.js` directly via a script tag.","message":"The `parse-address` package is a CommonJS (CJS) module and does not provide an official ES Module (ESM) entry point. Attempting to use `import ... from 'parse-address'` in an ESM context or a bundler configured for ESM may lead to import errors or unexpected behavior.","severity":"breaking","affected_versions":">=0.0.1"},{"fix":"Consider creating a `parse-address.d.ts` file in your project with `declare module 'parse-address' { ... }` or check for `@types/parse-address` on npm.","message":"This package does not ship with official TypeScript type definitions. Developers using TypeScript will need to create their own declaration files (`.d.ts`) or rely on community-provided types if available (e.g., `@types/parse-address`).","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Review parsing results for a representative set of addresses after upgrading to v1.x to ensure consistency with expected output.","message":"The transition to v1.0.0 implemented a 'normalizer' feature, which, while intended to improve parsing, might subtly alter the output structure or parsed values for certain edge cases compared to pre-1.0.0 versions. Always test thoroughly when upgrading.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':119 '1.1.2':13 '5':86 '9':88 'abbrevi':97 'address':3,9,29,65,83,143,152 'along':92 'appear':109 'approach':44 'base':43,82 'build':76,78 'cadenc':108 'citi':55 'code':59,91 'compon':47 'core':126 'current':10 'design':32 'differenti':127 'digit':89 'direct':71,130 'divers':142 'emphas':137 'extract':46,151 'fault':138 'featur':68 'forgiv':36 'format':144 'fraction':75 'geo':21,156,159 'grid':81 'grid-bas':80 'handl':70 'high':35 'includ':69 'infrequ':112 'javascript':16,150 'jump':118 'key':67 'last':115 'librari':136 'like':48 'long':123 'modul':24 'name':53,103 'number':50,77 'occur':120 'offici':95 'packag':6,105 'pars':8,26,141 'parse-address':7 'parser':4,153 'period':124 'perl':20,135 'port':17,131 'prefix':51,72 'preval':145 'proven':134 'provid':14,64 'regex':42 'regex-bas':41 'releas':107 'robust':38 'signific':116 'state':56,102,149 'street':2,28,49,52,99,154 'streetaddress':22,157 'string':66 'suffix':74 'toler':139 'type':54,100 'unit':79,148 'us':1,23,27,155,158 'use':39 'user':63 'user-provid':62 'usp':96 'various':61 'version':12,117 'zip':58,90","created_at":"2026-04-20T01:56:02.470144+00:00","updated_at":"2026-04-20T01:56:02.470144+00:00","problems":[{"fix":"Ensure you are using `const parser = require('parse-address');` in your JavaScript/TypeScript files, especially in Node.js or when configuring bundlers to correctly handle CommonJS modules. If using `import`, try `import * as parser from 'parse-address';` (though this might still have issues depending on bundler config).","cause":"This error typically occurs when a bundler (like Webpack or Rollup) tries to interpret a CommonJS `module.exports = { ... }` as an ESM `default` export, and then an incorrect named import is used, or the default export is not handled correctly.","error":"TypeError: parse_address__WEBPACK_IMPORTED_MODULE_0__ is not a function (or similar 'is not a function' error)"},{"fix":"Use the CommonJS `require` syntax: `const parser = require('parse-address');` and then access `parser.parseLocation(...)`.","cause":"Attempting to use a named ESM import (`import { parseLocation } from 'parse-address';`) for a package that only provides a CommonJS default export (an object containing `parseLocation`).","error":"SyntaxError: Named export 'parseLocation' not found. The requested module 'parse-address' does not provide an export named 'parseLocation'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.1.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/hassansin/parse-address","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/parse-address","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}