Scala.js port of Monifu