Reference · Parsing, formatting and shared types
normalizeTextfunction
Lower-cases a string, turns its periods, commas and semicolons into spaces, folds runs of spaces to one and trims it: the form the parsers compare words in.
Import it
import { normalizeText } from "@johnmorrisdotca/address-plus";
Definition
function normalizeText(text: string): string
Parameters
| Name | Type | Description |
|---|---|---|
text | string | The text. |
Returns
string
The text in lower case, without that punctuation, with single spaces and none at either end.
Examples
import { normalizeText } from "@johnmorrisdotca/address-plus";
console.log(normalizeText(" 123 Main St "));
// → "123 main st"123 main stWhat it prints (run when this page was built)