code: 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;
  }
docs: 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