123456789101112131415161718192021 |
- var groupBy = require('./groupBy')
- var objectEach = require('./objectEach')
- function countBy (obj, iterate, context) {
- var result = groupBy(obj, iterate, context || this)
- objectEach(result, function (item, key) {
- result[key] = item.length
- })
- return result
- }
- module.exports = countBy
|