Make it work on Node as well as in browser