trait AnyOps[T] extends AnyRef

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AnyOps
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Concrete Value Members

  1. def as[T]: T

    .asInstanceOf[T] but shorter.

    .asInstanceOf[T] but shorter. Very dangerous!

  2. def asBoolean: Boolean
  3. def asDouble: Double
  4. def asDyn: Dynamic
  5. def asInt: Int
  6. def asJsAny: Any

    If T is js.Any, this may be redundent.

  7. def asJsArray[A]: Array[A]
  8. def asJsObj: Object
  9. def asJson: String
  10. def asNumber: Number
  11. def asString: String
  12. def filterNull: UndefOr[T]

    Internal null values become undefined.

  13. def toNonNullOption: Option[T]

    If value is null or undefined be None, else Some.

  14. def toNonNullUndefOr: UndefOr[T]

    If value is null or undefined be undefined, otherwise defined.

    If value is null or undefined be undefined, otherwise defined. Could be called "filterNull".

  15. def toStringJs: String

    Call the toString method after casting to js.Any.

    Call the toString method after casting to js.Any. Not sure casting makes any difference though.

  16. def toTruthy: Boolean

    Equivalent !!x for some javascript value x.

  17. def toTruthyUndefOr: UndefOr[T]

    Wow, a mouthful! If its a javascript truthy=true, its defined, otherwise undef.

    Wow, a mouthful! If its a javascript truthy=true, its defined, otherwise undef. Takes into account 0, "" and [] javascript idioms i.e. takes into account the FP zero.

    Example:
    1. val s = "" // s.toTruthyUndefOr[String] => js.undefined
      val s = "blah" // s.toTurthyUndefOr[String] => defined "blah"
      val n = 0  // n.toTruthyUndefOr[Int] => js.undefined
      val n1 = 1 // n1.toTruthyUndefOr[Int] => defined 1