Skip to content

Interface: NormalizeWhitespaceOptions

Defined in: utils/string/normalizeWhitespace.ts:4

Options for normalizeWhitespace.

Properties

collapse?

optional collapse: boolean

Defined in: utils/string/normalizeWhitespace.ts:11

Whether to collapse multiple whitespace characters into a single space (or a single newline when line breaks are preserved).

Defaults to true.


trim?

optional trim: boolean

Defined in: utils/string/normalizeWhitespace.ts:21

Whether to trim leading and trailing whitespace.

  • When preserveLineBreaks is false, the whole string is trimmed.
  • When true, each line is trimmed individually.

Defaults to true.


preserveLineBreaks?

optional preserveLineBreaks: boolean

Defined in: utils/string/normalizeWhitespace.ts:31

Whether to preserve line breaks.

  • When false (default), all whitespace, including newlines, is collapsed to a single space.
  • When true, line breaks are kept but surrounding spaces are normalized.

Released under the MIT License.