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

Method loaddata

jd_superMarket.js:2205–2220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2203 }
2204
2205 loaddata() {
2206 if (!this.isNode()) return {};
2207 {
2208 this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
2209 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);
2210 if (!s && !i) return {};
2211 {
2212 const i = s ? t : e;
2213 try {
2214 return JSON.parse(this.fs.readFileSync(i))
2215 } catch (t) {
2216 return {}
2217 }
2218 }
2219 }
2220 }
2221
2222 writedata() {
2223 if (this.isNode()) {

Callers 2

getvalMethod · 0.45
setvalMethod · 0.45

Calls 1

isNodeMethod · 0.45

Tested by

no test coverage detected