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

Method loaddata

jd_joy_new.js:1070–1086  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1068 }
1069
1070 loaddata() {
1071 if (!this.isNode()) return {};
1072 {
1073 this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
1074 const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile),
1075 s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e);
1076 if (!s && !i) return {};
1077 {
1078 const i = s ? t : e;
1079 try {
1080 return JSON.parse(this.fs.readFileSync(i))
1081 } catch (t) {
1082 return {}
1083 }
1084 }
1085 }
1086 }
1087
1088 writedata() {
1089 if (this.isNode()) {

Callers 2

getvalMethod · 0.45
setvalMethod · 0.45

Calls 1

isNodeMethod · 0.45

Tested by

no test coverage detected