Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/lib/lowdb/Low.js
1126 views
1
const { MissingAdapterError } = require('./MissingAdapterError.js');
2
class Low {
3
constructor(adapter) {
4
this.data = null;
5
if (adapter) {
6
this.adapter = adapter;
7
}
8
else {
9
throw new MissingAdapterError();
10
}
11
}
12
async read() {
13
this.data = await this.adapter.read();
14
}
15
async write() {
16
if (this.data) {
17
await this.adapter.write(this.data);
18
}
19
}
20
}
21
module.exports = { Low };
22
23