GraphReFlyTS

API Reference

normalizeWhitespace()

Collapse repeated whitespace and trim the ends.

Import

import { normalizeWhitespace } from "@graphrefly/ts/solutions/reactive-layout";

Signature

function normalizeWhitespace(text: string): string

Parameters

ParameterTypeDescription
textstringText to normalize.

Returns

A whitespace-normalized string.

Example

normalizeWhitespace("  hello   world  ");

Source

packages/ts/src/solutions/reactive-layout/segment.ts