From 67a9b87a8c7e12d26b2cf15fc7f6dbcede9f3969 Mon Sep 17 00:00:00 2001 From: Jeff Brower Date: Thu, 3 Oct 2024 12:33:05 -0400 Subject: [PATCH] Update index.js I believe the intention of the `isDimension` function is to test whether a feature ends with `height` or `width`, but what the regular expression is actually doing is checking whether it ends with any of the following characters: `|deghitw`, which doesn't seem correct. Additionally, the regular expression is case-sensitive, so I added the `i` modifier. An alternative to this would be to remove the `isDimension` check entirely, because it seems unintended, and would technically be a breaking change to make it work as intended. This check also isn't documented, or thoroughly tested in the unit tests. --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index c8b562e..f2aa61f 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ var camel2hyphen = require('string-convert/camel2hyphen'); var isDimension = function (feature) { - var re = /[height|width]$/; + var re = /(height|width)$/i; return re.test(feature); }; @@ -48,4 +48,4 @@ var json2mq = function (query) { return obj2mq(query); }; -module.exports = json2mq; \ No newline at end of file +module.exports = json2mq;