Skip to content

Commit

Permalink
Revert "Improve partial indenting performance"
Browse files Browse the repository at this point in the history
This reverts commit 08fddee.

The change caused performance regressions in some cases and performance
was not consistent across engines.
  • Loading branch information
mohd-akram committed Sep 6, 2024
1 parent e914d60 commit 5605472
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/handlebars/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,15 @@ export function template(templateSpec, env) {
}
if (result != null) {
if (options.indent) {
result =
options.indent + result.replace(/\n(?!$)/g, '\n' + 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');
}
return result;
} else {
Expand Down

0 comments on commit 5605472

Please sign in to comment.