Reference · Parsing, formatting and shared types
parseLocationsBatchfunction
Parses many addresses with parseLocation, and reports which failed and how long it took. A failure is recorded and
the batch goes on, unless options.stopOnError is set.
Import it
import { parseLocationsBatch } from "@johnmorrisdotca/address-plus";
Definition
function parseLocationsBatch(addresses: string[], options?: BatchParseOptions): BatchParseResult<ParsedAddress>
Parameters
| Name | Type | Description |
|---|---|---|
addresses | string[] | The addresses, one string each. |
options (optional) | BatchParseOptions | undefined | How to parse, plus the batch settings (see |
Returns
BatchParseResult<ParsedAddress>
The results in order (null for a failure), the errors with their index and input, and the counts and
timing.
Examples
import { parseLocationsBatch } from "@johnmorrisdotca/address-plus";
console.log(parseLocationsBatch(["100 Queen St W, Toronto, ON M5H 2N2", "", "大阪府大阪市北区梅田3-1-1"]).stats.successful);
// → 22What it prints (run when this page was built)