MCPcopy Index your code
hub / github.com/nodejs/node / removeBackslashes

Function removeBackslashes

lib/internal/mime.js:88–106  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

86const QUOTED_VALUE_PATTERN = /^(?:([\\]$)|[\\][\s\S]|[^"])*(?:(")|$)/u;
87
88function removeBackslashes(str) {
89 let ret = '';
90 // We stop at str.length - 1 because we want to look ahead one character.
91 let i;
92 for (i = 0; i < str.length - 1; i++) {
93 const c = str[i];
94 if (c === '\\') {
95 i++;
96 ret += str[i];
97 } else {
98 ret += c;
99 }
100 }
101 // We add the last character if we didn't skip to it.
102 if (i === str.length - 1) {
103 ret += str[i];
104 }
105 return ret;
106}
107
108
109function escapeQuoteOrSolidus(str) {

Callers 1

#parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected