Reference · Parsing, formatting and shared types
parseLocationsfunction
Parses many addresses with parseLocation, in order.
Import it
import { parseLocations } from "@johnmorrisdotca/address-plus";
Definition
function parseLocations(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: the parts, or null where an address could not be read.
Examples
import { parseLocations } from "@johnmorrisdotca/address-plus";
console.log(parseLocations(["100 Queen St W, Toronto, ON M5H 2N2", "大阪府大阪市北区梅田3-1-1"]).map((one) => one?.country));
// → ["CA","JP"][ 'CA', 'JP' ]What it prints (run when this page was built)