File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -117,14 +117,7 @@ async function resolveWorkspace(
117
117
}
118
118
119
119
if ( options . filter ) {
120
- if (
121
- typeof options . filter === 'string' &&
122
- options . filter . length > 2 &&
123
- options . filter [ 0 ] === '/' &&
124
- options . filter . at ( - 1 ) === '/'
125
- ) {
126
- options . filter = new RegExp ( options . filter . slice ( 1 , - 1 ) )
127
- }
120
+ options . filter = resolveRegex ( options . filter )
128
121
packages = packages . filter ( ( path ) => {
129
122
return typeof options . filter === 'string'
130
123
? path . includes ( options . filter )
Original file line number Diff line number Diff line change @@ -16,8 +16,13 @@ export function resolveComma<T extends string>(arr: T[]): T[] {
16
16
return arr . flatMap ( ( format ) => format . split ( ',' ) as T [ ] )
17
17
}
18
18
19
- export function resolveRegex ( str : string ) : string | RegExp {
20
- if ( str . length > 2 && str [ 0 ] === '/' && str . at ( - 1 ) === '/' ) {
19
+ export function resolveRegex < T > ( str : T ) : T | RegExp {
20
+ if (
21
+ typeof str === 'string' &&
22
+ str . length > 2 &&
23
+ str [ 0 ] === '/' &&
24
+ str . at ( - 1 ) === '/'
25
+ ) {
21
26
return new RegExp ( str . slice ( 1 , - 1 ) )
22
27
}
23
28
return str
You can’t perform that action at this time.
0 commit comments