:cookie: 575 | @adelmahjoub |http://www.freecodecamp.com/adelmahjoub
f u n c t i o n r o w H e i g h t s ( rows ) {
r e t u r n rows . map ( f u n c t i o n ( row ) {
r e t u r n row . r e d u c e ( f u n c t i o n ( max , cell ) {
r e t u r n Math . max ( max , cell . m i n H e i g h t () ) ;
} , 0) ;
}) ;
}
f u n c t i o n c o l W i d t h s ( rows ) {
r e t u r n rows [0]. map ( f u n c t i o n (_ , i ) {
r e t u r n rows . r e d u c e ( f u n c t i o n ( max , row ) {
r e t u r n Math . max ( max , row [ i ]. m i n W i d t h () ) ;
} , 0) ;
}) ;
}
function rowHeights(rows) {
return rows.map(function(row) {
return row.reduce(function(map,cell) {
return Math.max(max, cell.minHeight());
}, 0);
});
}
function colWidths(rows) {
return rows[0].map(function(_, i) {
return rows.reduce(function(max, row) {
return Math.max(max, row[i].minWidth());
}, 0);
});
}