MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / parseJSON

Function parseJSON

node/opencc.js:294–297  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

292};
293
294function 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.
300OpenCC.OpenCC = OpenCC;

Callers 2

opencc.jsFile · 0.85
test.jsFile · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected