File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed
lib/node_modules/@stdlib/ndarray/base/assert/is-integer-data-type Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ var isIntegerDataType = require( '@stdlib/ndarray/base/assert/is-integer-data-ty
42
42
43
43
#### isIntegerDataType( value )
44
44
45
- Tests if an input ` value ` is a supported ndarray integer (i.e., signed or unsigned integer) data type.
45
+ Tests if an input value is a supported ndarray integer (i.e., signed or unsigned integer) data type.
46
46
47
47
``` javascript
48
48
var bool = isIntegerDataType ( ' float32' );
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 ( 'integer' ) ) ;
30
+
31
+
27
32
// MAIN //
28
33
29
34
/**
30
35
* Tests whether an input value is a supported ndarray integer data type.
31
36
*
32
- * @name isIntegerDataType
33
- * @type {Function }
34
37
* @param {* } v - value to test
35
38
* @returns {boolean } boolean indicating whether an input value is a supported ndarray integer data type
36
39
*
@@ -71,7 +74,9 @@ var dtypes = require( '@stdlib/ndarray/dtypes' );
71
74
* bool = isIntegerDataType( 'foo' );
72
75
* // returns false
73
76
*/
74
- var isIntegerDataType = contains ( dtypes ( 'integer' ) ) ;
77
+ function isIntegerDataType ( 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 isIntegerDataType = require ( './../lib' ) ;
25
26
26
27
@@ -44,7 +45,15 @@ tape( 'the function returns `true` if provided a supported ndarray integer data
44
45
'uint8c' ,
45
46
'int16' ,
46
47
'int32' ,
47
- 'int8'
48
+ 'int8' ,
49
+
50
+ new DataType ( 'uint16' ) ,
51
+ new DataType ( 'uint32' ) ,
52
+ new DataType ( 'uint8' ) ,
53
+ new DataType ( 'uint8c' ) ,
54
+ new DataType ( 'int16' ) ,
55
+ new DataType ( 'int32' ) ,
56
+ new DataType ( 'int8' )
48
57
] ;
49
58
for ( i = 0 ; i < values . length ; i ++ ) {
50
59
bool = isIntegerDataType ( values [ i ] ) ;
@@ -67,6 +76,8 @@ tape( 'the function returns `false` if not provided a supported ndarray integer
67
76
'float64' ,
68
77
'generic' ,
69
78
79
+ new DataType ( 'binary' ) ,
80
+
70
81
// Unsupported dtypes:
71
82
'float' ,
72
83
'int' ,
You can’t perform that action at this time.
0 commit comments