A substitute Functor in JavaScript