All Downloads are FREE. Search and download functionalities are using the official Maven repository.

japgolly.webapputil.general.JsExt.scala Maven / Gradle / Ivy

There is a newer version: 2.0.0-RC12
Show newest version
package japgolly.webapputil.general

import scala.scalajs.js

object JsExt {

  @inline final implicit class JsAnyExt(private val self: Any) extends AnyVal {
    @inline def falsy: Boolean = {
      val a = self.asInstanceOf[js.Dynamic]
      (!a).asInstanceOf[Boolean]
    }

    @inline def truthy: Boolean =
      !falsy
  }

  @inline final implicit class JsArrayExt[A](private val self: js.Array[A]) extends AnyVal {
    def forEachJs(f: js.Function1[A, Unit]): Unit = {
      self.asInstanceOf[js.Dynamic].forEach(f)
      ()
    }
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy