static/js/util.js
/**
 * Group indices of an array by unique elements, while skipping false values
 * @function arrGroupByF
 * @param {Array} arr - input array
 * @returns {Object} output object
 */
Group indices of an array by unique elements, while skipping false values
@function arrGroupByF
@param {Array} arr - input array
@returns {Object} output object
Group indices of an array by unique elements while skipping false values @function arrGroupByF @param { Array } arr - input array @returns { Object } output object
function arrGroupByF(arr) {
  const res = {};
  const n = arr.length;
  let item;
  for (let i = 0; i < n; i++) {
    item = arr[i];
    if (item) {
      if (item in res) res[item].push(i);
      else res[item] = [i];
    }
  }
  return res;
}
function arrGroupByF ( arr ) { const res = { } ; const n = arr . length ; let item ; for ( let i = 0 ; i < n ; i ++ ) { item = arr [ i ] ; if ( item ) { if ( item in res ) res [ item ] . push ( i ) ; else res [ item ] = [ i ] ; } } return res ; }
Group indices of an array by unique elements, while skipping false values
 @function arrGroupByF
 @param {Array} arr - input array
 @returns {Object} output object
Group indices of an array by unique elements while skipping false values @function arrGroupByF @param { Array } arr - input array @returns { Object } output object