mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Remove semicolons.
This commit is contained in:
18
countBy.js
18
countBy.js
@@ -1,8 +1,8 @@
|
||||
import baseAssignValue from './.internal/baseAssignValue.js';
|
||||
import reduce from './reduce.js';
|
||||
import baseAssignValue from './.internal/baseAssignValue.js'
|
||||
import reduce from './reduce.js'
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
|
||||
/**
|
||||
* Creates an object composed of keys generated from the results of running
|
||||
@@ -17,18 +17,18 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
* @returns {Object} Returns the composed aggregate object.
|
||||
* @example
|
||||
*
|
||||
* countBy([6.1, 4.2, 6.3], Math.floor);
|
||||
* countBy([6.1, 4.2, 6.3], Math.floor)
|
||||
* // => { '4': 1, '6': 2 }
|
||||
*/
|
||||
function countBy(collection, iteratee) {
|
||||
return reduce(collection, (result, value, key) => {
|
||||
if (hasOwnProperty.call(result, key)) {
|
||||
++result[key];
|
||||
++result[key]
|
||||
} else {
|
||||
baseAssignValue(result, key, 1);
|
||||
baseAssignValue(result, key, 1)
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
return result
|
||||
}, {})
|
||||
}
|
||||
|
||||
export default countBy;
|
||||
export default countBy
|
||||
|
||||
Reference in New Issue
Block a user