Explicitly convert to number

This commit is contained in:
RMidhunSuresh 2022-03-10 17:22:02 +05:30
parent f732164b5f
commit ff10297bf8

View file

@ -17,13 +17,14 @@ limitations under the License.
const offColor = require("off-color").offColor; const offColor = require("off-color").offColor;
module.exports.derive = function (value, operation, argument) { module.exports.derive = function (value, operation, argument) {
const argumentAsNumber = parseInt(argument);
switch (operation) { switch (operation) {
case "darker": { case "darker": {
const newColorString = offColor(value).darken(argument / 100).hex(); const newColorString = offColor(value).darken(argumentAsNumber / 100).hex();
return newColorString; return newColorString;
} }
case "lighter": { case "lighter": {
const newColorString = offColor(value).lighten(argument / 100).hex(); const newColorString = offColor(value).lighten(argumentAsNumber / 100).hex();
return newColorString; return newColorString;
} }
} }