Created
May 25, 2020 16:32
-
-
Save dkomanov/4bb0cce1d31b4f8145c088057306ff13 to your computer and use it in GitHub Desktop.
[writing-async-app-in-scala-part-3] multiple transformations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rpcCall: Future[String] = ??? | |
rpcCall | |
.map(_.split('_')) | |
.filter(_.length < 4) | |
.map { | |
case Array(single) => single | |
case Array(first, second@_) => first | |
case Array(first@_, second, third@_) => third | |
case _ => "" | |
} | |
.map(value => s"<p>$value</p>") | |
.recoverFilter("<p>invalid</p>") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment