@cityssm/civic-address-format
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Civic Address Format

npm (scoped) Codacy Badge Maintainability codecov GitHub Workflow Status

Formats a civic address from its pieces based on guidelines from Canada Post for properly addressing mail to Canadian and American addresses.

Features

  • Typescript support.
  • Places the unit number (when present) before the civic number with a hyphen in between.
  • Uses no space when a single letter qualifier is present (i.e. '123A'), or one space for longer qualifiers (i.e. '123 1/2')

Installation

npm install @cityssm/civic-address-format

Usage

import { formatCivicAddress } from '@cityssm/civic-address-format'

formatCivicAddress({
  civicNumber: '99',
  streetName: 'Foster Dr'
})
// => "99 Foster Dr"

formatCivicAddress({
  civicNumber: '123',
  streetName: 'MAIN ST NW',
  unitNumber: '10',
  qualifier: '1/2'
})
// => "10-123 1/2 MAIN ST NW"

Package Sidebar

Install

npm i @cityssm/civic-address-format

Weekly Downloads

3

Version

0.1.0

License

MIT

Unpacked Size

13.6 kB

Total Files

9

Last publish

Collaborators

  • dgowans