MCPcopy Create free account
hub / github.com/6dylan6/jdm / jsonParse

Method jsonParse

function/common.js:56–77  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

54 this.options.headers.cookie = cookie
55 }
56 jsonParse(str) {
57 try {
58 return JSON.parse(str);
59 } catch (e) {
60 try {
61 let data = this.match([/try\s*\{\w+\s*\(([^\)]+)/, /\w+\s*\(([^\)]+)/], str)
62 return JSON.parse(data);
63 } catch (ee) {
64 try {
65 let cb = this.match(/try\s*\{\s*(\w+)/, str)
66 if (cb) {
67 let func = "";
68 let data = str.replace(cb, `func=`)
69 eval(data);
70 return func
71 }
72 } catch (eee) {
73 return str
74 }
75 }
76 }
77 }
78 curl(params, extra = '') {
79 if (typeof(params) != 'object') {
80 params = {

Callers 1

curlMethod · 0.95

Calls 1

matchMethod · 0.95

Tested by

no test coverage detected