Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/simple_utility/src/text.ts>trimExtend

Useful snippet collection.
Go to Latest
function trimExtend
import { trimExtend } from "https://deno.land/x/simple_utility@v1.4.0/src/text.ts";

Trim head and tail blank, remove CR and consecutive space (tab, LF) to single space (tab, LF).

Examples

Example 1

const text = "  Lorem ipsum\r dolor   sit  \r\r amet. ";
const format = trimExtend(text);

Parameters

data: string

Returns

string