Skip to content

Commit 25243ed

Browse files
committed
withFilter for CallbackOption to enable if in for comprehensions
1 parent 685f582 commit 25243ed

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/main/scala/japgolly/scalajs/react/CallbackOption.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ final class CallbackOption[A](private val cbfn: () => Option[A]) extends AnyVal
137137
def filter(condition: A => Boolean): CallbackOption[A] =
138138
CallbackOption(get.map(_ filter condition))
139139

140+
def withFilter(condition: A => Boolean): CallbackOption[A] =
141+
filter(condition)
142+
140143
/**
141144
* Sequence a callback to run after this, discarding any value produced by this.
142145
*/

0 commit comments

Comments
 (0)