Skip to content

Commit

Permalink
chore: remove unnecessary condition
Browse files Browse the repository at this point in the history
It's already decided before this step
  • Loading branch information
seia-soto committed Jun 13, 2024
1 parent dc9d1b6 commit 30df232
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/adblocker/src/filters/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,14 +613,10 @@ function getFilterOptions(line: string, pos: number, end: number) {
export function replaceOptionValueToRegexp(value: string): HTMLModifier | null {
const [, values] = getFilterReplaceOptionValue(value, 0, value.length);

// We expect `/regexp/replacement/flags` to be [regexp, replacement, flags]
// The first entry should be removed in the early steps
if (values.length !== 3) {
return null;
}

// RegExp constructor can throw an error
try {
// We expect `/regexp/replacement/flags` to be [regexp, replacement, flags]
// The first slash should be removed in the early steps
return [new RegExp(values[1], values[3]), values[2]];
} catch (error) {
return null;
Expand Down

0 comments on commit 30df232

Please sign in to comment.