Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit b152cd5

Browse files
author
Michal Vlasák
committed
Add matchPath helper
1 parent 298910b commit b152cd5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import { Request } from 'express';
12
import { Dictionary } from 'lodash';
23
import isEmpty = require('lodash.isempty');
34
import omit = require('omit-deep');
45

56
const removeEmpty = (obj: Dictionary<any>): object =>
67
omit(obj, Object.keys(obj).filter(key => obj[key] === undefined || isEmpty(obj[key])));
78

8-
export { removeEmpty };
9+
const matchPath = (pattern: RegExp) => (req: Request): boolean => req.path.match(pattern) !== null;
10+
11+
export { removeEmpty, matchPath };

0 commit comments

Comments
 (0)