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 3, 2023
1 parent e497a35 commit e94c228
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/handlebars/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,7 @@ 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 e94c228

Please sign in to comment.