Skip to content

Commit

Permalink
docs(Either): isEmpty / isNotEmpty docs (#2550)
Browse files Browse the repository at this point in the history
  • Loading branch information
codymikol committed Oct 25, 2021
1 parent 0538a86 commit df850ee
Showing 1 changed file with 18 additions and 0 deletions.
Expand Up @@ -949,8 +949,26 @@ public sealed class Either<out A, out B> {
public inline fun all(predicate: (B) -> Boolean): Boolean =
fold({ true }, predicate)

/**
* Returns `true` if [Left]
*
* Example:
* ```
* Left("foo").isEmpty() // Result: true
* Right("foo").isEmpty() // Result: false
* ```
*/
public fun isEmpty(): Boolean = isLeft

/**
* Returns `true` if [Right]
*
* Example:
* ```
* Left("foo").isEmpty() // Result: false
* Right("foo").isEmpty() // Result: true
* ```
*/
public fun isNotEmpty(): Boolean = isRight

/**
Expand Down

0 comments on commit df850ee

Please sign in to comment.