2023.02.23.4

This commit is contained in:
Killer Boss Original 2023-02-23 12:17:13 +01:00 committed by GitHub
parent 387ab7e582
commit c8410b0c6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "mit.db", "name": "mit.db",
"version": "2023.02.23.3", "version": "2023.02.23.4",
"description": "An easy and quick database", "description": "An easy and quick database",
"main": "build/index.js", "main": "build/index.js",
"types": "build/index.d.ts", "types": "build/index.d.ts",

View file

@ -99,11 +99,11 @@ class MitDB {
* *
* @param callbackfn * @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 file = fs.readFileSync(this.db);
const data: any[] = JSON.parse(file.toString()); 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)); await writeDB(this.db, JSON.stringify(data));
return true; return true;
} else if (!map) {
return false;
} }
} catch {} } catch {}
return 'error'; return 'error';