Calc seems to work in node and browsers. Had to add some conditional logic