function indentString
indentString(
string: string,
count?: number,
options?: { indent?: string; includeEmptyLines?: boolean; }
): string

Prepends count repetitions of indent (default: one space) to each non-empty line of string.

Examples

Example 1

import indentString from './lib/utils/indent-string.ts';
console.assert(indentString('hello\nworld', 2) === '  hello\n  world');

Parameters

string: string
optional
count: number = 1
optional
options: { indent?: string; includeEmptyLines?: boolean; }

Return Type

string

Usage

import indentString from "lib/utils/indent-string.ts";