make it work in node or browser