2023.02.23.4
This commit is contained in:
parent
387ab7e582
commit
c8410b0c6f
2 changed files with 3 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mit.db",
|
||||
"version": "2023.02.23.3",
|
||||
"version": "2023.02.23.4",
|
||||
"description": "An easy and quick database",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
|
|
|
@ -99,11 +99,11 @@ class MitDB {
|
|||
*
|
||||
* @param callbackfn
|
||||
*/
|
||||
forEach(callback: (value: any, key: any, map: Map<any, any>) => void) {
|
||||
forEach(callback: (value: any, key: any) => void) {
|
||||
const file = fs.readFileSync(this.db);
|
||||
const data: any[] = JSON.parse(file.toString());
|
||||
|
||||
data.forEach((pair: any) => callback(pair.value, pair.key, map));
|
||||
data.forEach((pair: any) => callback(pair.value, pair.key));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,8 +122,6 @@ class MitDB {
|
|||
await writeDB(this.db, JSON.stringify(data));
|
||||
|
||||
return true;
|
||||
} else if (!map) {
|
||||
return false;
|
||||
}
|
||||
} catch {}
|
||||
return 'error';
|
||||
|
|
Loading…
Reference in a new issue