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

Method loaddata

sendNotify.js:2880–2899  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2878 }).catch((t) => this.logErr(t));
2879 }
2880 loaddata() {
2881 if (!this.isNode())
2882 return {}; {
2883 (this.fs = this.fs ? this.fs : require('fs')),
2884 (this.path = this.path ? this.path : require('path'));
2885 const t = this.path.resolve(this.dataFile),
2886 s = this.path.resolve(process.cwd(), this.dataFile),
2887 e = this.fs.existsSync(t),
2888 i = !e && this.fs.existsSync(s);
2889 if (!e && !i)
2890 return {}; {
2891 const i = e ? t : s;
2892 try {
2893 return JSON.parse(this.fs.readFileSync(i));
2894 } catch (t) {
2895 return {};
2896 }
2897 }
2898 }
2899 }
2900 writedata() {
2901 if (this.isNode()) {
2902 (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