Skip to content

Commit

Permalink
* SearchParams - toggle method added
Browse files Browse the repository at this point in the history
  • Loading branch information
uriel-online committed Nov 28, 2023
1 parent 7980523 commit 71da4b9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions xo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,16 @@ class SearchParams {
return this.params.get(param);
}

toggle(param, value, else_value) {
if (this.get(param) != value) {
this.set(param, value)
} else if (!else_value) {
this.set(param, null)
} else {
this.set(param, else_value)
}
}

entries() {
return [...this.params];
}
Expand Down

0 comments on commit 71da4b9

Please sign in to comment.