Skip to content

Commit

Permalink
Improve partial indenting performance
Browse files Browse the repository at this point in the history
  • Loading branch information
mohd-akram committed Sep 4, 2023
1 parent e497a35 commit ad65a01
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/handlebars/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ad65a01

Please sign in to comment.