Reference · Parsing, formatting and shared types
parseFacilityfunction
Takes a facility's name (a building, a park, a hospital) off the start of an address.
Import it
import { parseFacility } from "@johnmorrisdotca/address-plus";
Definition
function parseFacility(text: string): { facility: string | undefined; remaining: string; }
Parameters
| Name | Type | Description |
|---|---|---|
text | string | The address text. |
Returns
{ facility: string | undefined; remaining: string; }
The facility (undefined when there is none) and the text that remains.
Examples
import { parseFacility } from "@johnmorrisdotca/address-plus";
console.log(parseFacility("Empire State Building, 350 5th Ave"));
// → {"facility":"Empire State Building","remaining":", 350 5th Ave"}{ facility: 'Empire State Building', remaining: ', 350 5th Ave' }What it prints (run when this page was built)