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 · Form-associated address field

AddressFieldOptionstype

Full native settings and a private callback; raw addresses never enter public events.

Import it

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

Also exported from: @johnmorrisdotca/address-plus/element/define

Definition

interface AddressFieldOptions {
    parse?: ParseOptions;
    validation?: ValidationOptions;
    strings?: Partial<(typeof FIELD_WORDS)["en"]>;
    onChange?: (field: AddressField) => void;
}

Members

NameTypeDescription
parse (optional)ParseOptions | undefined
validation (optional)ValidationOptions | undefined
strings (optional)Partial<{ address: string; required: string; valid: string; invalid: string; error: string; findings: string; }> | undefined
onChange (optional)((field: AddressField) => void) | undefined

Examples

import { ADDRESS_FIELD_PARSE_KEYS } from "@johnmorrisdotca/address-plus/element";
import type { AddressFieldOptions } from "@johnmorrisdotca/address-plus/element";

console.log(ADDRESS_FIELD_PARSE_KEYS.includes("countries"));
// → 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.