Comparing version 0.0.20 to 0.0.21
@@ -89,3 +89,3 @@ "use strict"; | ||
if(db.includes(".")) { | ||
let content = this.get(db.split(".").shift()); | ||
let content = await this.get(db.split(".").shift()); | ||
if(!content) return true; | ||
@@ -204,3 +204,3 @@ const newContent = Object.assign({}, content); | ||
if(this.get(db)) { | ||
arr = this.get(db); | ||
arr = await this.get(db); | ||
} | ||
@@ -207,0 +207,0 @@ |
@@ -19,19 +19,34 @@ const langs = ["tr", "en"]; | ||
mongoOptions: this.mongoOptions || {}, | ||
isMongoSpecialSchema: this.isMongoSpecialSchema | ||
isMongoSpecialSchema: this.isMongoSpecialSchema, | ||
checkUpdates: this.checkUpdates || true | ||
} | ||
this.message = this.lang ? require(`../language/${this.lang.toLowerCase()}.json`) : require(`../language/en.json`); | ||
this.adapter = adapter.set ? adapter : (this.mongo ? new adapter(this.options.mongoOptions) : new adapter(this.options)); | ||
try { | ||
fetch("https://registry.npmjs.org/croxydb/latest").then(async(res) => { | ||
res.json().then((data) => { | ||
if(require("../package.json").version !== data.version) { | ||
console.warn(this.message["errors"]["oldVersion"]) | ||
} | ||
}) | ||
}) | ||
} catch (err) { | ||
if(this.checkUpdates) { | ||
try { | ||
fetch("https://registry.npmjs.org/croxydb/latest").then(async(res) => { | ||
res.json().then((data) => { | ||
if(require("../package.json").version !== data.version) { | ||
console.warn(this.message["errors"]["oldVersion"]) | ||
} | ||
}) | ||
}) | ||
} catch (err) { | ||
} | ||
} | ||
}, | ||
setCheckUpdates(a) { | ||
if(a === true) { | ||
this.checkUpdates = true; | ||
this.setOptions(); | ||
return a; | ||
} else { | ||
this.checkUpdates = false; | ||
this.setOptions(); | ||
return false; | ||
} | ||
}, | ||
setLanguage(lang) { | ||
@@ -38,0 +53,0 @@ this.lang = lang ? (langs.includes(lang.toLowerCase()) ? lang.toLowerCase() : "en") : "en"; |
@@ -40,3 +40,3 @@ { | ||
}, | ||
"version": "0.0.20" | ||
"version": "0.0.21" | ||
} |
@@ -5,4 +5,5 @@ # CroxyDB | ||
# What's new in 0.0.20? | ||
- Fixed bugs in "db.has()" function. | ||
# What's new in 0.0.21? | ||
- Added "db.setCheckUpdates()" function. | ||
- Fixed bugs in "db.delete()" and "db.push()" functions. | ||
@@ -94,2 +95,3 @@ Examples | ||
db.setFile("db") // You can set database file name | ||
db.setCheckUpdates(true) // It warns you if any updates happens. | ||
@@ -96,0 +98,0 @@ db.set("x.y.z", "abc") // abc |
@@ -14,2 +14,3 @@ interface QuickDB { | ||
setLanguage:(language:"tr"|"en") => true; | ||
setCheckUpdates:(boolean:boolean) => boolean; | ||
setReadable:(readable:boolean) => boolean; | ||
@@ -16,0 +17,0 @@ setNoBlankData:(noBlankData:boolean) => boolean; |
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
47816
1381
117