src/next-update.js
function checkAllUpdates (options) {
  options = options || {}
  var moduleName = options.names
  var checkLatestOnly = !!options.latest
  var checkCommand = options.testCommand
  if (checkCommand) {
    verify.unemptyString(checkCommand, 'invalid test command ' + checkCommand)
  }
  var all = options.all
  if (all) {
    checkLatestOnly = true
    console.log('will check only latest versions because testing all')
  }

  if (check.string(options.without)) {
    options.without = [options.without]
  }

  if (check.string(moduleName)) {
    moduleName = [moduleName]
  }
  checkLatestOnly = !!checkLatestOnly
  if (checkCommand) {
    check.verify.string(checkCommand, 'expected string test command')
  }
  var toCheck = getDependenciesToCheck(options, moduleName)
  check.verify.array(toCheck, 'dependencies to check should be an array')

  makeSureValidModule(moduleName, toCheck)

  var testVersionsBound = testVersions.bind(null, {
    modules: toCheck,
    command: checkCommand,
    all: all,
    color: options.color,
    keep: options.keep,
    allowed: options.allow || options.allowed,
    tldr: options.tldr,
    type: options.type,
    limit: options.limit
  })

  return isOnline()
        .then(function (online) {
          if (!online) {
            throw new Error('Need to be online to check new modules')
          }
        }).then(function () {
          if (isSingleSpecificVersion(moduleName)) {
            var nv = nameVersionParser(moduleName[0])
            console.log('checking only specific:', nv.name, nv.version)
            var list = [{
              name: nv.name,
              versions: [nv.version]
            }]
            return testVersionsBound(list)
          } else {
            var nextVersionsPromise = nextVersions(options, toCheck, checkLatestOnly)
            return nextVersionsPromise.then(testVersionsBound)
          }
        })
}
function checkAllUpdates (options) {
  options = options || {}
  var moduleName = options.names
  var checkLatestOnly = !!options.latest
  var checkCommand = options.testCommand
  if (checkCommand) {
    verify.unemptyString(checkCommand, 'invalid test command ' + checkCommand)
  }
  var all = options.all
  if (all) {
    checkLatestOnly = true
    console.log('will check only latest versions because testing all')
  }

  if (check.string(options.without)) {
    options.without = [options.without]
  }

  if (check.string(moduleName)) {
    moduleName = [moduleName]
  }
  checkLatestOnly = !!checkLatestOnly
  if (checkCommand) {
    check.verify.string(checkCommand, 'expected string test command')
  }
  var toCheck = getDependenciesToCheck(options, moduleName)
  check.verify.array(toCheck, 'dependencies to check should be an array')

  makeSureValidModule(moduleName, toCheck)

  var testVersionsBound = testVersions.bind(null, {
    modules: toCheck,
    command: checkCommand,
    all: all,
    color: options.color,
    keep: options.keep,
    allowed: options.allow || options.allowed,
    tldr: options.tldr,
    type: options.type,
    limit: options.limit
  })

  return isOnline()
        .then(function (online) {
          if (!online) {
            throw new Error('Need to be online to check new modules')
          }
        }).then(function () {
          if (isSingleSpecificVersion(moduleName)) {
            var nv = nameVersionParser(moduleName[0])
            console.log('checking only specific:', nv.name, nv.version)
            var list = [{
              name: nv.name,
              versions: [nv.version]
            }]
            return testVersionsBound(list)
          } else {
            var nextVersionsPromise = nextVersions(options, toCheck, checkLatestOnly)
            return nextVersionsPromise.then(testVersionsBound)
          }
        })
}
function checkAllUpdates ( options ) { options = options || { } var moduleName = options . names var checkLatestOnly = ! ! options . latest var checkCommand = options . testCommand if ( checkCommand ) { verify . unemptyString ( checkCommand , 'invalid test command ' + checkCommand ) } var all = options . all if ( all ) { checkLatestOnly = true console . log ( 'will check only latest versions because testing all' ) } if ( check . string ( options . without ) ) { options . without = [ options . without ] } if ( check . string ( moduleName ) ) { moduleName = [ moduleName ] } checkLatestOnly = ! ! checkLatestOnly if ( checkCommand ) { check . verify . string ( checkCommand , 'expected string test command' ) } var toCheck = getDependenciesToCheck ( options , moduleName ) check . verify . array ( toCheck , 'dependencies to check should be an array' ) makeSureValidModule ( moduleName , toCheck ) var testVersionsBound = testVersions . bind ( null , { modules : toCheck , command : checkCommand , all : all , color : options . color , keep : options . keep , allowed : options . allow || options . allowed , tldr : options . tldr , type : options . type , limit : options . limit } ) return isOnline ( ) . then ( function ( online ) { if ( ! online ) { throw new Error ( 'Need to be online to check new modules' ) } } ) . then ( function ( ) { if ( isSingleSpecificVersion ( moduleName ) ) { var nv = nameVersionParser ( moduleName [ 0 ] ) console . log ( 'checking only specific:' , nv . name , nv . version ) var list = [ { name : nv . name , versions : [ nv . version ] } ] return testVersionsBound ( list ) } else { var nextVersionsPromise = nextVersions ( options , toCheck , checkLatestOnly ) return nextVersionsPromise . then ( testVersionsBound ) } } ) }
returns promise
returns promise