MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic /

Class

jlld.js:222–558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220// prettier-ignore
221function Env(t, s) {
222 return new (class {
223 constructor(t, s) {
224 this.name = t;
225 this.data = null;
226 this.dataFile = "box.dat";
227 this.logs = [];
228 this.logSeparator = "\n";
229 this.startTime = new Date().getTime();
230 Object.assign(this, s);
231 this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`);
232 }
233 isNode() {
234 return "undefined" != typeof module && !!module.exports;
235 }
236 isQuanX() {
237 return "undefined" != typeof $task;
238 }
239 isSurge() {
240 return "undefined" != typeof $httpClient && "undefined" == typeof $loon;
241 }
242 isLoon() {
243 return "undefined" != typeof $loon;
244 }
245 loaddata() {
246 if (!this.isNode()) return {};
247 {
248 this.fs = this.fs ? this.fs : require("fs");
249 this.path = this.path ? this.path : require("path");
250 const t = this.path.resolve(this.dataFile),
251 s = this.path.resolve(process.cwd(), this.dataFile),
252 e = this.fs.existsSync(t),
253 i = !e && this.fs.existsSync(s);
254 if (!e && !i) return {};
255 {
256 const i = e ? t : s;
257 try {
258 return JSON.parse(this.fs.readFileSync(i));
259 } catch (t) {
260 return {};
261 }
262 }
263 }
264 }
265 writedata() {
266 if (this.isNode()) {
267 this.fs = this.fs ? this.fs : require("fs");
268 this.path = this.path ? this.path : require("path");
269 const t = this.path.resolve(this.dataFile),
270 s = this.path.resolve(process.cwd(), this.dataFile),
271 e = this.fs.existsSync(t),
272 i = !e && this.fs.existsSync(s),
273 o = JSON.stringify(this.data);
274 e ? this.writeFileSync(t, o) : i ? this.fs.writeFileSync(s, o) : this.fs.writeFileSync(t, o);
275 }
276 }
277 lodash_get(t, s, e) {
278 const i = s.replace(/\[(\d+)\]/g, ".$1").split(".");
279 let o = t;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected