@fuzzle/opencode-accountant 0.12.0 → 0.12.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.
- package/dist/index.js +3 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25915,9 +25915,9 @@ function parseExchangeRows(csvPath) {
|
|
|
25915
25915
|
if (fields.length < 9)
|
|
25916
25916
|
continue;
|
|
25917
25917
|
const [type2, , startedDate, , description, amountStr, , currency] = fields;
|
|
25918
|
-
if (type2 !== "EXCHANGE")
|
|
25918
|
+
if (type2?.toUpperCase() !== "EXCHANGE")
|
|
25919
25919
|
continue;
|
|
25920
|
-
if (
|
|
25920
|
+
if (!/^Exchanged to [A-Z]{3}$/.test(description ?? ""))
|
|
25921
25921
|
continue;
|
|
25922
25922
|
const rawAmount = parseFloat(amountStr);
|
|
25923
25923
|
const date5 = parseRevolutDatetime(startedDate);
|
|
@@ -25979,11 +25979,9 @@ function formatExchangeEntry(match2) {
|
|
|
25979
25979
|
const targetCurrency = target.currency;
|
|
25980
25980
|
const sourceAmount = formatAmount3(source.amount);
|
|
25981
25981
|
const targetAmount = formatAmount3(target.amount);
|
|
25982
|
-
const rate = target.amount / source.amount;
|
|
25983
|
-
const rateStr = formatRate(rate);
|
|
25984
25982
|
return [
|
|
25985
25983
|
`${date5} ${description}`,
|
|
25986
|
-
` assets:bank:revolut:${sourceCurrency.toLowerCase()} -${sourceAmount} ${sourceCurrency}
|
|
25984
|
+
` assets:bank:revolut:${sourceCurrency.toLowerCase()} -${sourceAmount} ${sourceCurrency}`,
|
|
25987
25985
|
` equity:currency:conversion ${sourceAmount} ${sourceCurrency}`,
|
|
25988
25986
|
` equity:currency:conversion -${targetAmount} ${targetCurrency}`,
|
|
25989
25987
|
` assets:bank:revolut:${targetCurrency.toLowerCase()} ${targetAmount} ${targetCurrency}`
|
|
@@ -25993,9 +25991,6 @@ function formatExchangeEntry(match2) {
|
|
|
25993
25991
|
function formatAmount3(amount) {
|
|
25994
25992
|
return amount.toFixed(2);
|
|
25995
25993
|
}
|
|
25996
|
-
function formatRate(rate) {
|
|
25997
|
-
return rate.toFixed(4);
|
|
25998
|
-
}
|
|
25999
25994
|
function isDuplicate2(match2, journalContent) {
|
|
26000
25995
|
const date5 = match2.source.dateStr;
|
|
26001
25996
|
const description = match2.source.description;
|