Skip to content

Commit

Permalink
Merge pull request #2 from Collaborne/fix/3373
Browse files Browse the repository at this point in the history
Prevent removing all spaces from search term
  • Loading branch information
sudhons authored Dec 2, 2024
2 parents 9d5cd76 + 3442081 commit 58cdf36
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/search-editor/utils/remove-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ function escapeRegExp(text: string): string {
}

export function removeText(input: string, textToRemove: string): string {
return input.replace(new RegExp(escapeRegExp(textToRemove), GLOBAL_FLAG), '');
return input.replace(
new RegExp(escapeRegExp(textToRemove?.trim()), GLOBAL_FLAG),
'',
);
}

0 comments on commit 58cdf36

Please sign in to comment.