(x)
| 73 | } |
| 74 | |
| 75 | function escapeJSONKey(x) { |
| 76 | if (/^[\d\w_]+$/.exec(x) || x[0] === '"' || x[0] === "'") return x; |
| 77 | assert(!x.includes("'"), 'cannot have internal single quotes in keys: ' + x); |
| 78 | return "'" + x + "'"; |
| 79 | } |
| 80 | |
| 81 | // JSON.stringify will completely omit function objects. This function is |
| 82 | // similar but preserves functions. |
no test coverage detected