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