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

AddressValidationTestCasetype

A validation case in the package's JSON test files: an address and the verdict and codes expected.

Import it

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

Definition

interface AddressValidationTestCase extends TestCaseBase {
    input: string;
    expected: {
        isValid: boolean;
        confidence?: number;
        completeness?: number;
        errors?: string[];
        warnings?: string[];
        [key: string]: unknown;
    };
}

Members

NameTypeDescription
inputstring
expected{ [key: string]: unknown; isValid: boolean; confidence?: number; completeness?: number; errors?: string[]; warnings?: string[]; }
name (optional)string | undefined
description (optional)string | undefined
options (optional)Record<string, unknown> | undefined

Examples

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

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

What it prints (run when this page was built)

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