From 46dd1a985365d8c30e01962577a6a5de80c2f7c7 Mon Sep 17 00:00:00 2001 From: Christian Paul Date: Thu, 18 Oct 2018 00:38:10 -0700 Subject: [PATCH] Fix: invert test and fix error message --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index b9aade2..6d0701c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -59,8 +59,8 @@ const utils = { hex2rgb: (color) => { if (typeof color !== 'string') return [255, 0, 0]; - if (/^#[a-fA-F0-9]{3,6}$/.test(color)) { - throw new Error('#{color} isn\'t a supported hex color'); + if (!/^#[a-fA-F0-9]{3,6}$/.test(color)) { + throw new Error(`${color} isn't a supported hex color`); } color = color.substr(1);