Reference · Parsing, formatting and shared types
parseAddressesBatchfunction
Parses many street addresses with parseAddress, and reports which failed and how long it took.
Import it
import { parseAddressesBatch } from "@johnmorrisdotca/address-plus";
Definition
function parseAddressesBatch(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, and the counts and timing.
Examples
import { parseAddressesBatch } from "@johnmorrisdotca/address-plus";
console.log(parseAddressesBatch(["10 Main St, Anytown, NY 12345", "PO Box 12, Springfield, IL 62701"]).stats.successful);
// → 22What it prints (run when this page was built)