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

hasValidAddressComponentsfunction

Whether a string looks like an address at all: a number and a street, a PO box, a postal code or another recognised part.

Import it

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

Definition

function hasValidAddressComponents(address: string): boolean

Parameters

NameTypeDescription
addressstring

The text to look at.

Returns

boolean

true when it holds something an address is made of.

Examples

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

console.log(hasValidAddressComponents("123 Main St, Anytown, NY 12345"));
// → 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.