looksSpanishfunction
Whether an address is surely Spanish, with no hint: it ends with Spain, España or ES, or its last line is a postcode
of five digits (the first two 01 to 52) and a place while a part of the address begins with a Spanish street's type
(Calle, C/, Avenida, Paseo, Plaza) or is an Apartado de Correos, and no state's code stands before the
postcode.
Import it
import { looksSpanish } from "@johnmorrisdotca/address-plus/es";
Definition
function looksSpanish(text: string): boolean
Parameters
| Name | Type | Description |
|---|---|---|
text | string | The address as one string. |
Returns
boolean
true when the address is Spanish beyond doubt, false otherwise.
Examples
import { looksSpanish } from "@johnmorrisdotca/address-plus/es";
console.log([looksSpanish("Calle Mayor 5, 28013 Madrid"), looksSpanish("Calle Ocho, Miami, FL 33135")]);
// → [true,false][ true, false ]What it prints (run when this page was built)