{"size": 1350, "ext": "js", "max_stars_repo_path": "src/utils/requests.js", "max_stars_repo_name": "ffont/FreesoundExplorer2", "max_stars_repo_stars_event_min_datetime": "2016-11-22T14:56:19.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-04T11:43:27.000Z", "max_issues_repo_path": "src/utils/requests.js", "max_issues_repo_name": "noVaSon/freesound-explorer", "max_issues_repo_issues_event_min_datetime": "2016-09-04T08:43:34.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-24T09:52:28.000Z", "max_forks_repo_path": "src/utils/requests.js", "max_forks_repo_name": "noVaSon/freesound-explorer", "max_forks_repo_forks_event_min_datetime": "2017-01-16T16:56:05.000Z", "max_forks_repo_forks_event_max_datetime": "2019-02-25T16:03:10.000Z"}
{"max_stars_count": 14, "max_issues_count": 63, "max_forks_count": 5, "avg_line_length": 25.4716981132, "max_line_length": 77, "alphanum_fraction": 0.5718518519}
export const loadJSON = (url) => new Promise((resolve, reject) => {
  const xhr = new XMLHttpRequest();
  xhr.open('get', url, true);
  xhr.responseType = 'json';
  xhr.onload = () => {
    const { status } = xhr;
    if (status === 200) {
      resolve(xhr.response);
    } else {
      reject(xhr.response);
    }
  };
  xhr.onerror = () => reject();
  xhr.send();
});

export const postJSON = (url, postData) => new Promise((resolve, reject) => {
  const xhr = new XMLHttpRequest();
  xhr.open('post', url, true);
  xhr.responseType = 'json';
  xhr.onload = () => {
    const { status } = xhr;
    if (status === 200) {
      resolve(xhr.response);
    } else {
      reject(xhr.response);
    }
  };
  xhr.onerror = () => reject();
  xhr.setRequestHeader('Content-type', 'application/json');
  xhr.send(JSON.stringify(postData));
});

export const loadBLOB = (url) => new Promise((resolve, reject) => {
  const xhr = new XMLHttpRequest();
  const response = {};
  xhr.open('get', url, true);
  xhr.responseType = 'blob';
  xhr.onload = () => {
    const { status } = xhr;
    if (status === 200) {
      const headers = xhr.getAllResponseHeaders();
      response.headers = headers;
      response.blob = xhr.response;
      resolve(response);
    } else {
      reject(xhr.response);
    }
  };
  xhr.onerror = () => reject();
  xhr.send();
});
