static/js/util.js
/**
 * List categories and their frequencies from a category-type column.
 * @function listCats
 * @param {Array} arr - category-type column
 * @returns {Object} - category to frequency map
 */
List categories and their frequencies from a category-type column.
@function listCats
@param {Array} arr - category-type column
@returns {Object} - category to frequency map
List categories and their frequencies from a category - type column . @function listCats @param { Array } arr - category - type column @returns { Object } - category to frequency map
function listCats(arr) {
  var res = {};
  arr.forEach(function (datum) {
    if (datum !== null) {
      if (datum[0] in res) res[datum[0]] ++;
      else res[datum[0]] = 1;
    }
  });
  return res;
}
function listCats ( arr ) { var res = { } ; arr . forEach ( function ( datum ) { if ( datum !== null ) { if ( datum [ 0 ] in res ) res [ datum [ 0 ] ] ++ ; else res [ datum [ 0 ] ] = 1 ; } } ) ; return res ; }
List categories and their frequencies from a category-type column.
List categories and their frequencies from a category - type column .