class NpmMetadataUtils {

  @Nullable
  public static NestedAttributesMap selectVersionByTarballName(
      final NestedAttributesMap packageRoot,
      final String tarballName)
  {
    String extractedTarballName = extractTarballName(tarballName);
    NestedAttributesMap versions = packageRoot.child(VERSIONS);
    for (String v : versions.keys()) {
      NestedAttributesMap version = versions.child(v);
      String versionTarballUrl = version.child(DIST).get(TARBALL, String.class);
      if (extractedTarballName.equals(extractTarballName(versionTarballUrl))) {
        return version;
      }
    }
    return null;
  }

  private  NpmMetadataUtils();

}