Update index.js

add support for browser env.