From 139b8f34c907b1c2ddc59046aa98ddcbf1cdf99e Mon Sep 17 00:00:00 2001 From: Nicolas Bevacqua Date: Tue, 14 Jul 2015 10:32:46 -0300 Subject: [PATCH] Null guard --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index a715e5d..135d221 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,7 @@ 'use strict' module.exports = function hexColorRegex (opts) { - opts = typeof opts === 'object' ? opts : {} + opts = opts && typeof opts === 'object' ? opts : {} return opts.strict ? /^#([a-f0-9]{6}|[a-f0-9]{3})\b$/i : /#([a-f0-9]{6}|[a-f0-9]{3})\b/gi }