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