Commit bc44e1018e80bb655b8ef367250c7b2610c729a0

Authored by Adhidarma Hadiwinoto
1 parent 73169fa6c8
Exists in master

jsdoc

Showing 1 changed file with 14 additions and 0 deletions Side-by-side Diff

... ... @@ -235,6 +235,19 @@ function calculateBaseBillAmount(detailSplitted, customKeywords, productKeyval,
235 235 }
236 236  
237 237 /**
  238 + * get bill count using number of occurence of spliter
  239 + * @date 2020-10-02
  240 + * @param {Object} detailSplitted
  241 + * @param {string} customKeyword
  242 + * @returns {number}
  243 + */
  244 +function getBillCountUsingCounter(detailSplitted, customKeyword) {
  245 + if (!detailSplitted) return 0;
  246 +
  247 + return ((customKeyword && detailSplitted[customKeyword]) || '').split(',').length;
  248 +}
  249 +
  250 +/**
238 251 * get bill count from splitted detail
239 252 * @date 2020-10-02
240 253 * @param {Object} detailSplitted
... ... @@ -264,3 +277,4 @@ exports.getDetailFromMessage = getDetailFromMessage;
264 277 exports.splitPostpaidDetail = splitPostpaidDetail;
265 278 exports.calculateBaseBillAmount = calculateBaseBillAmount;
266 279 exports.getBillCount = getBillCount;
  280 +exports.getBillCountUsingCounter = getBillCountUsingCounter;
267 281 \ No newline at end of file