check-ping.js 407 B

12345678910111213141516
  1. var log = require('npmlog')
  2. var ping = require('../ping.js')
  3. function checkPing (cb) {
  4. var tracker = log.newItem('checkPing', 1)
  5. tracker.info('checkPing', 'Pinging registry')
  6. ping({}, true, (err, pong) => {
  7. if (err && err.code && err.code.match(/^E\d{3}$/)) {
  8. return cb(null, [err.code.substr(1), 'failed'])
  9. } else {
  10. cb(null, [200, 'ok'])
  11. }
  12. })
  13. }
  14. module.exports = checkPing