@ashray.mehta/statement-converter 1.5.3 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,9 +56,9 @@ class ABNAdapter extends TransactionAdapter_1.TransactionAdapter {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
57
  const workBook = XLSX.read(xlsxData, { raw: true, type: 'array' });
58
58
  const sheet = workBook.Sheets[workBook.SheetNames[0]];
59
- const addressForTransactionDate = XLSXUtil_1.XLSXUtil.findText(sheet, "transactiondate");
60
- const addressForDescription = XLSXUtil_1.XLSXUtil.findText(sheet, "description");
61
- const addressForAmount = XLSXUtil_1.XLSXUtil.findText(sheet, "amount");
59
+ const addressForTransactionDate = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "transactiondate");
60
+ const addressForDescription = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "description");
61
+ const addressForAmount = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "amount");
62
62
  const startingRow = addressForTransactionDate.r + 1;
63
63
  const range = XLSX.utils.decode_range(sheet['!ref']);
64
64
  const rangeEnd = range.e;
@@ -56,10 +56,10 @@ class AxisAdapter extends TransactionAdapter_1.TransactionAdapter {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
57
  const workBook = XLSX.read(xlsxData, { raw: true, type: 'array' });
58
58
  const sheet = workBook.Sheets[workBook.SheetNames[0]];
59
- const addressForTransactionDate = XLSXUtil_1.XLSXUtil.findText(sheet, "Tran Date");
60
- const addressForDetails = XLSXUtil_1.XLSXUtil.findText(sheet, "PARTICULARS");
61
- const addressForDepositAmount = XLSXUtil_1.XLSXUtil.findText(sheet, "CR");
62
- const addressForWithdrawalAmount = XLSXUtil_1.XLSXUtil.findText(sheet, "DR");
59
+ const addressForTransactionDate = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Tran Date");
60
+ const addressForDetails = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "PARTICULARS");
61
+ const addressForDepositAmount = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "CR");
62
+ const addressForWithdrawalAmount = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "DR");
63
63
  const startingRow = addressForTransactionDate.r + 1;
64
64
  const range = XLSX.utils.decode_range(sheet['!ref']);
65
65
  const rangeEnd = range.e;
@@ -57,13 +57,13 @@ class ICICIAdapter extends TransactionAdapter_1.TransactionAdapter {
57
57
  var _a;
58
58
  const workBook = XLSX.read(xlsxData, { raw: true, type: 'array' });
59
59
  const sheet = workBook.Sheets[workBook.SheetNames[0]];
60
- const addressForTransactionDate = XLSXUtil_1.XLSXUtil.findText(sheet, "Transaction Date");
61
- const addressForDetails = (_a = XLSXUtil_1.XLSXUtil.findText(sheet, "Transaction Remark")) !== null && _a !== void 0 ? _a : XLSXUtil_1.XLSXUtil.findText(sheet, "Transaction Remarks");
62
- const addressForAmount = XLSXUtil_1.XLSXUtil.findText(sheet, "Amount (INR)");
63
- const addressForCreditOrDebit = XLSXUtil_1.XLSXUtil.findText(sheet, "CR/DR");
64
- const addressForWithdrawal = XLSXUtil_1.XLSXUtil.findText(sheet, "Withdrawal Amount (INR )");
65
- const addressForDeposit = XLSXUtil_1.XLSXUtil.findText(sheet, "Deposit Amount (INR )");
66
- const addressForLegend = XLSXUtil_1.XLSXUtil.findText(sheet, "Legends Used in Account Statement");
60
+ const addressForTransactionDate = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Transaction Date");
61
+ const addressForDetails = (_a = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Transaction Remark")) !== null && _a !== void 0 ? _a : XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Transaction Remarks");
62
+ const addressForAmount = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Amount (INR)");
63
+ const addressForCreditOrDebit = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "CR/DR");
64
+ const addressForWithdrawal = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Withdrawal Amount(INR)");
65
+ const addressForDeposit = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Deposit Amount(INR)");
66
+ const addressForLegend = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Legends Used in Account Statement");
67
67
  const startingRow = addressForTransactionDate.r + 1;
