{"size": 519, "ext": "js", "max_stars_repo_path": "lib/pdfToText.js", "max_stars_repo_name": "lad338/cv-analyzer", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/pdfToText.js", "max_issues_repo_name": "lad338/cv-analyzer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/pdfToText.js", "max_forks_repo_name": "lad338/cv-analyzer", "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": 25.95, "max_line_length": 46, "alphanum_fraction": 0.5857418112}
const extract = require('pdf-text-extract');
module.exports = {
   async extractPdfByPath(filePath) {
    return new Promise( (resolve, reject) => {
      extract(filePath, (err, pages) => {
        if (err) { return reject (err); }
        resolve(pages);
      });
    })
  },
  cleansePdfText (extractedPdfText) {
     let result = extractedPdfText;
     if (Array.isArray(extractedPdfText)) {
       result = extractedPdfText.join(' ');
     }
     result = result.replace(/\s\s+/g, ' ');
     return result;
  }
}
