summaryrefslogtreecommitdiff
path: root/src/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'src/hooks')
-rw-r--r--src/hooks/ignoreCaseRegex.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/hooks/ignoreCaseRegex.ts b/src/hooks/ignoreCaseRegex.ts
new file mode 100644
index 0000000..e996000
--- /dev/null
+++ b/src/hooks/ignoreCaseRegex.ts
@@ -0,0 +1,11 @@
+import { HookContext } from '@feathersjs/feathers';
+import _ from 'lodash';
+
+const ignoreCaseRegex = async (context: HookContext): Promise<HookContext> => {
+ context.params.query = _.mapValues(context.params.query, (data, key) => {
+ return key.startsWith('$') ? data : _.set(data, '$options', 'i');
+ });
+ return context;
+};
+
+export default ignoreCaseRegex;