MCPcopy Create free account
hub / github.com/Semporia/Scripts / loaddata

Method loaddata

jd_goodMorning.js:245–261  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

243 }).catch(t => this.logErr(t))
244 }
245 loaddata() {
246 if (!this.isNode()) return {}; {
247 this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
248 const t = this.path.resolve(this.dataFile),
249 e = this.path.resolve(process.cwd(), this.dataFile),
250 s = this.fs.existsSync(t),
251 i = !s && this.fs.existsSync(e);
252 if (!s && !i) return {}; {
253 const i = s ? t : e;
254 try {
255 return JSON.parse(this.fs.readFileSync(i))
256 } catch (t) {
257 return {}
258 }
259 }
260 }
261 }
262 writedata() {
263 if (this.isNode()) {
264 this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");

Callers 2

getvalMethod · 0.45
setvalMethod · 0.45

Calls 1

isNodeMethod · 0.45

Tested by

no test coverage detected