Skip to content

Commit 360ed63

Browse files
committed
feat: add support for non-string data tpes
--- 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 b60d327 commit 360ed63

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

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

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

4343
#### isIntegerDataType( value )
4444

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

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

lib/node_modules/@stdlib/ndarray/base/assert/is-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( 'integer' ) );
30+
31+
2732
// MAIN //
2833

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

7681

7782
// EXPORTS //

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

Lines changed: 12 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/dtype-ctor' );
2425
var isIntegerDataType = require( './../lib' );
2526

2627

@@ -44,7 +45,15 @@ tape( 'the function returns `true` if provided a supported ndarray integer data
4445
'uint8c',
4546
'int16',
4647
'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' )
4857
];
4958
for ( i = 0; i < values.length; i++ ) {
5059
bool = isIntegerDataType( values[ i ] );
@@ -67,6 +76,8 @@ tape( 'the function returns `false` if not provided a supported ndarray integer
6776
'float64',
6877
'generic',
6978

79+
new DataType( 'binary' ),
80+
7081
// Unsupported dtypes:
7182
'float',
7283
'int',

0 commit comments

Comments
 (0)