Improve partial indenting performance

This commit is contained in:
Mohamed Akram
2023-09-04 20:15:55 +04:00
committed by Jay Linski
parent 4512766919
commit 08fddee033
+2 -9
View File
@@ -96,15 +96,8 @@ export function template(templateSpec, env) {
}
if (result != null) {
if (options.indent) {
let lines = result.split('\n');
for (let i = 0, l = lines.length; i < l; i++) {
if (!lines[i] && i + 1 === l) {
break;
}
lines[i] = options.indent + lines[i];
}
result = lines.join('\n');
result =
options.indent + result.replace(/\n(?!$)/g, '\n' + options.indent);
}
return result;
} else {