lib/port-finder.js
function find(ports, callback) {
  if (_.isEmpty(ports)) {
    callback(new Error('no free port available'));
  } else {
    var port = ports.shift();
    checkPort(port, function (err, found) {
      if (!err) {
        callback(null, found);
      } else {
        find(ports, callback);
      }
    });
  }
}
function find(ports, callback) {
  if (_.isEmpty(ports)) {
    callback(new Error('no free port available'));
  } else {
    var port = ports.shift();
    checkPort(port, function (err, found) {
      if (!err) {
        callback(null, found);
      } else {
        find(ports, callback);
      }
    });
  }
}
function find ( ports , callback ) { if ( _ . isEmpty ( ports ) ) { callback ( new Error ( 'no free port available' ) ) ; } else { var port = ports . shift ( ) ; checkPort ( port , function ( err , found ) { if ( ! err ) { callback ( null , found ) ; } else { find ( ports , callback ) ; } } ) ; } }
Find the first available port in a ports list

@param {Array} ports The ports list to find the first available
@param {Function} callback Function called as result
@param {Error} callback.err The error if occurred
@param {Number} callback.port The first port available
@private
@ignore
Find the first available port in a ports list