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

AddressFormattingTestCasetype

A formatting case in the package's JSON test files: an address and the text expected.

Import it

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

Definition

interface AddressFormattingTestCase extends TestCaseBase {
    input: string;
    expected: string;
    options?: {
        format?: string;
        abbreviate?: boolean;
        [key: string]: unknown;
    };
}

Members

NameTypeDescription
inputstring
expectedstring
options (optional){ [key: string]: unknown; format?: string; abbreviate?: boolean; } | undefined
name (optional)string | undefined
description (optional)string | undefined

Examples

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

console.log(({ input: "123 main st", expected: "123 Main St" }).expected);
// → "123 Main St"
123 Main St

What it prints (run when this page was built)

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