Comparing version 2.6.3 to 2.7.0
{ | ||
"name": "enmap", | ||
"version": "2.6.3", | ||
"version": "2.7.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -193,3 +193,3 @@ const dotProp = require('dot-prop'); | ||
if (!this.has(key)) { | ||
throw 'This key does not exist'; | ||
throw `The key ${key} does not exist in the enmap ${this.name}`; | ||
} | ||
@@ -214,3 +214,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.name}`; | ||
} | ||
@@ -238,3 +238,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.name}`; | ||
} | ||
@@ -255,2 +255,38 @@ const data = super.get(key); | ||
_mathop(base, op, opand) { | ||
if (!base || !op || !opand) throw `Math Operation requires base, operation, and right operand`; | ||
switch (op) { | ||
case 'add' : | ||
case 'addition' : | ||
case '+' : | ||
return base + opand; | ||
case 'sub' : | ||
case 'subtract' : | ||
case '-' : | ||
return base - opand; | ||
case 'mult' : | ||
case 'multiply' : | ||
case '*' : | ||
return base * opand; | ||
case 'div' : | ||
case 'divide' : | ||
case '/' : | ||
return base / opand; | ||
case 'exp' : | ||
return Math.pow(base, opand); | ||
case 'mod' : | ||
case 'modulo' : | ||
case '%' : | ||
return base % opand; | ||
} | ||
return null; | ||
} | ||
math(key, operation, operand = null) { | ||
if (!this.has(key)) { | ||
throw `The key ${key} does not exist in the enmap ${this.name}`; | ||
} | ||
return this.set(key, this._mathop(this.get(key), operation, operand)); | ||
} | ||
/* METHODS THAT GETS THINGS FROM ENMAP */ | ||
@@ -257,0 +293,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
102824
1400