Skip to content

Commit

Permalink
Minor performance improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 10, 2021
1 parent b637183 commit 4676273
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function trimNewlines(string) {
start++;
}

while (end > 0 && (string[end - 1] === '\r' || string[end - 1] === '\n')) {
while (end > start && (string[end - 1] === '\r' || string[end - 1] === '\n')) {
end--;
}

Expand Down

0 comments on commit 4676273

Please sign in to comment.