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

Method loaddata

ruilanCar.js:183–202  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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");

Callers 2

getvalMethod · 0.45
setvalMethod · 0.45

Calls 1

isNodeMethod · 0.45

Tested by

no test coverage detected