index.js
function isDuplicate(pkg, version) {
  var versions;

  // no duplicates
  if (pkg) {
    versions = Object.keys(pkg);

    if (versions.length && semver.maxSatisfying(versions, version)) {
      return true;
    }
  }

  return false;
}
function isDuplicate(pkg, version) {
  var versions;

  // no duplicates
  if (pkg) {
    versions = Object.keys(pkg);

    if (versions.length && semver.maxSatisfying(versions, version)) {
      return true;
    }
  }

  return false;
}
function isDuplicate ( pkg , version ) { var versions ; // no duplicates if ( pkg ) { versions = Object . keys ( pkg ) ; if ( versions . length && semver . maxSatisfying ( versions , version ) ) { return true ; } } return false ; }
Check if a version of a package already exists

@param {Object} pkg - an object with the keys representing the versions of a module
@param {String} version - version range
@returns {Array}
 TODO: refactor this, first arg should be versions instead
Check if a version of a package already exists