Skip to the content

address-plusアドレスプラス

Parse, validate, format and compare addresses locally, add country modules and mount an optional native form field.

address-plus extends the parse-address style with typed results, validation, formatting and country modules. About the name

Contents

Reference · Parsing, formatting and shared types

BatchParseOptionstype

Options for the batch parsers: the parse options, plus whether to stop at the first error and whether to include the statistics.

Import it

import type { BatchParseOptions } from "@johnmorrisdotca/address-plus";

Definition

interface BatchParseOptions extends ParseOptions {
    stopOnError?: boolean;
    parallel?: boolean;
    chunkSize?: number;
    includeStats?: boolean;
}

Members

NameTypeDescription
stopOnError (optional)boolean | undefined
parallel (optional)boolean | undefined
chunkSize (optional)number | undefined
includeStats (optional)boolean | undefined
country (optional)"CA" | "US" | "JP" | "AU" | "GB" | "GY" | "IM" | "JE" | FrenchPostalCountry | "DE" | "GP" | "MQ" | "GF" | "RE" | "YT" | "auto" | undefined
countries (optional)readonly CountryModule[] | undefined
normalize (optional)boolean | undefined
validatePostalCode (optional)boolean | undefined
language (optional)"auto" | "en" | "fr" | undefined
extractFacilities (optional)boolean | undefined
parseParenthetical (optional)boolean | undefined
strict (optional)boolean | undefined
useSnakeCase (optional)boolean | undefined

Examples

import { parseLocationsBatch } from "@johnmorrisdotca/address-plus";
import type { BatchParseOptions } from "@johnmorrisdotca/address-plus";

console.log(parseLocationsBatch(["123 Main St, Anytown, NY 12345"], { country: "US" }).stats.total);
// → 1
1

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/address-plus 1.7.0.