Comparing version 2.1.0 to 2.1.1
{ | ||
"name": "enmap", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -104,3 +104,3 @@ /** | ||
set(key, val) { | ||
if (val === undefined || val === null) throw `Value provided for ${key} was null or undefined. Please provide a value.`; | ||
if (val == null) throw `Value provided for ${key} was null or undefined. Please provide a value.`; | ||
let insert = val; | ||
@@ -133,5 +133,5 @@ if (val.constructor.name === 'Object') { | ||
setAsync(key, val) { | ||
if (!val) throw 'Cannot set null, undefined or empty value to a key. Use Enmap.delete(key) instead.'; | ||
if (val == null) throw `Value provided for ${key} was null or undefined. Please provide a value.`; | ||
let insert = val; | ||
if (typeof val === 'object') { | ||
if (val.constructor.name === 'Object') { | ||
const temp = {}; | ||
@@ -143,3 +143,5 @@ for (const prop in val) { | ||
} | ||
insert = val.constructor.name === 'Array' ? [...insert] : insert; | ||
if (val.constructor.name === 'Array') { | ||
insert = [...insert]; | ||
} | ||
super.set(key, insert); | ||
@@ -595,2 +597,3 @@ return this.db.set(key, insert); | ||
* @param {boolean} bulk Optional. Defaults to True. whether to use the provider's "bulk" delete feature if it has one. | ||
* @return {Promise} Returns a promise that is resolved when the database is cleared. | ||
*/ | ||
@@ -607,3 +610,3 @@ async deleteAllAsync(bulk = true) { | ||
} | ||
this.clear(); | ||
return this.clear(); | ||
} | ||
@@ -610,0 +613,0 @@ |
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
67851
867