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

TestCaseBasetype

The fields every case in the package's JSON test files has: a name or description, the input, what is expected and the options. Exported for tools that read those files.

Import it

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

Definition

interface TestCaseBase {
    name?: string;
    description?: string;
    input: unknown;
    expected: unknown;
    options?: Record<string, unknown>;
}

Members

NameTypeDescription
name (optional)string | undefined
description (optional)string | undefined
inputunknown
expectedunknown
options (optional)Record<string, unknown> | undefined

Examples

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

console.log(({ name: "a ZIP code", input: "98101", expected: "WA" }).expected);
// → "WA"
WA

What it prints (run when this page was built)

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