-
-
Save jhs/1407764 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reduce:function(key, values, rereduce) { | |
function addPropertiesTogether(addTo,addFrom){ | |
for (var prop in addFrom) { | |
(addTo[prop] !== undefined) ? addTo[prop] += Number(addFrom[prop]): addTo[prop] = Number(addFrom[prop]); | |
} | |
return addTo; | |
}; | |
return values.reduce(addPropertiesTogether,{}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment