From 2e304ed09a9b475187328803c5fa0f095a2deaf2 Mon Sep 17 00:00:00 2001 From: Tatu Wikman Date: Wed, 18 Dec 2024 13:33:30 +0200 Subject: [PATCH] better documentation deleteComma in isTextInPDF --- src/utils/file.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/file.ts b/src/utils/file.ts index 82045efe..36c44524 100644 --- a/src/utils/file.ts +++ b/src/utils/file.ts @@ -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} */ async isTextInPDF(filePath: string | null, text: string, deleteComma: boolean = false): Promise { @@ -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(' '))