MCPcopy Create free account
hub / github.com/6dylan6/jdpro / loaddata

Method loaddata

function/sendNotify.js:2331–2350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2329 }).catch((t) => this.logErr(t));
2330 }
2331 loaddata() {
2332 if (!this.isNode())
2333 return {}; {
2334 (this.fs = this.fs ? this.fs : require('fs')),
2335 (this.path = this.path ? this.path : require('path'));
2336 const t = this.path.resolve(this.dataFile),
2337 s = this.path.resolve(process.cwd(), this.dataFile),
2338 e = this.fs.existsSync(t),
2339 i = !e && this.fs.existsSync(s);
2340 if (!e && !i)
2341 return {}; {
2342 const i = e ? t : s;
2343 try {
2344 return JSON.parse(this.fs.readFileSync(i));
2345 } catch (t) {
2346 return {};
2347 }
2348 }
2349 }
2350 }
2351 writedata() {
2352 if (this.isNode()) {
2353 (this.fs = this.fs ? this.fs : require('fs')),

Callers 2

getvalMethod · 0.45
setvalMethod · 0.45

Calls 2

readFileSyncMethod · 0.80
isNodeMethod · 0.45

Tested by

no test coverage detected