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

ZIP_VALIDATION_PATTERNSconstant

The shape of something that could be a ZIP code.

Import it

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

Definition

const ZIP_VALIDATION_PATTERNS: { readonly POTENTIAL_ZIP: RegExp; } = {
    POTENTIAL_ZIP: /\b([A-Z0-9]{3,9}(?:[-\s][A-Z0-9]{1,4})?)\s*$/i,
} as const

Members

NameTypeDescription
POTENTIAL_ZIPRegExp

Examples

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

console.log(ZIP_VALIDATION_PATTERNS.POTENTIAL_ZIP.test("98101"));
// → 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.