static/js/binning.js
/**
 * Find current bin.
 * @function currentBin
 * @param {Object} table - bin table
 * @returns {[number, string]} row index and name of current bin, or both null
 * if no bin is current
 * @description At most one bin can be current; meanwhile there can be multiple
 * selected bins.
 */
Find current bin.
@function currentBin
@param {Object} table - bin table
@returns {[number, string]} row index and name of current bin, or both null
if no bin is current
@description At most one bin can be current; meanwhile there can be multiple
selected bins.
Find current bin . @function currentBin @param { Object } table - bin table @returns { [ number string ] } row index and name of current bin or both null if no bin is current @description At most one bin can be current ; meanwhile there can be multiple selected bins .
function currentBin(table) {
  let idx;
  const rows = table.rows;
  const n = rows.length;
  for (let i = 0; i < n; i++) {
    if (rows[i].classList.contains('current')) {
      idx = i;
      break;
    }
  }
  if (idx === undefined) return [null, null];
  const name = rows[idx].cells[0].firstElementChild.innerHTML;
  return [idx, name];
}
function currentBin ( table ) { let idx ; const rows = table . rows ; const n = rows . length ; for ( let i = 0 ; i < n ; i ++ ) { if ( rows [ i ] . classList . contains ( 'current' ) ) { idx = i ; break ; } } if ( idx === undefined ) return [ null , null ] ; const name = rows [ idx ] . cells [ 0 ] . firstElementChild . innerHTML ; return [ idx , name ] ; }
Find current bin.
Find current bin .