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

capitalizeWordsfunction

Capitalizes the first letter of each word.

Import it

import { capitalizeWords } from "@johnmorrisdotca/address-plus";

Definition

function capitalizeWords(text: string): string

Parameters

NameTypeDescription
textstring

The text.

Returns

string

The text with each word's first letter in capitals and the rest as written.

Examples

import { capitalizeWords } from "@johnmorrisdotca/address-plus";

console.log(capitalizeWords("new york city"));
// → "New York City"
New York City

What it prints (run when this page was built)

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