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

AddressParsertype

The shape of the default export: the four parsers parse-address's users call on one object.

Import it

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

Definition

interface AddressParser {
    parseAddress(address: string, options?: ParseOptions): ParsedAddress | null;
    parseInformalAddress(address: string, options?: ParseOptions): ParsedAddress | null;
    parseIntersection(address: string, options?: ParseOptions): ParsedIntersection | null;
    parseLocation(address: string, options?: ParseOptions): ParsedAddress | null;
}

Members

NameTypeDescription
parseAddress(address: string, options?: ParseOptions): ParsedAddress | null
parseInformalAddress(address: string, options?: ParseOptions): ParsedAddress | null
parseIntersection(address: string, options?: ParseOptions): ParsedIntersection | null
parseLocation(address: string, options?: ParseOptions): ParsedAddress | null

Examples

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

console.log(Object.keys(parser));
// → ["parseLocation","parseIntersection","parseInformalAddress","parseAddress"]
[
  'parseLocation',
  'parseIntersection',
  'parseInformalAddress',
  'parseAddress'
]

What it prints (run when this page was built)

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