You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * * @param {string} text Markdown text with the values to be added * @returns {Array<number>} A list with all the found amounts in the markdown `text` */functiongetAmountList(text){if(!text){return[];}constmatches=text.match(/-?([0-9]*)\.?([0-9]*)\.?([0-9]*),([0-9]{2})/gi);returnmatches==null
? []
: matches.map((amount)=>parseInt(amount.replace(/([^\-0-9]*)/gi,''),10)/100);}/** * * @param {Array<number>} amountList List with all amounts to be added * @returns {number} The sum of all items in the {amountList} */functionsumAmountList(amountList){returnamountList.reduce((sum,amount)=>sum+amount,0);}/** * * @param {string} text Markdown text with the values to be added * @returns {number} The sum of all items in the {amountList} */functiongetTotal(text){returnsumAmountList(getAmountList(text));}