From c209e33e8e0e0c53cac5b597f8835da38dfe73c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 31 Jan 2024 13:51:36 -0500 Subject: [PATCH] trim words so they don't have a leading/trailing space --- lib/toRegExp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/toRegExp.js b/lib/toRegExp.js index 8cc1739..1627dd4 100644 --- a/lib/toRegExp.js +++ b/lib/toRegExp.js @@ -6,7 +6,7 @@ function toRegExp(arr, fullWord) { if (!Array.isArray(arr)) { arr = (arr || '').toString().split(','); } - arr = arr.filter(Boolean); + arr = arr.map(str => str.trim()).filter(Boolean); var str; if (fullWord) {