Update switch.js to be compatible with npm@3