import 'core-js/modules/es.object.to-string.js';
import 'core-js/modules/web.dom-collections.for-each.js';
import isEmpty from '../node_modules/lodash-es/isEmpty.js';

/**
 * Pushes row id to the provided array (including row children)
 *
 * @param {object} row A table row with id
 * @param {array} arrToFill An array that will be filled with all rows id
 */

var fillArrWithRowIds = function fillArrWithRowIds(row, arrToFill) {
  if (row.isSelectable !== false) {
    arrToFill.push(row.id);
  }
  if (!isEmpty(row.children)) {
    row.children.forEach(function (el) {
      return fillArrWithRowIds(el, arrToFill);
    });
  }
};

export { fillArrWithRowIds };
