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

Method loaddata

wxapp/miaoyouHome.js:180–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

178 }).catch((t) => this.logErr(t));
179 }
180 loaddata() {
181 if (!this.isNode()) return {};
182 {
183 this.fs = this.fs ? this.fs : require("fs");
184 this.path = this.path ? this.path : require("path");
185 const t = this.path.resolve(this.dataFile),
186 s = this.path.resolve(process.cwd(), this.dataFile),
187 e = this.fs.existsSync(t),
188 i = !e && this.fs.existsSync(s);
189 if (!e && !i) return {};
190 {
191 const i = e ? t : s;
192 try {
193 return JSON.parse(this.fs.readFileSync(i));
194 } catch (t) {
195 return {};
196 }
197 }
198 }
199 }
200 writedata() {
201 if (this.isNode()) {
202 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