10 lines
228 B
JavaScript
10 lines
228 B
JavaScript
|
|
function indent(text, spaces) {
|
||
|
|
let indentText = "";
|
||
|
|
for (let i = 0; i < spaces; ++i) {
|
||
|
|
indentText += " ";
|
||
|
|
}
|
||
|
|
|
||
|
|
return text.replace(new RegExp("\r?\n", "gm"), "\n" + indentText);
|
||
|
|
}
|
||
|
|
|
||
|
|
module.exports = indent;
|