Skip to content

Commit be5553d

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 3cb98f3 commit be5553d

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

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

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

4343
#### isBooleanDataType( value )
4444

45-
Tests if an input `value` is a supported ndarray boolean [data type][@stdlib/ndarray/dtypes].
45+
Tests if an input value is a supported ndarray boolean [data type][@stdlib/ndarray/dtypes].
4646

4747
```javascript
4848
var bool = isBooleanDataType( 'bool' );

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ 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( 'boolean' ) );
30+
31+
2732
// MAIN //
2833

2934
/**
@@ -74,7 +79,9 @@ var dtypes = require( '@stdlib/ndarray/dtypes' );
7479
* bool = isBooleanDataType( 'foo' );
7580
* // returns false
7681
*/
77-
var isBooleanDataType = contains( dtypes( 'boolean' ) );
82+
function isBooleanDataType( v ) {
83+
return isDataType( String( v ) );
84+
}
7885

7986

8087
// EXPORTS //

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

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

2627

@@ -38,7 +39,8 @@ tape( 'the function returns `true` if provided a supported ndarray boolean data
3839
var i;
3940

4041
values = [
41-
'bool'
42+
'bool',
43+
new DataType( 'bool' )
4244
];
4345
for ( i = 0; i < values.length; i++ ) {
4446
bool = isBooleanDataType( values[ i ] );
@@ -68,6 +70,8 @@ tape( 'the function returns `false` if not provided a supported ndarray boolean
6870
'int8',
6971
'generic',
7072

73+
new DataType( 'generic' ),
74+
7175
// Unsupported dtypes:
7276
'float',
7377
'int',

0 commit comments

Comments
 (0)