index.js
function addToQueue(queue, packageInfo) {
  var exists;

  function matchesVersion(version, range) {
    var matches;

    try {
      matches = semver.satisfies(packageInfo.version, item.version);
    }
    catch (err) {
      matches = false;
    }

    return matches;
  }

  exists = queue.some(function(item) {
    var matches = false;

    if (item.name === packageInfo.name) {
      matches = matchesVersion(packageInfo.version, item.version);
    }

    return matches;
  });

  if (!exists) {
    queue.push(packageInfo);
  }
}
function addToQueue(queue, packageInfo) {
  var exists;

  function matchesVersion(version, range) {
    var matches;

    try {
      matches = semver.satisfies(packageInfo.version, item.version);
    }
    catch (err) {
      matches = false;
    }

    return matches;
  }

  exists = queue.some(function(item) {
    var matches = false;

    if (item.name === packageInfo.name) {
      matches = matchesVersion(packageInfo.version, item.version);
    }

    return matches;
  });

  if (!exists) {
    queue.push(packageInfo);
  }
}
function addToQueue ( queue , packageInfo ) { var exists ; function matchesVersion ( version , range ) { var matches ; try { matches = semver . satisfies ( packageInfo . version , item . version ) ; } catch ( err ) { matches = false ; } return matches ; } exists = queue . some ( function ( item ) { var matches = false ; if ( item . name === packageInfo . name ) { matches = matchesVersion ( packageInfo . version , item . version ) ; } return matches ; } ) ; if ( ! exists ) { queue . push ( packageInfo ) ; } }
Add the package to the queue in case the name && version doen't exist or
the version range isn't matched.

@param {Object} queue - contains packages info from NPM registry
@param {String} packageInfo - data retrieved from the NPM registry for a package
Add the package to the queue in case the name && version doen t exist or the version range isn t matched .