Reference · Parsing, formatting and shared types
parseAddressesfunction
Parses many street addresses with parseAddress, in order.
Import it
import { parseAddresses } from "@johnmorrisdotca/address-plus";
Definition
function parseAddresses(addresses: string[], options?: ParseOptions): (ParsedAddress | null)[]
Parameters
| Name | Type | Description |
|---|---|---|
addresses | string[] | The addresses, one string each. |
options (optional) | ParseOptions | undefined | How to parse every one of them (see |
Returns
(ParsedAddress | null)[]
One result per address, in the same order, null where an address could not be read.
Examples
import { parseAddresses } from "@johnmorrisdotca/address-plus";
console.log(parseAddresses(["10 Main St, Anytown, NY 12345", "PO Box 12, Springfield, IL 62701"]).map((one) => one?.city));
// → ["Anytown","Springfield"][ 'Anytown', 'Springfield' ]What it prints (run when this page was built)