function stride( x, dim ) {
	var st;

	// 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 || !isCollection( x.shape ) ) {
		throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
	}
	if ( !isInteger( dim ) ) {
		throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', dim ) );
	}
	st = getStride( x, dim );
	if ( isInteger( st ) ) {
		return st;
	}
	// As ndarrays must have integer-valued strides, if the returned "stride" value is not integer-valued, assume we haven't been provided an ndarray:
	throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
}
Returns the stride along a specified dimension for a provided ndarray.

@param {ndarrayLike} x - input ndarray
@param {integer} dim - dimension index
@throws {TypeError} first argument must be an ndarray having one or more dimensions
@throws {TypeError} second argument must be an integer
@throws {RangeError} dimension index exceeds the number of dimensions
@returns {integer} stride

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

var out = stride( zeros( [ 3, 3, 3 ] ), 0 );
// returns 9