function order( x ) {
	var st;
	var o;

	// 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 ) );
	}
	o = x.order;
	if ( isOrder( o ) ) {
		return o;
	}
	// Try to infer the layout order from the strides array...
	st = strides( x );
	o = strides2order( st );
	if ( o === 1 || o === 3 ) {
		return ROW_MAJOR; // for o == 3 (both row- and column-major; e.g., one-dimensional ndarrays), default to row-major
	}
	if ( o === 2 ) {
		return COLUMN_MAJOR;
	}
	// o === 0
	if ( ndims( x ) === 0 ) {
		return ROW_MAJOR; // default to row-major for zero-dimensional ndarrays
	}
	// Case: mixed strides (e.g., [ 2, 3, 1 ] )
	return null;
}
Returns the layout order of a provided ndarray.

@param {ndarrayLike} x - input ndarray
@throws {TypeError} must provide an ndarray
@returns {(string|null)} layout order

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

var x = zeros( [ 3, 3, 3 ], {
    'order': 'row-major'
});

var out = order( x );
// returns 'row-major'