{"size": 579, "ext": "js", "max_stars_repo_path": "src/loadFile.js", "max_stars_repo_name": "OHIF/config-point", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/loadFile.js", "max_issues_repo_name": "OHIF/config-point", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/loadFile.js", "max_forks_repo_name": "OHIF/config-point", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 36.1875, "max_line_length": 106, "alphanum_fraction": 0.7150259067}
import JSON5 from "json5";
import ConfigPoint from ".";

/**
 * Loads the given file name object.  Expected to have a resolved filename object (eg full path).
 * Only works in the context of NodeJS, or other environments containing an fs object used to load things.
 * @param fileName is the fully resolved path name for a JSON5 loadable file.
 * @param fs is the nodejs promises version of the file loader.
 */
export default (fileName, fs) => {
  return fs.readFile(fileName).then((text) => {
    const json = JSON5.parse(text);
    return ConfigPoint.register(json);
  });
};
