hopefully make it work in Node.js as well as browser