function trim
trim(text: string): string

Trims the whitespace from the beginning and the end. This is an alias for .trim(). Useful for when you're mapping over lists.

Examples

Example 1

trim(null); // "" trim(" HELLO WORLD \n"); // "HELLO WORLD" [' hello ', ' world '].map(trim); // ['hello', 'world'];

Parameters

text: string

Return Type

string

Usage

import { trim } from ".";