We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 43b6eb3 + 4a249ab commit 4c97cecCopy full SHA for 4c97cec
src/Prelude.js
@@ -227,7 +227,27 @@ exports.showCharImpl = function (c) {
227
};
228
229
exports.showStringImpl = function (s) {
230
- return JSON.stringify(s);
+ var l = s.length;
231
+ return "\"" + s.replace(
232
+ /[\0-\x1F\x7F"\\]/g,
233
+ function (c, i) { // jshint ignore:line
234
+ switch (c) {
235
+ case "\"":
236
+ case "\\":
237
+ return "\\" + c;
238
+ case "\a": return "\\a";
239
+ case "\b": return "\\b";
240
+ case "\f": return "\\f";
241
+ case "\n": return "\\n";
242
+ case "\r": return "\\r";
243
+ case "\t": return "\\t";
244
+ case "\v": return "\\v";
245
+ }
246
+ var k = i + 1;
247
+ var empty = k < l && s[k] >= "0" && s[k] <= "9" ? "\\&" : "";
248
+ return "\\" + c.charCodeAt(0).toString(10) + empty;
249
250
+ ) + "\"";
251
252
253
exports.showArrayImpl = function (f) {
0 commit comments