$ npm install has-network
check if we have a usable network interface.
console.log(require('has-network')()) => true || false
MIT