Skip to content

Commit 4c5abf7

Browse files
committed
Merge pull request #195 from elacin/callbackOption-withFilter
Add CallbackOption.withFilter to enable if in for comprehensions
2 parents 685f582 + 25243ed commit 4c5abf7

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)