module.exports = WebSocket || MozWebSocket || window.WebSocket || window.MozWebSocket


var ws = null

if (typeof WebSocket !== 'undefined') {
  ws = WebSocket
} else if (typeof MozWebSocket !== 'undefined') {
  ws = MozWebSocket
} else {
  ws = window.WebSocket || window.MozWebSocket
}

module.exports = ws

Use typeof for checking globals.
Use typeof for checking globals.
