{"id":15523,"library":"australia-address-parser","title":"Australia Address Parser","description":"The `australia-address-parser` package offers a dedicated, regex-based utility for programmatically parsing Australian street addresses and street intersections from unstructured user-provided strings. Its core functionality involves dissecting an address into constituent parts such as street number, name, type, suburb, state, and postcode. A key differentiator is its ability to explicitly identify and return the street type (e.g., Road, Street, Avenue), a detail often generalized or omitted by more comprehensive mapping services like Google APIs. The package is currently at version 1.0.1, although its README indicates it is still under active development, suggesting that its API might evolve, and new features or refinements to its parsing logic could be introduced with a potentially frequent release cadence. It's suitable for applications requiring structured address data extraction, data validation, or enhancing geo-coding efforts by providing more granular address components for Australian locations.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/gordonlkc/australia-address-parser","tags":["javascript","australia","address","parser"],"install":[{"cmd":"npm install australia-address-parser","lang":"bash","label":"npm"},{"cmd":"yarn add australia-address-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add australia-address-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package is designed for CommonJS environments in Node.js. Direct ESM import (`import ... from '...'`) without a transpilation step or a CommonJS wrapper will result in an error in pure ESM projects.","wrong":"import parser from 'australia-address-parser';","symbol":"parser","correct":"const parser = require('australia-address-parser');"},{"note":"When used directly in a browser environment by including `auAddressParser.min.js` via a `<script>` tag, the parsing functions become available under the global `auAddressParser` object.","symbol":"auAddressParser","correct":"// The 'auAddressParser' global object is available after loading auAddressParser.min.js via a script tag."}],"quickstart":{"code":"const parser = require('australia-address-parser');\n\n// Example 1: Standard Street Address\nconst standardAddress = '1 Darling Island Road, Pyrmont NSW 2009';\nconst parsedStandard = parser.parseLocation(standardAddress);\nconsole.log('Standard Address:', parsedStandard);\n/* Output:\n{\n  streetNumber: '1',\n  streetName: 'Darling Island',\n  streetType: 'Road',\n  suburb: 'Pyrmont',\n  state: 'NSW',\n  postcode: '2009'\n}*/\n\n// Example 2: Intersection of Roads\nconst intersectionAddress = 'Breakfast Creek Rd & Austin St, Newstead QLD 4006';\nconst parsedIntersection = parser.parseLocation(intersectionAddress);\nconsole.log('Intersection Address:', parsedIntersection);\n/* Output:\n{\n  streetName1: 'Breakfast Creek',\n  streetType1: 'Rd',\n  streetName2: 'Austin',\n  streetType2: 'St',\n  suburb: 'Newstead',\n  state: 'QLD',\n  postcode: '4006',\n  streetName: 'Breakfast Creek Rd & Austin St'\n}*/\n\n// Example 3: Address with Unit Number\nconst unitAddress = '13A Burlina Cct, Elizabeth Hills NSW 2171';\nconst parsedUnit = parser.parseLocation(unitAddress);\nconsole.log('Unit Address:', parsedUnit);\n/* Output:\n{\n  unitType: 'unit',\n  unitNumber: 'A',\n  streetName: 'Burlina',\n  streetType: 'Cct',\n  suburb: 'Elizabeth Hills',\n  state: 'NSW',\n  postcode: '2171'\n}*/","lang":"javascript","description":"Demonstrates how to parse various Australian address formats (standard, intersection, with unit) using the `parseLocation` method."},"warnings":[{"fix":"Monitor the GitHub repository for updates and test thoroughly after package upgrades. Consider locking to a specific patch version if stability is critical.","message":"Despite being at version 1.0.1, the project's README explicitly states it is 'currently in development'. This indicates that the API or parsing logic may undergo significant changes, potentially introducing breaking changes without major version increments.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Validate parsing results against a diverse set of real-world addresses. Consider pre-processing addresses to normalize common patterns if parsing failures are observed.","message":"As a regex-based parser, `australia-address-parser` might not cover all possible address variations or ambiguous cases found in real-world Australian addresses. Edge cases or unconventional formatting could lead to incorrect or incomplete parsing results.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Create a `declarations.d.ts` file with `declare module 'australia-address-parser';` or a more specific definition for `parseLocation` to provide basic type safety.","message":"The package does not provide TypeScript type definitions, meaning TypeScript projects will need to declare modules or use `@ts-ignore` to import it without type errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"If working in a pure ESM Node.js environment, consider using a tool like `createRequire` from the `module` module, or using a build step to transpile CommonJS to ESM. For browser use, ensure the `auAddressParser.min.js` script is loaded via a `<script>` tag.","cause":"Attempting to use `require()` in an ECMAScript Module (ESM) context without proper configuration or a bundler that transpiles CommonJS.","error":"ReferenceError: require is not defined"},{"fix":"Ensure you are using `const parser = require('australia-address-parser');` for Node.js CommonJS. In a browser, verify that `auAddressParser.min.js` is loaded and you are calling `auAddressParser.parseLocation(...)`.","cause":"The default export of the package was not correctly imported or accessed, or the global object in the browser was not loaded.","error":"TypeError: parser.parseLocation is not a function"},{"fix":"Review the input address string for unusual formatting. Consult the package's GitHub issues for similar reports or consider contributing improvements to its regex patterns for better coverage.","cause":"The regex-based parser failed to correctly interpret an address string due to an unsupported format, ambiguity, or missing patterns.","error":"Output object is missing expected fields or contains incorrect values after parsing."}],"ecosystem":"npm"}