Skip to content

Commit b71a91d

Browse files
committed
add comment
1 parent 3380a07 commit b71a91d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/open-next/src/utils/regex.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/**
2+
* Constructs a regular expression for a path that supports separators for multiple platforms
3+
* - Uses posix separators (`/`) as the input that should be made cross-platform.
4+
* - Special characters are escaped by default but can be controlled through opts.escape.
5+
*
6+
* @example
7+
* ```ts
8+
* getCrossPlatformPathRegex("./middleware.mjs")
9+
* getCrossPlatformPathRegex("\\./middleware\\.(mjs|cjs)", { escape: false })
10+
* ```
11+
*/
112
export function getCrossPlatformPathRegex(
213
regex: string,
314
opts: { escape: boolean } = { escape: true },

0 commit comments

Comments
 (0)