Skip to content

Commit ddf1d2f

Browse files
committed
Changed to use isRegExp
1 parent fed4192 commit ddf1d2f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/event-handler/src/rest/RouteHandlerRegistry.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { GenericLogger } from '@aws-lambda-powertools/commons/types';
2+
import { isRegExp } from '@aws-lambda-powertools/commons/typeutils';
23
import type {
34
DynamicRoute,
45
HttpMethod,
@@ -105,7 +106,7 @@ class RouteHandlerRegistry {
105106

106107
const compiled = compilePath(route.path);
107108

108-
if (route.path instanceof RegExp) {
109+
if (isRegExp(route.path)) {
109110
if (this.#regexRoutes.has(route.id)) {
110111
this.#logger.warn(
111112
`Handler for method: ${route.method} and path: ${route.path} already exists. The previous handler will be replaced.`

0 commit comments

Comments
 (0)