Skip to content

Commit

Permalink
Merge pull request #299 from tswfi/document_isTextInPDF_deleteComma
Browse files Browse the repository at this point in the history
better documentation deleteComma in isTextInPDF
  • Loading branch information
Progi1984 authored Dec 18, 2024
2 parents 0b3ed30 + 2e304ed commit ebfbe53
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default {
* Check text in PDF
* @param filePath {string|null} Path of the PDF file
* @param text {string} Text to check on the file
* @param deleteComma {boolean} True if we need to delete comma
* @param deleteComma {boolean} True if we need to delete comma. PDF to txt conversion adds comma where newlines are.
* @returns {Promise<boolean>}
*/
async isTextInPDF(filePath: string | null, text: string, deleteComma: boolean = false): Promise<boolean> {
Expand All @@ -120,6 +120,7 @@ export default {

const pageTexts = await Promise.all(pageTextPromises);

// delete commas from the page text. getPageTextFromPdf adds commas to newlines in some cases
if (deleteComma) {
return ((pageTexts.join(' ').split(/,\//).join('/').split(/,\s*,?/)
.join(' '))
Expand Down

0 comments on commit ebfbe53

Please sign in to comment.