I am trying to write a simple utility to check whether a JsValue is null or empty. I have this:
def is_nullOrEmpty(x: JsValue): JsBoolean = {
  JsBoolean(
    (x) match {
      case _ => x == null
      case _ => x.toString().isEmpty  
    }
  )
}
I am fairly new to Scala + Play and I am not sure whether this is the correct way to go about.
Alternatively this:
def is_nullOrEmpty(x: JsValue) = x == null || x.toString().trim.isEmpty
Where I am also including .trim
Can you help?
 
     
    