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

Method loaddata

jd_api_test.js:212–227  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

210 }
211
212 loaddata() {
213 if (!this.isNode()) return {};
214 {
215 this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
216 const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e);
217 if (!s && !i) return {};
218 {
219 const i = s ? t : e;
220 try {
221 return JSON.parse(this.fs.readFileSync(i))
222 } catch (t) {
223 return {}
224 }
225 }
226 }
227 }
228
229 writedata() {
230 if (this.isNode()) {

Callers 2

getvalMethod · 0.45
setvalMethod · 0.45

Calls 1

isNodeMethod · 0.45

Tested by

no test coverage detected