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

AddressComparisonTestCasetype

A comparison case in the package's JSON test files: two addresses and the match expected.

Import it

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

Definition

interface AddressComparisonTestCase extends TestCaseBase {
    input: {
        address1: string;
        address2: string;
    };
    expected: {
        isSame?: boolean;
        similarity?: number;
        differences?: string[];
        [key: string]: unknown;
    };
}

Members

NameTypeDescription
input{ address1: string; address2: string; }
expected{ [key: string]: unknown; isSame?: boolean; similarity?: number; differences?: string[]; }
name (optional)string | undefined
description (optional)string | undefined
options (optional)Record<string, unknown> | undefined

Examples

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

console.log(({ input: ["123 Main St", "123 Main Street"], expected: { isSame: true } }).expected.isSame);
// → true
true

What it prints (run when this page was built)

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