function ratiosToColumns( ratios, columnCount ) {
	// If we don't have more than 1 per column, just return a simple 1 ratio per column shape
	if ( ratios.length <= columnCount ) {
		return [ Array( ratios.length ).fill( 1 ) ];
	}

	const total = sum( ratios );
	const targetColRatio = total / columnCount;

	const row = [];
	let toProcess = ratios;
	let accumulatedRatio = 0;

	// We skip the last column in the loop and add rest later
	for ( let i = 0; i < columnCount - 1; i++ ) {
		const colSize = takeWhile( toProcess, ratio => {
			const shouldTake = accumulatedRatio <= ( i + 1 ) * targetColRatio;
			if ( shouldTake ) {
				accumulatedRatio += ratio;
			}
			return shouldTake;
		} ).length;
		row.push( colSize );
		toProcess = drop( toProcess, colSize );
	}

	// Don't calculate last column, just add what's left
	row.push( toProcess.length );

	// A shape is an array of rows. Wrap our row in an array.
	return [ row ];
}
/**
 * Build three columns, each of which should contain approximately 1/3 of the total ratio
 *
 * @param  {Array.<number>}         ratios      Ratios of images put into shape
 * @param  {number}                 columnCount Number of columns
 *
 * @return {Array.<Array.<number>>}             Shape of rows and columns
 */
Build three columns, each of which should contain approximately 1/3 of the total ratio
@param  {Array.}         ratios      Ratios of images put into shape
@param  {number}                 columnCount Number of columns

@return {Array.>}             Shape of rows and columns
Build three columns each of which should contain approximately 1 / 3 of the total ratio @param { Array . } ratios Ratios of images put into shape @param { number } columnCount Number of columns @return { Array . > } Shape of rows and columns
function ratiosToColumns( ratios, columnCount ) {
	if ( ratios.length <= columnCount ) {
		return [ Array( ratios.length ).fill( 1 ) ];
	}
	const total = sum( ratios );
	const targetColRatio = total / columnCount;
	const row = [];
	let toProcess = ratios;
	let accumulatedRatio = 0;
	for ( let i = 0; i < columnCount - 1; i++ ) {
		const colSize = takeWhile( toProcess, ratio => {
			const shouldTake = accumulatedRatio <= ( i + 1 ) * targetColRatio;
			if ( shouldTake ) {
				accumulatedRatio += ratio;
			}
			return shouldTake;
		} ).length;
		row.push( colSize );
		toProcess = drop( toProcess, colSize );
	}
	row.push( toProcess.length );
	return [ row ];
}
function ratiosToColumns ( ratios , columnCount ) { if ( ratios . length <= columnCount ) { return [ Array ( ratios . length ) . fill ( 1 ) ] ; } const total = sum ( ratios ) ; const targetColRatio = total / columnCount ; const row = [ ] ; let toProcess = ratios ; let accumulatedRatio = 0 ; for ( let i = 0 ; i < columnCount - 1 ; i ++ ) { const colSize = takeWhile ( toProcess , ratio => { const shouldTake = accumulatedRatio <= ( i + 1 ) * targetColRatio ; if ( shouldTake ) { accumulatedRatio += ratio ; } return shouldTake ; } ) . length ; row . push ( colSize ) ; toProcess = drop ( toProcess , colSize ) ; } row . push ( toProcess . length ) ; return [ row ] ; }
Build three columns, each of which should contain approximately 1/3 of the total ratio
 @param  {Array.<number>}         ratios      Ratios of images put into shape
 @param  {number}                 columnCount Number of columns
Build three columns each of which should contain approximately 1 / 3 of the total ratio @param { Array . <number > } ratios Ratios of images put into shape @param { number } columnCount Number of columns
// If we don't have more than 1 per column, just return a simple 1 ratio per column shape // We skip the last column in the loop and add rest later // Don't calculate last column, just add what's left // A shape is an array of rows. Wrap our row in an array.