Skip to content

Commit 264a2fc

Browse files
committed
refactor: use base array utility
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 17af682 commit 264a2fc

File tree

1 file changed

+4
-15
lines changed
  • lib/node_modules/@stdlib/ndarray/base/assert/is-order/lib

1 file changed

+4
-15
lines changed

lib/node_modules/@stdlib/ndarray/base/assert/is-order/lib/main.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,17 @@
2020

2121
// MODULES //
2222

23+
var contains = require( '@stdlib/array/base/assert/contains' ).factory;
2324
var orders = require( '@stdlib/ndarray/orders' );
2425

2526

26-
// VARIABLES //
27-
28-
var ORDERS = orders();
29-
var len = ORDERS.length;
30-
31-
3227
// MAIN //
3328

3429
/**
3530
* Tests whether an input value is an ndarray order.
3631
*
32+
* @name isOrder
33+
* @type {Function}
3734
* @param {*} v - value to test
3835
* @returns {boolean} boolean indicating whether an input value is an ndarray order
3936
*
@@ -47,15 +44,7 @@ var len = ORDERS.length;
4744
* bool = isOrder( 'foo' );
4845
* // returns false
4946
*/
50-
function isOrder( v ) {
51-
var i;
52-
for ( i = 0; i < len; i++ ) {
53-
if ( v === ORDERS[ i ] ) {
54-
return true;
55-
}
56-
}
57-
return false;
58-
}
47+
var isOrder = contains( orders() );
5948

6049

6150
// EXPORTS //

0 commit comments

Comments
 (0)