Skip to content

Latest commit

 

History

History
44 lines (25 loc) · 869 Bytes

File metadata and controls

44 lines (25 loc) · 869 Bytes

ts-humanize v1.0.0


ts-humanize / formatSentence

Function: formatSentence()

formatSentence(sentence, options?): string

Defined in: formatting/strings.ts:135

Formats a sentence by capitalizing the first word (or all words if capitalizeAllWords is true), removing extra spaces, and normalizing words to lowercase unless specified in the preserve list.

Parameters

sentence

string

The sentence to format.

options?

FormatSentenceOpts

Formatting options.

Returns

string

The formatted sentence.

Examples

formatSentence("  hElLo   wOrLD  "); // "Hello world"
formatSentence("API HTTP Response", { preserve: ["HTTP"] }); // "Api HTTP response"