File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
lib/node_modules/@stdlib/ndarray/base/assert/is-mask-index-data-type Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,16 @@ var contains = require( '@stdlib/array/base/assert/contains' ).factory;
24
24
var dtypes = require ( '@stdlib/ndarray/dtypes' ) ;
25
25
26
26
27
+ // VARIABLES //
28
+
29
+ var isDataType = contains ( dtypes ( 'mask_index' ) ) ;
30
+
31
+
27
32
// MAIN //
28
33
29
34
/**
30
35
* Tests whether an input value is a supported ndarray mask index data type.
31
36
*
32
- * @name isMaskIndexDataType
33
- * @type {Function }
34
37
* @param {* } v - value to test
35
38
* @returns {boolean } boolean indicating whether an input value is a supported ndarray mask index data type
36
39
*
@@ -71,7 +74,9 @@ var dtypes = require( '@stdlib/ndarray/dtypes' );
71
74
* bool = isMaskIndexDataType( 'foo' );
72
75
* // returns false
73
76
*/
74
- var isMaskIndexDataType = contains ( dtypes ( 'mask_index' ) ) ;
77
+ function isMaskIndexDataType ( v ) {
78
+ return isDataType ( String ( v ) ) ;
79
+ }
75
80
76
81
77
82
// EXPORTS //
Original file line number Diff line number Diff line change 21
21
// MODULES //
22
22
23
23
var tape = require ( 'tape' ) ;
24
+ var DataType = require ( '@stdlib/ndarray/dtype-ctor' ) ;
24
25
var isMaskIndexDataType = require ( './../lib' ) ;
25
26
26
27
@@ -38,7 +39,8 @@ tape( 'the function returns `true` if provided a supported ndarray mask index da
38
39
var i ;
39
40
40
41
values = [
41
- 'uint8'
42
+ 'uint8' ,
43
+ new DataType ( 'uint8' )
42
44
] ;
43
45
for ( i = 0 ; i < values . length ; i ++ ) {
44
46
bool = isMaskIndexDataType ( values [ i ] ) ;
@@ -68,6 +70,8 @@ tape( 'the function returns `false` if not provided a supported ndarray mask ind
68
70
'generic' ,
69
71
'bool' ,
70
72
73
+ new DataType ( 'binary' ) ,
74
+
71
75
// Unsupported dtypes:
72
76
'float' ,
73
77
'int' ,
You can’t perform that action at this time.
0 commit comments