Skip to content

Commit 35c585c

Browse files
committed
refactor: use assertion 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 9333f71 commit 35c585c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • lib/node_modules/@stdlib/ndarray/base/ndims/lib

lib/node_modules/@stdlib/ndarray/base/ndims/lib/main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -34,7 +39,7 @@
3439
*/
3540
function ndims( x ) {
3641
var n = x.ndims; // Note: intentionally cache in case `ndims` is lazily resolved via accessor
37-
if ( typeof n === 'number' ) {
42+
if ( isNumber( n ) ) {
3843
return n;
3944
}
4045
return x.shape.length;

0 commit comments

Comments
 (0)