Skip to the content

address-plusアドレスプラス

Parse, validate, format and compare addresses locally, add country modules and mount an optional native form field.

address-plus extends the parse-address style with typed results, validation, formatting and country modules. About the name

Contents

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

NameTypeDescription
textstring

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 st

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/address-plus 1.7.0.