function shape( x ) {
	var out;
	var sh;
	var d;
	var i;

	// Note: we intentionally avoid rigorous ndarray checks to minimize performance impacts. This obviously means that non-ndarray-like objects can sneak through, but this is likely all right for the purposes of this function...
	if ( typeof x !== 'object' || x === null ) {
		throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
	}
	sh = x.shape;
	if ( !isCollection( sh ) ) {
		throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
	}
	// Copy the shape in order to avoid unintended mutation...
	out = [];
	for ( i = 0; i < sh.length; i++ ) {
		d = sh[ i ];
		if ( !isNonNegativeInteger( d ) ) {
			throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
		}
		out.push( d );
	}
	return out;
}
Returns the shape of a provided ndarray.

@param {ndarrayLike} x - input ndarray
@throws {TypeError} must provide an ndarray
@returns {NonNegativeIntegerArray} shape

@example
var zeros = require( '@stdlib/ndarray/zeros' );

var out = shape( zeros( [ 3, 3, 3 ] ) );
// returns [ 3, 3, 3 ]