Skip to content

Commit 41fca83

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 5a092db commit 41fca83

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

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

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

4343
#### isSignedIntegerDataType( value )
4444

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

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

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

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

7681

7782
// EXPORTS //

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

Lines changed: 8 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 isSignedIntegerDataType = require( './../lib' );
2526

2627

@@ -40,7 +41,11 @@ tape( 'the function returns `true` if provided a supported ndarray signed intege
4041
values = [
4142
'int16',
4243
'int32',
43-
'int8'
44+
'int8',
45+
46+
new DataType( 'int16' ),
47+
new DataType( 'int32' ),
48+
new DataType( 'int8' )
4449
];
4550
for ( i = 0; i < values.length; i++ ) {
4651
bool = isSignedIntegerDataType( values[ i ] );
@@ -67,6 +72,8 @@ tape( 'the function returns `false` if not provided a supported ndarray signed i
6772
'uint8',
6873
'uint8c',
6974

75+
new DataType( 'binary' ),
76+
7077
// Unsupported dtypes:
7178
'float',
7279
'int',

0 commit comments

Comments
 (0)