class NpmPackageParser extends ComponentSupport {

  @VisibleForTesting
  boolean isPackageJson(final ArchiveEntry entry) {
    if (entry.isDirectory()) {
      return false;
    }
    String name = entry.getName();
    if (name == null) {
      return false;
    }
    else if (!name.endsWith(PACKAGE_JSON_SUBPATH)) {
      return false; // not a package.json file
    }
    else if (name.startsWith(PACKAGE_JSON_SUBPATH)) {
      return false; // should not be at the root, should be under the path containing the actual package, whatever it is
    }
    else {
      return name.indexOf(PACKAGE_JSON_SUBPATH) == name.indexOf(SEPARATOR); // path should only be one directory deep
    }
  }

}