MCPcopy Create free account
hub / github.com/Toulu-debug/enen / loaddata

Method loaddata

old/jd_fruit.js:1591–1606  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1589 }
1590
1591 loaddata() {
1592 if (!this.isNode()) return {};
1593 {
1594 this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
1595 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);
1596 if (!s && !i) return {};
1597 {
1598 const i = s ? t : e;
1599 try {
1600 return JSON.parse(this.fs.readFileSync(i))
1601 } catch (t) {
1602 return {}
1603 }
1604 }
1605 }
1606 }
1607
1608 writedata() {
1609 if (this.isNode()) {

Callers 2

getvalMethod · 0.45
setvalMethod · 0.45

Calls 1

isNodeMethod · 0.45

Tested by

no test coverage detected