source: frontend/node_modules/underscore/amd/countBy.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 372 bytes
Line 
1define(['./_group', './_has'], function (_group, _has) {
2
3 // Counts instances of an object that group by a certain criterion. Pass
4 // either a string attribute to count by, or a function that returns the
5 // criterion.
6 var countBy = _group(function(result, value, key) {
7 if (_has(result, key)) result[key]++; else result[key] = 1;
8 });
9
10 return countBy;
11
12});
Note: See TracBrowser for help on using the repository browser.