(str)
| 292 | }; |
| 293 | |
| 294 | function parseJSON(str) { |
| 295 | const cleanStr = str.replace(/"(?:[^"\\]|\\.)*"|(\/\/.*|\/\*[\s\S]*?\*\/)|(,\s*(?=[\]}]))/g, (m, g1, g2) => (g1 || g2) ? "" : m); |
| 296 | return JSON.parse(cleanStr); |
| 297 | } |
| 298 | |
| 299 | // This is to support both CommonJS and ES module. |
| 300 | OpenCC.OpenCC = OpenCC; |