summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-05-05 22:51:27 +0300
committereug-vs <eug-vs@keemail.me>2021-05-05 22:51:27 +0300
commit6a07f0493ab570736b244f931a440307b0bf92ec (patch)
tree8adde0f3c947320f8bb7838c5c0320df7422461b
parentb56d5eec1189d8b60a7c51eeec6d7526e562bf7e (diff)
downloadcommercel-api-6a07f0493ab570736b244f931a440307b0bf92ec.tar.gz
fix: correctly check if query is using regex
-rw-r--r--src/hooks/ignoreCaseRegex.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hooks/ignoreCaseRegex.ts b/src/hooks/ignoreCaseRegex.ts
index 3a1ab63..a9ddb31 100644
--- a/src/hooks/ignoreCaseRegex.ts
+++ b/src/hooks/ignoreCaseRegex.ts
@@ -3,7 +3,7 @@ import _ from 'lodash';
const ignoreCaseRegex = async (context: HookContext): Promise<HookContext> => {
context.params.query = _.mapValues(context.params.query, data => {
- return '$regex' in data ? _.set(data, '$options', 'i') : data;
+ return _.has(data, '$regex') ? _.set(data, '$options', 'i') : data;
});
return context;
};