static/js/util.js
/**
 * List categories and their frequencies from a category-type column.
 * @function listCats
 * @param {Array} arr - categorical column
 * @returns {Object} category to frequency map
 */
List categories and their frequencies from a category-type column.
@function listCats
@param {Array} arr - categorical column
@returns {Object} category to frequency map
List categories and their frequencies from a category - type column . @function listCats @param { Array } arr - categorical column @returns { Object } category to frequency map
function listCats(arr) {
  const res = {};
  const n = arr.length;
  let cat;
  for (let i = 0; i < n; i++) {
    cat = arr[i];
    if (cat) {
      res[cat] = (res[cat] || 0) + 1;
    }
  }
  return res;
}
function listCats ( arr ) { const res = { } ; const n = arr . length ; let cat ; for ( let i = 0 ; i < n ; i ++ ) { cat = arr [ i ] ; if ( cat ) { res [ cat ] = ( res [ cat ] || 0 ) + 1 ; } } return res ; }
List categories and their frequencies from a category-type column.
List categories and their frequencies from a category - type column .