Australia Address Parser

1.0.1 · active · verified Tue Apr 21

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.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to parse various Australian address formats (standard, intersection, with unit) using the `parseLocation` method.

const parser = require('australia-address-parser');

// Example 1: Standard Street Address
const standardAddress = '1 Darling Island Road, Pyrmont NSW 2009';
const parsedStandard = parser.parseLocation(standardAddress);
console.log('Standard Address:', parsedStandard);
/* Output:
{
  streetNumber: '1',
  streetName: 'Darling Island',
  streetType: 'Road',
  suburb: 'Pyrmont',
  state: 'NSW',
  postcode: '2009'
}*/

// Example 2: Intersection of Roads
const intersectionAddress = 'Breakfast Creek Rd & Austin St, Newstead QLD 4006';
const parsedIntersection = parser.parseLocation(intersectionAddress);
console.log('Intersection Address:', parsedIntersection);
/* Output:
{
  streetName1: 'Breakfast Creek',
  streetType1: 'Rd',
  streetName2: 'Austin',
  streetType2: 'St',
  suburb: 'Newstead',
  state: 'QLD',
  postcode: '4006',
  streetName: 'Breakfast Creek Rd & Austin St'
}*/

// Example 3: Address with Unit Number
const unitAddress = '13A Burlina Cct, Elizabeth Hills NSW 2171';
const parsedUnit = parser.parseLocation(unitAddress);
console.log('Unit Address:', parsedUnit);
/* Output:
{
  unitType: 'unit',
  unitNumber: 'A',
  streetName: 'Burlina',
  streetType: 'Cct',
  suburb: 'Elizabeth Hills',
  state: 'NSW',
  postcode: '2171'
}*/

view raw JSON →