Skip to content

Commit 4b2411e

Browse files
committed
test: add main tests
--- 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: passed - 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 32787d4 commit 4b2411e

File tree

3 files changed

+1408
-5
lines changed

3 files changed

+1408
-5
lines changed

lib/node_modules/@stdlib/blas/ext/index-of/lib/assign.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2424
var objectAssign = require( '@stdlib/object/assign' );
25+
var isObject = require( '@stdlib/assert/is-object' );
2526
var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
2627
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
2728
var broadcastScalar = require( '@stdlib/ndarray/base/broadcast-scalar' );
@@ -136,6 +137,9 @@ function assign( x, searchElement, fromIndex, out, options ) {
136137
out = fromIndex;
137138
fromIndex = 0;
138139
} else if ( nargs === 5 ) {
140+
if ( !isObject( options ) ) {
141+
throw new TypeError( format( 'invalid argument. The fifth argument must be an object. Value: `%s`.', options ) );
142+
}
139143
opts = objectAssign( opts, options );
140144
}
141145

lib/node_modules/@stdlib/blas/ext/index-of/lib/main.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2424
var objectAssign = require( '@stdlib/object/assign' );
25+
var isObject = require( '@stdlib/assert/is-object' );
2526
var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
2627
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
2728
var broadcastScalar = require( '@stdlib/ndarray/base/broadcast-scalar' );
@@ -96,15 +97,15 @@ function indexOf( x, searchElement, fromIndex, options ) {
9697
var dt;
9798
var sh;
9899

100+
if ( !isndarrayLike( x ) ) {
101+
throw new TypeError( format( 'invalid argument. The first argument must be an ndarray-like object. Value: `%s`.', x ) );
102+
}
103+
99104
nargs = arguments.length;
100105
if ( nargs < 2 ) {
101106
throw new TypeError( format( 'invalid argument. The function must be provided at least two arguments. Value: `%s`.', nargs ) );
102107
}
103108

104-
if ( !isndarrayLike( x ) ) {
105-
throw new TypeError( format( 'invalid argument. The first argument must be an ndarray-like object. Value: `%s`.', x ) );
106-
}
107-
108109
// Resolve input ndarray meta data:
109110
dt = getDType( x );
110111
ord = getOrder( x );
@@ -120,13 +121,16 @@ function indexOf( x, searchElement, fromIndex, options ) {
120121
else if (
121122
nargs === 3 &&
122123
!isndarrayLike( fromIndex ) &&
123-
!isInteger( fromIndex )
124+
isObject( fromIndex )
124125
) {
125126
opts = objectAssign( opts, fromIndex );
126127
fromIndex = 0;
127128
}
128129
// Case: indexOf( x, searchElement, fromIndex, options )
129130
else if ( nargs === 4 ) {
131+
if ( !isObject( options ) ) {
132+
throw new TypeError( format( 'invalid argument. The fourth argument must be an object. Value: `%s`.', options ) );
133+
}
130134
opts = objectAssign( opts, options );
131135
}
132136

0 commit comments

Comments
 (0)