Comparing version 2.7.0 to 2.7.1
{ | ||
"name": "enmap", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -160,3 +160,3 @@ const dotProp = require('dot-prop'); | ||
setAsync(key, val) { | ||
if (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 in ${this.db.name}. Please provide a value.`; | ||
let insert = val; | ||
@@ -194,3 +194,3 @@ if (val.constructor.name === 'Object') { | ||
if (!this.has(key)) { | ||
throw `The key ${key} does not exist in the enmap ${this.name}`; | ||
throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
} | ||
@@ -215,3 +215,3 @@ const data = super.get(key); | ||
if (!this.has(key)) { | ||
throw `The key ${key} does not exist in the enmap ${this.name}`; | ||
throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
} | ||
@@ -239,3 +239,3 @@ const data = super.get(key); | ||
if (!this.has(key)) { | ||
throw `The key ${key} does not exist in the enmap ${this.name}`; | ||
throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
} | ||
@@ -257,3 +257,3 @@ const data = super.get(key); | ||
_mathop(base, op, opand) { | ||
if (!base || !op || !opand) throw `Math Operation requires base, operation, and right operand`; | ||
if (!base || !op) throw 'Math Operation requires base and operation'; | ||
switch (op) { | ||
@@ -277,2 +277,4 @@ case 'add' : | ||
case 'exp' : | ||
case 'exponent' : | ||
case '^' : | ||
return Math.pow(base, opand); | ||
@@ -289,4 +291,7 @@ case 'mod' : | ||
if (!this.has(key)) { | ||
throw `The key ${key} does not exist in the enmap ${this.name}`; | ||
throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
} | ||
if (operation === 'random' || operation === 'rand') { | ||
return Math.random() * operand; | ||
} | ||
return this.set(key, this._mathop(this.get(key), operation, operand)); | ||
@@ -331,3 +336,3 @@ } | ||
} else { | ||
throw 'This key does not exist'; | ||
throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
} | ||
@@ -382,3 +387,3 @@ } else { | ||
if (!this.has(key)) { | ||
throw 'This key does not exist'; | ||
throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
} | ||
@@ -392,3 +397,3 @@ const data = super.get(key); | ||
return this.fetch(key).then(data => { | ||
if (!data) throw 'This key does not exist'; | ||
if (!data) throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
if (data.constructor.name !== 'Object') { | ||
@@ -482,3 +487,3 @@ throw 'The value of this key is not an object.'; | ||
if (!this.has(key)) { | ||
throw 'This key does not exist'; | ||
throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
} | ||
@@ -510,3 +515,3 @@ const data = super.get(key); | ||
if (!this.has(key)) { | ||
throw 'This key does not exist'; | ||
throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
} | ||
@@ -542,3 +547,3 @@ const data = super.get(key); | ||
if (!this.has(key)) { | ||
throw 'This key does not exist'; | ||
throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
} | ||
@@ -553,3 +558,3 @@ const data = super.get(key); | ||
return this.fetch(key).then(data => { | ||
if (!data) throw 'This key does not exist'; | ||
if (!data) throw `The key ${key} does not exist in the enmap ${this.db.name}`; | ||
if (typeof data !== 'object') { | ||
@@ -556,0 +561,0 @@ throw 'The value of this key is not an object.'; |
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
103213
1405
1659