Skip to content

Commit

Permalink
šŸ› Make String.parseQuote(input) not fail on windows due to line endā€¦
Browse files Browse the repository at this point in the history
ā€¦ings
  • Loading branch information
skerit committed Feb 14, 2024
1 parent 20582e3 commit b876dee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,12 @@ defStat(function parseQuoted(input) {
input = input.replaceAll('"', '\\' + '"');
}

if (quote == '`' && input.includes('\n')) {
input = input.replaceAll('\n', '\\n');
if (quote == '`') {
if (input.includes('\r\n')) {
input = input.replaceAll('\r\n', '\\n');
} else if (input.includes('\n')) {
input = input.replaceAll('\n', '\\n');
}
}

input = '"' + input + '"';
Expand Down

0 comments on commit b876dee

Please sign in to comment.