Comparing version 1.1.1 to 1.1.2
@@ -7,3 +7,3 @@ const Collection = require("./Collection"); | ||
#collections | ||
constructor(name) { | ||
constructor(name="defaultdb") { | ||
this.name = name; | ||
@@ -22,3 +22,3 @@ this.#collections = []; | ||
CreateCollection(name) { | ||
CreateCollection(name="defaultcollection") { | ||
try { | ||
@@ -54,7 +54,9 @@ this.#DbExists(this.dbFile); | ||
let index = this.#collections.indexOf(collection); | ||
if(index != -1) this.#collections.splice(index, 1); | ||
collection.destroyed = true; | ||
delete db[collection.name || collection]; | ||
fs.writeFileSync(this.dbFile, JSON.stringify(db)); | ||
return db; | ||
if(index != -1) { | ||
this.#collections.splice(index, 1); | ||
collection.destroyed = true; | ||
delete db[collection.name || collection]; | ||
fs.writeFileSync(this.dbFile, JSON.stringify(db)); | ||
return db; | ||
} else return null; | ||
} catch(err) { | ||
@@ -61,0 +63,0 @@ return null; |
{ | ||
"name": "magmadb", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Magmadb, a user-friendly solution for storing and accessing data.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11365
228