A functional wrapper for javascript