From bc44e1018e80bb655b8ef367250c7b2610c729a0 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Fri, 2 Oct 2020 12:31:21 +0700 Subject: [PATCH] jsdoc --- index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/index.js b/index.js index 1a88f6c..030ca52 100644 --- a/index.js +++ b/index.js @@ -235,6 +235,19 @@ function calculateBaseBillAmount(detailSplitted, customKeywords, productKeyval, } /** + * get bill count using number of occurence of spliter + * @date 2020-10-02 + * @param {Object} detailSplitted + * @param {string} customKeyword + * @returns {number} + */ +function getBillCountUsingCounter(detailSplitted, customKeyword) { + if (!detailSplitted) return 0; + + return ((customKeyword && detailSplitted[customKeyword]) || '').split(',').length; +} + +/** * get bill count from splitted detail * @date 2020-10-02 * @param {Object} detailSplitted @@ -264,3 +277,4 @@ exports.getDetailFromMessage = getDetailFromMessage; exports.splitPostpaidDetail = splitPostpaidDetail; exports.calculateBaseBillAmount = calculateBaseBillAmount; exports.getBillCount = getBillCount; +exports.getBillCountUsingCounter = getBillCountUsingCounter; \ No newline at end of file -- 1.9.0