function arrayShape( arr ) {
	var shape;
	var ndims;

	if ( !isArrayLikeObject( arr ) ) {
		throw new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', arr ) );
	}
	// Initialize the shape/dimensions array:
	shape = [ arr.length ];

	// Eagerly determine array dimensions:
	recurse( shape, arr );
	ndims = shape.length;

	// Check that all array element dimensions are consistent:
	if ( ndims > 1 ) {
		// If `check()` returns a value less than `ndims`, trim off the inconsistent dimensions:
		shape.length = check( ndims, shape, 1, arr, ndims > 2 );
	}
	return shape;
}
Determines (nested) array dimensions.

@param {ArrayLikeObject} arr - array
@throws {TypeError} must provide an array
@returns {Array} array shape

@example
var arr = [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ];

var shape = arrayShape( arr );
// returns [ 3, 3 ]

@example
var arr = [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8 ] ];

var shape = arrayShape( arr );
// returns [ 3 ]

@example
var arr = [ [ 1, 2, 3 ], [ 4, 5, 6 ], null ];

var shape = arrayShape( arr );
// returns [ 3 ]