{"size": 511, "ext": "js", "max_stars_repo_path": "lazysizesGulp/node_modules/git-remote-url/index.js", "max_stars_repo_name": "jameswquinn/posts", "max_stars_repo_stars_event_min_datetime": "2015-11-30T00:11:34.000Z", "max_stars_repo_stars_event_max_datetime": "2015-11-30T00:11:34.000Z", "max_issues_repo_path": "lazysizesGulp/node_modules/git-remote-url/index.js", "max_issues_repo_name": "jameswquinn/posts", "max_issues_repo_issues_event_min_datetime": "2019-10-30T13:08:53.000Z", "max_issues_repo_issues_event_max_datetime": "2020-08-20T14:24:17.000Z", "max_forks_repo_path": "index.js", "max_forks_repo_name": "marco-c/git-remote-url", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 11, "max_forks_count": null, "avg_line_length": 24.3333333333, "max_line_length": 92, "alphanum_fraction": 0.5909980431}
'use strict';

var gitconfiglocal = require('gitconfiglocal');

module.exports = function(dir, remote) {
  return new Promise(function(resolve, reject) {
    gitconfiglocal(dir, function(error, config) {
      if (error) {
        reject(error);
        return;
      }

      if ('remote' in config && remote in config.remote && 'url' in config.remote[remote]) {
        resolve(config.remote[remote].url);
      } else {
        reject(new Error(remote + ' remote doesn\'t exist.'));
      }
    });
  });
};
