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

Class

ruilanCar.js:160–508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159function Env(t, s) {
160 return new (class {
161 constructor(t, s) {
162 this.name = t;
163 this.data = null;
164 this.dataFile = "box.dat";
165 this.logs = [];
166 this.logSeparator = "\n";
167 this.startTime = new Date().getTime();
168 Object.assign(this, s);
169 this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`);
170 }
171 isNode() {
172 return "undefined" != typeof module && !!module.exports;
173 }
174 isQuanX() {
175 return "undefined" != typeof $task;
176 }
177 isSurge() {
178 return "undefined" != typeof $httpClient && "undefined" == typeof $loon;
179 }
180 isLoon() {
181 return "undefined" != typeof $loon;
182 }
183 loaddata() {
184 if (!this.isNode()) return {};
185 {
186 this.fs = this.fs ? this.fs : require("fs");
187 this.path = this.path ? this.path : require("path");
188 const t = this.path.resolve(this.dataFile),
189 s = this.path.resolve(process.cwd(), this.dataFile),
190 e = this.fs.existsSync(t),
191 i = !e && this.fs.existsSync(s);
192 if (!e && !i) return {};
193 {
194 const i = e ? t : s;
195 try {
196 return JSON.parse(this.fs.readFileSync(i));
197 } catch (t) {
198 return {};
199 }
200 }
201 }
202 }
203 writedata() {
204 if (this.isNode()) {
205 this.fs = this.fs ? this.fs : require("fs");
206 this.path = this.path ? this.path : require("path");
207 const t = this.path.resolve(this.dataFile),
208 s = this.path.resolve(process.cwd(), this.dataFile),
209 e = this.fs.existsSync(t),
210 i = !e && this.fs.existsSync(s),
211 o = JSON.stringify(this.data);
212 e ? this.writeFileSync(t, o) : i ? this.fs.writeFileSync(s, o) : this.fs.writeFileSync(t, o);
213 }
214 }
215 lodash_get(t, s, e) {
216 const i = s.replace(/\[(\d+)\]/g, ".$1").split(".");
217 let o = t;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected