| 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()) { |