accounting-engine 0.1.2 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accounting-engine",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Bu paket, verilen faturanın, belirtilen kurallar çerçevesinde muhasebeleştirilmesini kolaylaştırmak adına oluşturulmuştur.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -45,16 +45,18 @@ const applyRules = async (rules, data, upperCondition = null) => {
45
45
  const invoice = data;
46
46
  const willPull = [];
47
47
  for await (const line of invoice.accounting_lines) {
48
- console.log(evalCondition);
49
48
  if (eval(evalCondition)) {
50
- console.log(true);
51
49
  willPull.push(_.findIndex(invoice.accounting_lines, line));
52
- returnData.forEach((item) => {
53
- resultLines.push({
54
- borc: eval(item.borc),
55
- alacak: eval(item.alacak),
56
- hesap_kodu: item.hesap_kodu,
50
+ returnData.forEach(async (item) => {
51
+ const r = {};
52
+ _.forEach(Object.keys(item), (key) => {
53
+ try {
54
+ r[key] = eval(item[key]);
55
+ } catch (error) {
56
+ r[key] = item[key];
57
+ }
57
58
  });
59
+ resultLines.push(r);
58
60
  });
59
61
  }
60
62
  }
@@ -208,7 +210,6 @@ const normalizeInvoiceForAccounting = async (invoice, direction) => {
208
210
  receiver_object: invoice.receiver_object,
209
211
  accounting_lines: accountingLines,
210
212
  };
211
- // console.log(data.accounting_lines[1]);
212
213
  return data;
213
214
  };
214
215