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

CleanAddressTestCasetype

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

Import it

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

Definition

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

Members

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

Examples

import type { CleanAddressTestCase } 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.