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

normalizeStateProvinceNamefunction

The code of a US state or Canadian province written in full, in lower case.

Import it

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

Definition

function normalizeStateProvinceName(stateName: string): string | undefined

Parameters

NameTypeDescription
stateNamestring

The name in full, in English or French, any letter case.

Returns

string | undefined

The code in lower case, or undefined for a name that is not a state or province.

Examples

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

console.log(normalizeStateProvinceName("Nova Scotia"));
// → "ns"
ns

What it prints (run when this page was built)

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