Skip to content

Commit 599cf73

Browse files
committed
feat: add support for non-string data types
--- 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: passed - 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 41fca83 commit 599cf73

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

lib/node_modules/@stdlib/ndarray/base/assert/is-unsigned-integer-data-type/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var isUnsignedIntegerDataType = require( '@stdlib/ndarray/base/assert/is-unsigne
4242

4343
#### isUnsignedIntegerDataType( value )
4444

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.
4646

4747
```javascript
4848
var bool = isUnsignedIntegerDataType( 'float32' );

lib/node_modules/@stdlib/ndarray/base/assert/is-unsigned-integer-data-type/lib/main.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ var contains = require( '@stdlib/array/base/assert/contains' ).factory;
2424
var dtypes = require( '@stdlib/ndarray/dtypes' );
2525

2626

27+
// VARIABLES //
28+
29+
var isDataType = contains( dtypes( 'unsigned_integer' ) );
30+
31+
2732
// MAIN //
2833

2934
/**
3035
* Tests whether an input value is a supported ndarray unsigned integer data type.
3136
*
32-
* @name isUnsignedIntegerDataType
33-
* @type {Function}
3437
* @param {*} v - value to test
3538
* @returns {boolean} boolean indicating whether an input value is a supported ndarray unsigned integer data type
3639
*
@@ -71,7 +74,9 @@ var dtypes = require( '@stdlib/ndarray/dtypes' );
7174
* bool = isUnsignedIntegerDataType( 'foo' );
7275
* // returns false
7376
*/
74-
var isUnsignedIntegerDataType = contains( dtypes( 'unsigned_integer' ) );
77+
function isUnsignedIntegerDataType( v ) {
78+
return isDataType( String( v ) );
79+
}
7580

7681

7782
// EXPORTS //

lib/node_modules/@stdlib/ndarray/base/assert/is-unsigned-integer-data-type/test/test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24+
var DataType = require( '@stdlib/ndarray/ctor' );
2425
var isUnsignedIntegerDataType = require( './../lib' );
2526

2627

@@ -41,7 +42,12 @@ tape( 'the function returns `true` if provided a supported ndarray unsigned inte
4142
'uint16',
4243
'uint32',
4344
'uint8',
44-
'uint8c'
45+
'uint8c',
46+
47+
new DataType( 'uint16' ),
48+
new DataType( 'uint32' ),
49+
new DataType( 'uint8' ),
50+
new DataType( 'uint8c' )
4551
];
4652
for ( i = 0; i < values.length; i++ ) {
4753
bool = isUnsignedIntegerDataType( values[ i ] );
@@ -67,6 +73,8 @@ tape( 'the function returns `false` if not provided a supported ndarray unsigned
6773
'int32',
6874
'int8',
6975

76+
new DataType( 'binary' ),
77+
7078
// Unsupported dtypes:
7179
'float',
7280
'int',

0 commit comments

Comments
 (0)