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
| Name | Type | Description |
|---|---|---|
stateName | string | 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"nsWhat it prints (run when this page was built)