Skip to content

Commit

Permalink
fix: typing issue in webui search
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Apr 2, 2024
1 parent 84a870f commit 4862cc6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions webui/src/utils/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function globFilterModules(
return items;
}

const matcher = picomatch(splitPattern(options.include || '**'), {
const matcher = picomatch(splitPattern(options.include) || '**', {
cwd: '',
dot: true,
nocase: true,
Expand All @@ -37,7 +37,8 @@ export function globFilterModules(
* Split the comma separated string into an array of separate patterns.
* This splits on any combination of `,` and whitespaces.
*/
function splitPattern(pattern: string) {
function splitPattern(pattern = '') {
if (!pattern) return undefined;
const split = pattern.split(/\s*,\s*/).filter(Boolean);
return split.length ? split : undefined;
}

0 comments on commit 4862cc6

Please sign in to comment.