functional wrapper for js func