{"size": 344, "ext": "js", "max_stars_repo_path": "src/promisify-request.js", "max_stars_repo_name": "metalex9/indexed-db", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/promisify-request.js", "max_issues_repo_name": "metalex9/indexed-db", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/promisify-request.js", "max_forks_repo_name": "metalex9/indexed-db", "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": 28.6666666667, "max_line_length": 71, "alphanum_fraction": 0.6947674419}
import attachEventListener from './attach-event-listener';

const promisifyRequest = (request) =>
  new Promise((resolve, reject) => {
    attachEventListener(request, 'error', () => reject(request.error));
    attachEventListener(request, 'success', (event) =>
      resolve(event.target.result)
    );
  });

export default promisifyRequest;
