From 09e99f6add7eae5fb334bc6b8f02462f6800ef4a Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Fri, 2 Oct 2020 11:52:55 +0700 Subject: [PATCH] Verifikasi eksistensi detailSplitted pada getBillCount --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index a651bde..3ce5311 100644 --- a/index.js +++ b/index.js @@ -242,6 +242,8 @@ function calculateBaseBillAmount(detailSplitted, customKeywords, productKeyval, * @returns {number} */ function getBillCount(detailSplitted, customKeyword) { + if (!detailSplitted) return 0; + return Number( (customKeyword && detailSplitted[customKeyword]) || detailSplitted['JMLBLN'] -- 1.9.0