Fix percent.match is not a function when percent is a number

This commit is contained in:
Ching Yaw Hao
2018-11-28 02:14:17 +08:00
committed by Mikael Sand
parent c49fc19014
commit 31d0374c64
+1 -1
View File
@@ -9,7 +9,7 @@ import units from "../units";
const percentReg = /^([+\-]?\d+(?:\.\d+)?(?:[eE][+\-]?\d+)?)(%?)$/;
function percentToFloat(percent) {
const matched = percent.match(percentReg);
const matched = percent.toString().match(percentReg);
if (!matched) {
console.warn(
`\`${percent}\` is not a valid number or percentage string.`,