browser porting of util.js in node.js