68
68
  const range = XLSX.utils.decode_range(sheet['!ref']);
69
69
  let lastRow;
@@ -57,11 +57,11 @@ class ICICICreditCardAdapter extends TransactionAdapter_1.TransactionAdapter {
57
57
  var _a, _b, _c, _d, _e;
58
58
  const workBook = XLSX.read(xlsxData, { raw: true, type: 'array' });
59
59
  const sheet = workBook.Sheets[workBook.SheetNames[0]];
60
- const addressForTransactionDate = (_a = XLSXUtil_1.XLSXUtil.findText(sheet, "Transaction Date")) !== null && _a !== void 0 ? _a : XLSXUtil_1.XLSXUtil.findText(sheet, 'Date');
61
- const addressForDetails = (_b = XLSXUtil_1.XLSXUtil.findText(sheet, "Details")) !== null && _b !== void 0 ? _b : XLSXUtil_1.XLSXUtil.findText(sheet, 'Transaction Details');
62
- const addressForAmount = (_d = (_c = XLSXUtil_1.XLSXUtil.findText(sheet, "Amount (INR)")) !== null && _c !== void 0 ? _c : XLSXUtil_1.XLSXUtil.findText(sheet, 'Amount(in Rs)')) !== null && _d !== void 0 ? _d : XLSXUtil_1.XLSXUtil.findText(sheet, 'Intl.Amount');
63
- const addressForReferenceNumber = (_e = XLSXUtil_1.XLSXUtil.findText(sheet, "Reference Number")) !== null && _e !== void 0 ? _e : XLSXUtil_1.XLSXUtil.findText(sheet, 'Sr.No.');
64
- const addressForCreditOrDebit = XLSXUtil_1.XLSXUtil.findText(sheet, "BillingAmountSign");
60
+ const addressForTransactionDate = (_a = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Transaction Date")) !== null && _a !== void 0 ? _a : XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, 'Date');
61
+ const addressForDetails = (_b = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Details")) !== null && _b !== void 0 ? _b : XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, 'Transaction Details');
62
+ const addressForAmount = (_d = (_c = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Amount (INR)")) !== null && _c !== void 0 ? _c : XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, 'Amount(in Rs)')) !== null && _d !== void 0 ? _d : XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, 'Intl.Amount');
63
+ const addressForReferenceNumber = (_e = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Reference Number")) !== null && _e !== void 0 ? _e : XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, 'Sr.No.');
64
+ const addressForCreditOrDebit = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "BillingAmountSign");
65
65
  const startingRow = addressForTransactionDate.r + 1;
66
66
  const range = XLSX.utils.decode_range(sheet['!ref']);
67
67
  const rangeEnd = range.e;
@@ -56,11 +56,11 @@ class N26Adapter extends TransactionAdapter_1.TransactionAdapter {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
57
  const workBook = XLSX.read(xlsxData, { raw: true, type: 'array' });
58
58
  const sheet = workBook.Sheets[workBook.SheetNames[0]];
59
- const addressForTransactionDate = XLSXUtil_1.XLSXUtil.findText(sheet, "Booking Date");
60
- const addressForDescription = XLSXUtil_1.XLSXUtil.findText(sheet, "Payment Reference");
61
- const addressForAmount = XLSXUtil_1.XLSXUtil.findText(sheet, "Amount (EUR)");
62
- const addressForPayee = XLSXUtil_1.XLSXUtil.findText(sheet, "Partner Name");
63
- const addressForCategory = XLSXUtil_1.XLSXUtil.findText(sheet, "Type");
59
+ const addressForTransactionDate = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Booking Date");
60
+ const addressForDescription = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Payment Reference");
61
+ const addressForAmount = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Amount (EUR)");
62
+ const addressForPayee = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Partner Name");
63
+ const addressForCategory = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Type");
64
64
  const startingRow = addressForTransactionDate.r + 1;
65
65
  const range = XLSX.utils.decode_range(sheet['!ref']);
66
66
  const rangeEnd = range.e;
@@ -56,10 +56,10 @@ class StandardCharteredAdapter extends TransactionAdapter_1.TransactionAdapter {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
57
  const workBook = XLSX.read(xlsxData, { raw: true, type: 'array' });
58
58
  const sheet = workBook.Sheets[workBook.SheetNames[0]];
59
- const addressForTransactionDate = XLSXUtil_1.XLSXUtil.findText(sheet, "Date");
60
- const addressForDetails = XLSXUtil_1.XLSXUtil.findText(sheet, "Transaction");
61
- const addressForDepositAmount = XLSXUtil_1.XLSXUtil.findText(sheet, "Deposit");
62
- const addressForWithdrawalAmount = XLSXUtil_1.XLSXUtil.findText(sheet, "Withdrawal");
59
+ const addressForTransactionDate = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Date");
60
+ const addressForDetails = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Transaction");
61
+ const addressForDepositAmount = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Deposit");
62
+ const addressForWithdrawalAmount = XLSXUtil_1.XLSXUtil.findTextIgnoringWhitespace(sheet, "Withdrawal");
63
63
  const startingRow = addressForTransactionDate.r + 1;
64
64
  const range = XLSX.utils.decode_range(sheet['!ref']);
65
65
  const rangeEnd = range.e;
@@ -1,6 +1,6 @@
1
1
  import { CellAddress, WorkSheet } from 'xlsx';
2
2
  export declare class XLSXUtil {
3
- static findText(sheet: WorkSheet, text: string): CellAddress;
3
+ static findTextIgnoringWhitespace(sheet: WorkSheet, text: string): CellAddress;
4
4
  static getCellValue(sheet: WorkSheet, row: number, column: number): string | number | boolean;
5
5
  static getNumberInCell(sheet: WorkSheet, row: number, column: number): number;
6
6
  }
@@ -5,7 +5,7 @@ const lodash_es_1 = require("lodash-es");
5
5
  const NumberUtil_1 = require("./NumberUtil");
6
6
  const xlsx_1 = require("xlsx");
7
7
  class XLSXUtil {
8
- static findText(sheet, text) {
8
+ static findTextIgnoringWhitespace(sheet, text) {
9
9
  const range = xlsx_1.utils.decode_range(sheet['!ref']);
10
10
  const rangeEnd = range.e;
11
11
  const rangeStart = range.s;
@@ -17,7 +17,9 @@ class XLSXUtil {
17
17
  const cell = sheet[cellAddress];
18
18
  if (!(cell.t == 's' || cell.t == 'str'))
19
19
  continue;
20
- if ((0, lodash_es_1.trim)(cell.v) === (0, lodash_es_1.trim)(text))
20
+ if ((0, lodash_es_1.isEmpty)(cell.v))
21
+ continue;
22
+ if (cell.v.replace(/\s/g, '') === text.replace(/\s/g, ''))
21
23
  return xlsx_1.utils.decode_cell(cellAddress);
22
24
  }
23
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ashray.mehta/statement-converter",
3
- "version": "1.5.3",
3
+ "version": "1.6.1",
4
4
  "description": "Library to convert statements from frequently used banks to QIF.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -33,12 +33,12 @@
33
33
  "@types/globalize": "1.5.5",
34
34
  "@types/mocha": "10.0.10",
35
35
  "@types/moment": "2.13.0",
36
- "@types/node": "24.0.13",
36
+ "@types/node": "24.3.0",
37
37
  "@types/yargs": "17.0.33",
38
- "chai": "5.2.1",
39
- "mocha": "11.7.1",
38
+ "chai": "6.0.1",
39
+ "mocha": "11.7.2",
40
40
  "ts-node": "10.9.2",
41
- "tsx": "4.20.3",
42
- "typescript": "5.8.3"
41
+ "tsx": "4.20.5",
42
+ "typescript": "5.9.2"
43
43
  }
44
44
  }