'use strict';

// MODULES //

var indexOf = require( '@stdlib/utils/index-of' );
var orders = require( '@stdlib/types/ndarray/base/orders' );


// VARIABLES //

var ORDERS = orders();


// MAIN //

/**
* Tests whether an input value is an ndarray order.
*
* @param {*} v - value to test
* @returns {boolean} boolean indicating whether an input value is an ndarray order
*
* @example
* var bool = isOrder( 'row-major' );
* // returns true
*
* bool = isOrder( 'column-major' );
* // returns true
*
* bool = isOrder( 'foo' );
* // returns false
*/
function isOrder( v ) {
	return ( indexOf( ORDERS, v ) !== -1 );
} // end FUNCTION isOrder()


// EXPORTS //

module.exports = isOrder;

'use strict';

// MODULES //

var orders = require( '@stdlib/types/ndarray/base/orders' );


// VARIABLES //

var ORDERS = orders();
var len = ORDERS.length;


// MAIN //

/**
* Tests whether an input value is an ndarray order.
*
* @param {*} v - value to test
* @returns {boolean} boolean indicating whether an input value is an ndarray order
*
* @example
* var bool = isOrder( 'row-major' );
* // returns true
*
* bool = isOrder( 'column-major' );
* // returns true
*
* bool = isOrder( 'foo' );
* // returns false
*/
function isOrder( v ) {
	var i;
	for ( i = 0; i < len; i++ ) {
		if ( v === ORDERS[ i ] ) {
			return true;
		}
	}
	return false;
} // end FUNCTION isOrder()


// EXPORTS //

module.exports = isOrder;

Refactor to inline value search
Refactor to inline value search
