Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cityssm/civic-address-format
Formats a civic address from its pieces using Canada Post guidelines.
https://github.com/cityssm/civic-address-format
address-formatting civic-address property-address street-address
Last synced: 27 days ago
JSON representation
Formats a civic address from its pieces using Canada Post guidelines.
- Host: GitHub
- URL: https://github.com/cityssm/civic-address-format
- Owner: cityssm
- License: mit
- Created: 2023-02-14T14:35:54.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-15T12:03:43.000Z (over 1 year ago)
- Last Synced: 2024-11-27T14:47:04.317Z (about 1 month ago)
- Topics: address-formatting, civic-address, property-address, street-address
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@cityssm/civic-address-format
- Size: 392 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Civic Address Format
[![npm (scoped)](https://img.shields.io/npm/v/@cityssm/civic-address-format)](https://www.npmjs.com/package/@cityssm/civic-address-format)
[![DeepSource](https://app.deepsource.com/gh/cityssm/civic-address-format.svg/?label=active+issues&show_trend=true&token=TB7MABBKAv5oGVsF21nBBawJ)](https://app.deepsource.com/gh/cityssm/civic-address-format/)
[![Maintainability](https://api.codeclimate.com/v1/badges/fb7201564a832823e6c6/maintainability)](https://codeclimate.com/github/cityssm/civic-address-format/maintainability)
[![codecov](https://codecov.io/gh/cityssm/civic-address-format/branch/main/graph/badge.svg?token=JZX2EZXFPE)](https://codecov.io/gh/cityssm/civic-address-format)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/cityssm/civic-address-format/coverage.yml)](https://github.com/cityssm/civic-address-format/actions/workflows/coverage.yml)Formats a civic address from its pieces based on
[guidelines from Canada Post](https://www.canadapost-postescanada.ca/cpc/en/support/kb/addressing/accuracy/addressing-mail-accurately)
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
```sh
npm install @cityssm/civic-address-format
```## Usage
```javascript
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"
```