Skip to content

Commit

Permalink
feat(): add summ function
Browse files Browse the repository at this point in the history
  • Loading branch information
hopetambala committed May 20, 2019
1 parent 837f531 commit 526402a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/js/providers/Functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ export function formatDate(date) {
return [year, month, day].join('-');
}

export function sum(obj) {
var sum = 0;
for( var el in obj ) {
if( obj.hasOwnProperty( el ) ) {
sum += parseFloat( obj[el] );
}
}
return sum;
}

export function removeBlanksByKey(arrObjects, key) {
for (let i =0; i< arrObjects.length; i++){
if (arrObjects[i][key] === "" || arrObjects[i][key] === " ") {
Expand Down

0 comments on commit 526402a

Please sign in to comment.