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 authored and jaylinski committed Sep 7, 2023
1 parent cf5c0be commit 53a5f13
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 @@ -93,15 +93,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 53a5f13

Please sign in to comment.