// package
indent-string
type: "module"
// preferences
// replacements (1)
snippet::indent-string
Simple or drop-in replacementThis package is no longer necessary. You can indent every non-empty line with `String.prototype.replace`, or use `/^/gm` to also indent empty lines, matching the package's `includeEmptyLines` option.
// example
const indentString = (
string,
count = 1,
indent = ' ',
) =>
string.replace(
/^(?!\s*$)/gm,
indent.repeat(count),
);