client/extensions/woocommerce/lib/generate-variations/index.js
function cartesian( ...arrays ) {
	let i, j, l, m;
	const o = [];

	if ( ! arrays || arrays.length === 0 ) {
		return arrays;
	}
	const array1 = arrays.splice( 0, 1 )[ 0 ];
	arrays = cartesian( ...arrays );
	for ( i = 0, l = array1.length; i < l; i++ ) {
		if ( arrays && arrays.length ) {
			for ( j = 0, m = arrays.length; j < m; j++ ) {
				o.push( [ array1[ i ] ].concat( arrays[ j ] ) );
			}
		} else {
			o.push( [ array1[ i ] ] );
		}
	}
	return o;
}
function cartesian( ...arrays ) {
	let i, j, l, m;
	const o = [];

	if ( ! arrays || arrays.length === 0 ) {
		return arrays;
	}
	const array1 = arrays.splice( 0, 1 )[ 0 ];
	arrays = cartesian( ...arrays );
	for ( i = 0, l = array1.length; i < l; i++ ) {
		if ( arrays && arrays.length ) {
			for ( j = 0, m = arrays.length; j < m; j++ ) {
				o.push( [ array1[ i ] ].concat( arrays[ j ] ) );
			}
		} else {
			o.push( [ array1[ i ] ] );
		}
	}
	return o;
}
function cartesian ( ... arrays ) { let i , j , l , m ; const o = [ ] ; if ( ! arrays || arrays . length === 0 ) { return arrays ; } const array1 = arrays . splice ( 0 , 1 ) [ 0 ] ; arrays = cartesian ( ... arrays ) ; for ( i = 0 , l = array1 . length ; i < l ; i ++ ) { if ( arrays && arrays . length ) { for ( j = 0 , m = arrays . length ; j < m ; j ++ ) { o . push ( [ array1 [ i ] ] . concat ( arrays [ j ] ) ) ; } } else { o . push ( [ array1 [ i ] ] ) ; } } return o ; }
http://stackoverflow.com/a/29585704
http : // stackoverflow . com / a / 29585704