function getData(selector) { return $(selector || ‘table‘).map((x, y) => group(Array.from($(y).find(‘td‘)), $(y).find(‘tr:has(td):first td‘).length, console.log($(y).find(‘tr:has(td):first td‘).length)).map(a => Array.from(a).map(b => b.textContent)).filter(x => x.length != 0)) .filter(x => x.length != 0); }