function duplicatedDependencies (lockFileContent, modulesToValidate) {
  var all = alldeps(lockFileContent);

  modulesToValidate = modulesToValidate || Object.keys(all);

  return modulesToValidate.reduce(function (duplicatedMods, mod) {
    if (all[mod] === undefined) {
      console.error('!!! ERROR !!!');
      console.error('Trying to get all dependencies from ', mod, ' but it does not exist.');
      console.error('!!! ERROR !!!');
    }
    var modVersions = Object.keys(all[mod]);
    if (modVersions.length > 1) {
      var invalidMod = { name: mod, versions: [] };

      modVersions.forEach(function (modVersion) {
        invalidMod.versions.push({version: modVersion, from: all[mod][modVersion]});
      });
      duplicatedMods.push(invalidMod);
    }
    return duplicatedMods;
  }, []);
}
Checks all modules dependencies versions within a package-lock to not be
duplicated from different parent dependencies.

For instance if there are a couple of dependencies using a different version
of backbone it will return backbone with its parent dependencies.