ran npm run tdd

This commit is contained in:
King
2018-01-15 10:58:44 -05:00
parent 56f977bf63
commit 58c65ecf1e
28 changed files with 247 additions and 0 deletions

5
test/countBy/countBy.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = countBy = (arr, fn) =>
arr.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val, i) => {
acc[val] = (acc[val] || 0) + 1;
return acc;
}, {});