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

Method loaddata

jd_redPacket.js:1665–1680  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1663 }
1664
1665 loaddata() {
1666 if (!this.isNode()) return {};
1667 {
1668 this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
1669 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);
1670 if (!s && !i) return {};
1671 {
1672 const i = s ? t : e;
1673 try {
1674 return JSON.parse(this.fs.readFileSync(i))
1675 } catch (t) {
1676 return {}
1677 }
1678 }
1679 }
1680 }
1681
1682 writedata() {
1683 if (this.isNode()) {

Callers 2

getvalMethod · 0.45
setvalMethod · 0.45

Calls 1

isNodeMethod · 0.45

Tested by

no test coverage detected