converting mercury.js to coffee