| 843 | } |
| 844 | |
| 845 | return new class { |
| 846 | constructor(t, e) { |
| 847 | this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e) |
| 848 | } |
| 849 | |
| 850 | isNode() { |
| 851 | return "undefined" != typeof module && !!module.exports |
| 852 | } |
| 853 | |
| 854 | isQuanX() { |
| 855 | return "undefined" != typeof $task |
| 856 | } |
| 857 | |
| 858 | isSurge() { |
| 859 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon |
| 860 | } |
| 861 | |
| 862 | isLoon() { |
| 863 | return "undefined" != typeof $loon |
| 864 | } |
| 865 | |
| 866 | toObj(t, e = null) { |
| 867 | try { |
| 868 | return JSON.parse(t) |
| 869 | } catch { |
| 870 | return e |
| 871 | } |
| 872 | } |
| 873 | |
| 874 | toStr(t, e = null) { |
| 875 | try { |
| 876 | return JSON.stringify(t) |
| 877 | } catch { |
| 878 | return e |
| 879 | } |
| 880 | } |
| 881 | |
| 882 | getjson(t, e) { |
| 883 | let s = e; |
| 884 | const i = this.getdata(t); |
| 885 | if (i) try { |
| 886 | s = JSON.parse(this.getdata(t)) |
| 887 | } catch { |
| 888 | } |
| 889 | return s |
| 890 | } |
| 891 | |
| 892 | setjson(t, e) { |
| 893 | try { |
| 894 | return this.setdata(JSON.stringify(t), e) |
| 895 | } catch { |
| 896 | return !1 |
| 897 | } |
| 898 | } |
| 899 | |
| 900 | getScript(t) { |
| 901 | return new Promise(e => { |
| 902 | this.get({url: t}, (t, s, i) => e(i)) |
nothing calls this directly
no outgoing calls
no test coverage detected