Reference · Parsing, formatting and shared types
parseAddressfunction
Parses a street address. The same as parseLocation, kept under the name parse-address's users know.
Import it
import { parseAddress } from "@johnmorrisdotca/address-plus";
Definition
function parseAddress(address: string, options?: ParseOptions): ParsedAddress | null
Parameters
| Name | Type | Description |
|---|---|---|
address | string | The address as one string. |
options (optional) | ParseOptions | How to parse (see |
Returns
ParsedAddress | null
The parts found, or null when nothing can be read as an address.
Examples
import { parseAddress } from "@johnmorrisdotca/address-plus";
console.log(parseAddress("123 Main St Apt 4, Anytown, NY 12345")?.secUnitNum);
// → "4"4What it prints (run when this page was built)