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
| Name | Type | Description |
|---|---|---|
address | string | 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"));
// → truetrueWhat it prints (run when this page was built)