Created
July 13, 2011 04:36
-
-
Save fmpwizard/1079726 to your computer and use it in GitHub Desktop.
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 updateCity(x: Any) : JsCmd = { | |
val (cometName: String, cityId) = Full(x).asA[Map[String, Any]] match { | |
case Full(m) => ( | |
m.get("cometName").getOrElse("No comet Name"), | |
m.get("cityId").getOrElse("1") | |
) | |
case _ => ("No Comet Name", "1") | |
} | |
... | |
} |
or even
def updateCity(x: Any) : JsCmd = {
val (cometName: String, cityId) = Full(x).asA[Map[String, Any]].map { m =>
(
m.get("cometName").getOrElse("No comet Name"),
m.get("cityId").getOrElse("1")
)
} openOr ("No Comet Name", "1")
...
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
untested, but this might work and be a little simpler: