t

jshelpers

UndefOrCommon

trait UndefOrCommon[A] extends AnyRef

Add Option-like methods to js.UndefOr. Note that js.Undef.orNull exists in scala.js 1.0

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

Abstract Value Members

  1. abstract def a: UndefOr[A]

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. def !?[B >: A](default: => B): B

    Same as .getOrElse just shorter.

    Same as .getOrElse just shorter.

    Annotations
    @inline()
  3. final def ##: Int
    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def ??[B >: A](default: => B): B

    Same as .getOrElse just shorter.

    Same as .getOrElse just shorter.

    Annotations
    @inline()
  6. def as[B]: UndefOr[B]

    Changes what's inside but preserves UndefOr.

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def filterNull: UndefOr[A]

    null => undefined, else the value remains.

  12. def filterTruthy: UndefOr[A]

    Keep the value if its truthy, otherwise return undefined.

  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def isNull: Boolean

    Tests for overall nullness which is different than .isEmpty|.nonEmpty.

  17. def isTotalEmpty: Boolean

    This may override UndefOr.isEmpty but this checks for null as well.

  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toNonNullOption: Option[A]

    This could also be _.toOption.filter(_ != null) but below is slightly faster.

  23. def toNull: |[A, Null]

    Convert UndefOr[A] => A|Null

  24. def toString(): String
    Definition Classes
    AnyRef → Any
  25. def toStringJs: String

    Calls toString.

    Calls toString. I'm not sure this is needed at all.

  26. def toTruthy: Boolean

    Equivalent to !!someJSValue

  27. def toUndefOrNull: UndefOr[|[A, Null]]

    Uh-oh, thought it was js.UndefOr[A] but you need to say its a js.UndefOr[A|Null] because the docs were wrong :-).

    Uh-oh, thought it was js.UndefOr[A] but you need to say its a js.UndefOr[A|Null] because the docs were wrong :-).

    Annotations
    @inline()
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  30. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped