Reference · Parsing, formatting and shared types
parseParentheticalfunction
Takes words in parentheses out of an address, such as (Rear Entrance).
Import it
import { parseParenthetical } from "@johnmorrisdotca/address-plus";
Definition
function parseParenthetical(text: string): { secondary: string | undefined; remaining: string; }
Parameters
| Name | Type | Description |
|---|---|---|
text | string | The address text. |
Returns
{ secondary: string | undefined; remaining: string; }
The words in the parentheses (undefined when there are none) and the text without them.
Examples
import { parseParenthetical } from "@johnmorrisdotca/address-plus";
console.log(parseParenthetical("123 Main St (Rear Entrance)"));
// → {"secondary":"Rear Entrance","remaining":"123 Main St"}{ secondary: 'Rear Entrance', remaining: '123 Main St' }What it prints (run when this page was built)