Skip to main content
Module

x/indent_and_wrap/mod.ts>findCommonIndent

Finds and replaces common indent in text, and hard-wraps text.
Go to Latest
function findCommonIndent
import { findCommonIndent } from "https://deno.land/x/indent_and_wrap@v0.0.2/mod.ts";

Scan text string, and find leading space characters, that are common across all lines. If ignoreFirstIndent is set, then the leading space on the first line is not counted, so the provided text string can be trimmed. This function uses fast algorithm that avoids splitting text to lines array.

Parameters

text: string
optional
ignoreFirstIndent = [UNSUPPORTED]