Skip to the content

address-plusアドレスプラス

Parse, validate, format and compare addresses locally, add country modules and mount an optional native form field.

address-plus extends the parse-address style with typed results, validation, formatting and country modules. About the name

Contents

Reference · Parsing, formatting and shared types

cleanAddressDetailedfunction

Tidies an address like cleanAddress, and says what it changed.

Import it

import { cleanAddressDetailed } from "@johnmorrisdotca/address-plus";

Definition

function cleanAddressDetailed(addressString: string, options?: CleanAddressOptions): CleanAddressResult

Parameters

NameTypeDescription
addressStringstring

The address as typed.

options (optional)CleanAddressOptions

What to tidy and the letter case to set (see CleanAddressOptions).

Returns

CleanAddressResult

The tidied address, the input, whether anything changed, and a line for each change.

Examples

import { cleanAddressDetailed } from "@johnmorrisdotca/address-plus";

console.log(cleanAddressDetailed("742 evergreen terrace,springfield ,  il 62704").cleanedAddress);
// → "742 Evergreen Ter, Springfield IL 62704"
742 Evergreen Ter, Springfield IL 62704

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/address-plus 1.7.0.