1 | var escapable, filter;
|
2 |
|
3 | escapable = /[\x00-\x1f\ud800-\udfff\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufff0-\uffff]/g;
|
4 |
|
5 | filter = function(quoted) {
|
6 | escapable.lastIndex = 0;
|
7 | if (!escapable.test(quoted)) {
|
8 | return quoted;
|
9 | }
|
10 | return quoted.replace(escapable, function(a) {
|
11 | return "";
|
12 | });
|
13 | };
|
14 |
|
15 | module.exports = {
|
16 | json: function(obj) {
|
17 | return filter(JSON.stringify(obj));
|
18 | }
|
19 | };
|