Reference · Parsing, formatting and shared types
ParsedIntersectiontype
What parseIntersection returns: two streets, each with its name, type and directionals, and the place.
Import it
import type { ParsedIntersection } from "@johnmorrisdotca/address-plus";
Definition
interface ParsedIntersection {
street1?: string;
type1?: string;
prefix1?: string;
suffix1?: string;
street2?: string;
type2?: string;
prefix2?: string;
suffix2?: string;
city?: string;
state?: string;
zip?: string;
plus4?: string;
country?: "CA" | "US";
postalValid?: boolean;
postalType?: "zip" | "postal";
}
Members
| Name | Type | Description |
|---|---|---|
street1 (optional) | string | undefined | |
type1 (optional) | string | undefined | |
prefix1 (optional) | string | undefined | |
suffix1 (optional) | string | undefined | |
street2 (optional) | string | undefined | |
type2 (optional) | string | undefined | |
prefix2 (optional) | string | undefined | |
suffix2 (optional) | string | undefined | |
city (optional) | string | undefined | |
state (optional) | string | undefined | |
zip (optional) | string | undefined | |
plus4 (optional) | string | undefined | |
country (optional) | "CA" | "US" | undefined | |
postalValid (optional) | boolean | undefined | |
postalType (optional) | "zip" | "postal" | undefined |
Examples
import { parseIntersection } from "@johnmorrisdotca/address-plus";
import type { ParsedIntersection } from "@johnmorrisdotca/address-plus";
console.log(parseIntersection("Hollywood Blvd and Vine St, Los Angeles, CA"));
// → {"state":"CA","city":"Los Angeles","street1":"Hollywood","type1":"Blvd","street2":"Vine","type2":"St"}{
state: 'CA',
city: 'Los Angeles',
street1: 'Hollywood',
type1: 'Blvd',
street2: 'Vine',
type2: 'St'
}What it prints (run when this page was built)