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

BatchProcessingTestCasetype

A batch case in the package's JSON test files: several addresses and the counts expected.

Import it

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

Definition

interface BatchProcessingTestCase extends TestCaseBase {
    input: string[];
    expected: {
        results?: unknown[];
        statistics?: {
            total: number;
            successful: number;
            failed: number;
        };
        errors?: Array<{
            index: number;
            error: string;
        }>;
        [key: string]: unknown;
    };
}

Members

NameTypeDescription
inputstring[]
expected{ [key: string]: unknown; results?: unknown[]; statistics?: { total: number; successful: number; failed: number; }; errors?: Array<{ index: number; error: string; }>; }
name (optional)string | undefined
description (optional)string | undefined
options (optional)Record<string, unknown> | undefined

Examples

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

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

What it prints (run when this page was built)

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