Skip to content

Commit 0b81405

Browse files
committed
Auto-generated commit
1 parent d82c047 commit 0b81405

File tree

25 files changed

+1555
-11
lines changed

25 files changed

+1555
-11
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-09-18)
7+
## Unreleased (2025-09-19)
88

99
<section class="features">
1010

1111
### Features
1212

13+
- [`fc43bac`](https://github.com/stdlib-js/stdlib/commit/fc43bac47c9c2419da27a568dce6d05e05dc904a) - add `isEqualDataType` to namespace
14+
- [`aa727fa`](https://github.com/stdlib-js/stdlib/commit/aa727fa586eed12d282eb46e49cdbd8e28e18712) - add `ndarray/base/assert/is-equal-data-type`
15+
- [`34a957c`](https://github.com/stdlib-js/stdlib/commit/34a957cac3f76bac1f00c5366802096b05c30e65) - add support for `DataType` instances
16+
- [`f89403b`](https://github.com/stdlib-js/stdlib/commit/f89403b0b93f16037e7a5c6aa7752efe9f7dd854) - add `isDataTypeObject` to namespace
17+
- [`c31794b`](https://github.com/stdlib-js/stdlib/commit/c31794b5f6f6c60db2c2f0f11ed274039db837a2) - add `ndarray/base/assert/is-data-type-object`
1318
- [`a814ceb`](https://github.com/stdlib-js/stdlib/commit/a814cebcda3422f9d2eebf58b57c955157c8422c) - add custom `valueOf` method
1419
- [`ba1c0f2`](https://github.com/stdlib-js/stdlib/commit/ba1c0f278e120cd42272fa2449bd13f045a469aa) - add `fillSlice` to namespace
1520
- [`f015917`](https://github.com/stdlib-js/stdlib/commit/f0159173d4db9e22bb1bd7c8b56c424b4d3e076e) - add `flattenBy` to namespace
@@ -388,6 +393,7 @@
388393

389394
### Bug Fixes
390395

396+
- [`a278663`](https://github.com/stdlib-js/stdlib/commit/a2786634547c68e950444c8a16d522d2ab79e335) - ensure \"generic\" data type objects are considered valid
391397
- [`f8e5205`](https://github.com/stdlib-js/stdlib/commit/f8e520591bc2a8d8436ebb4fbe1604a7376105cd) - use correct `sliceAssign` alias
392398
- [`08c21f1`](https://github.com/stdlib-js/stdlib/commit/08c21f19a3dc1c7352e4760c19c1ec8aab714b54) - update return type
393399
- [`97d7e56`](https://github.com/stdlib-js/stdlib/commit/97d7e567e463ab9942c9d1188bc0c5786827e09b) - update return type
@@ -546,6 +552,12 @@ A total of 24 issues were closed in this release:
546552

547553
<details>
548554

555+
- [`fc43bac`](https://github.com/stdlib-js/stdlib/commit/fc43bac47c9c2419da27a568dce6d05e05dc904a) - **feat:** add `isEqualDataType` to namespace _(by Athan Reines)_
556+
- [`aa727fa`](https://github.com/stdlib-js/stdlib/commit/aa727fa586eed12d282eb46e49cdbd8e28e18712) - **feat:** add `ndarray/base/assert/is-equal-data-type` _(by Athan Reines)_
557+
- [`a278663`](https://github.com/stdlib-js/stdlib/commit/a2786634547c68e950444c8a16d522d2ab79e335) - **fix:** ensure \"generic\" data type objects are considered valid _(by Athan Reines)_
558+
- [`34a957c`](https://github.com/stdlib-js/stdlib/commit/34a957cac3f76bac1f00c5366802096b05c30e65) - **feat:** add support for `DataType` instances _(by Athan Reines)_
559+
- [`f89403b`](https://github.com/stdlib-js/stdlib/commit/f89403b0b93f16037e7a5c6aa7752efe9f7dd854) - **feat:** add `isDataTypeObject` to namespace _(by Athan Reines)_
560+
- [`c31794b`](https://github.com/stdlib-js/stdlib/commit/c31794b5f6f6c60db2c2f0f11ed274039db837a2) - **feat:** add `ndarray/base/assert/is-data-type-object` _(by Athan Reines)_
549561
- [`a814ceb`](https://github.com/stdlib-js/stdlib/commit/a814cebcda3422f9d2eebf58b57c955157c8422c) - **feat:** add custom `valueOf` method _(by Athan Reines)_
550562
- [`e700afd`](https://github.com/stdlib-js/stdlib/commit/e700afd0526ff2cc8f78cdb8743c749eceb09dd6) - **docs:** update type _(by Athan Reines)_
551563
- [`4a1b036`](https://github.com/stdlib-js/stdlib/commit/4a1b0361b7491efedfd3983f4a686601ba12c673) - **docs:** update type _(by Athan Reines)_
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2025 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# isDataTypeObject
22+
23+
> Test if an input value is an ndarray data type object.
24+
25+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26+
27+
<section class="intro">
28+
29+
</section>
30+
31+
<!-- /.intro -->
32+
33+
<!-- Package usage documentation. -->
34+
35+
<section class="usage">
36+
37+
## Usage
38+
39+
```javascript
40+
var isDataTypeObject = require( '@stdlib/ndarray/base/assert/is-data-type-object' );
41+
```
42+
43+
#### isDataTypeObject( value )
44+
45+
Tests if an input value is an ndarray data type object.
46+
47+
```javascript
48+
var DataType = require( '@stdlib/ndarray/dtype-ctor' );
49+
50+
var bool = isDataTypeObject( new DataType( 'float64' ) );
51+
// returns true
52+
53+
bool = isDataTypeObject( 'int32' );
54+
// returns false
55+
```
56+
57+
</section>
58+
59+
<!-- /.usage -->
60+
61+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
62+
63+
<section class="notes">
64+
65+
</section>
66+
67+
<!-- /.notes -->
68+
69+
<!-- Package usage examples. -->
70+
71+
<section class="examples">
72+
73+
## Examples
74+
75+
<!-- eslint no-undef: "error" -->
76+
77+
```javascript
78+
var DataType = require( '@stdlib/ndarray/dtype-ctor' );
79+
var isDataTypeObject = require( '@stdlib/ndarray/base/assert/is-data-type-object' );
80+
81+
var bool = isDataTypeObject( new DataType( 'float64' ) );
82+
// returns true
83+
84+
bool = isDataTypeObject( 'float64' );
85+
// returns false
86+
87+
bool = isDataTypeObject( {} );
88+
// returns false
89+
```
90+
91+
</section>
92+
93+
<!-- /.examples -->
94+
95+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
96+
97+
<section class="references">
98+
99+
</section>
100+
101+
<!-- /.references -->
102+
103+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
104+
105+
<section class="related">
106+
107+
</section>
108+
109+
<!-- /.related -->
110+
111+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
112+
113+
<section class="links">
114+
115+
</section>
116+
117+
<!-- /.links -->
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
25+
var DataType = require( './../../../../dtype-ctor' );
26+
var pkg = require( './../package.json' ).name;
27+
var isDataTypeObject = require( './../lib' );
28+
29+
30+
// MAIN //
31+
32+
bench( pkg+'::true', function benchmark( b ) {
33+
var values;
34+
var out;
35+
var v;
36+
var i;
37+
38+
values = [
39+
new DataType( 'float64' ),
40+
new DataType( 'float32' )
41+
];
42+
43+
b.tic();
44+
for ( i = 0; i < b.iterations; i++ ) {
45+
v = values[ i%values.length ];
46+
out = isDataTypeObject( v );
47+
if ( typeof out !== 'boolean' ) {
48+
b.fail( 'should return a boolean' );
49+
}
50+
}
51+
b.toc();
52+
if ( !isBoolean( out ) ) {
53+
b.fail( 'should return a boolean' );
54+
}
55+
b.pass( 'benchmark finished' );
56+
b.end();
57+
});
58+
59+
bench( pkg+'::false', function benchmark( b ) {
60+
var values;
61+
var out;
62+
var v;
63+
var i;
64+
65+
values = [
66+
'binary',
67+
'float32',
68+
'float64',
69+
'generic',
70+
'int16',
71+
'int32',
72+
'int8',
73+
'uint16',
74+
'uint32',
75+
'uint8',
76+
'uint8c',
77+
'foo',
78+
'bar',
79+
'',
80+
'beep',
81+
'boop'
82+
];
83+
84+
b.tic();
85+
for ( i = 0; i < b.iterations; i++ ) {
86+
v = values[ i%values.length ];
87+
out = isDataTypeObject( v );
88+
if ( typeof out !== 'boolean' ) {
89+
b.fail( 'should return a boolean' );
90+
}
91+
}
92+
b.toc();
93+
if ( !isBoolean( out ) ) {
94+
b.fail( 'should return a boolean' );
95+
}
96+
b.pass( 'benchmark finished' );
97+
b.end();
98+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
{{alias}}( value )
3+
Tests if an input value is an ndarray data type object.
4+
5+
Parameters
6+
----------
7+
value: any
8+
Value to test.
9+
10+
Returns
11+
-------
12+
bool: boolean
13+
Boolean indicating if an input value is an ndarray data type object.
14+
15+
Examples
16+
--------
17+
> var dt = new {{alias:@stdlib/ndarray/dtype-ctor}}( 'float64' );
18+
> var bool = {{alias}}( dt )
19+
true
20+
> bool = {{alias}}( 'float64' )
21+
false
22+
> bool = {{alias}}( {} )
23+
false
24+
25+
See Also
26+
--------
27+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 4.1
20+
21+
/**
22+
* Tests whether an input value is an ndarray data type object.
23+
*
24+
* @param v - value to test
25+
* @returns boolean indicating whether an input value is an ndarray data type object
26+
*
27+
* @example
28+
* var DataType = require( '@stdlib/ndarray/dtype-ctor' );
29+
*
30+
* var bool = isDataTypeObject( new DataType( 'float64' ) );
31+
* // returns true
32+
*
33+
* bool = isDataTypeObject( 'float64' );
34+
* // returns false
35+
*
36+
* bool = isDataTypeObject( 'foo' );
37+
* // returns false
38+
*
39+
* bool = isDataTypeObject( {} );
40+
* // returns false
41+
*/
42+
declare function isDataTypeObject( v: any ): boolean;
43+
44+
45+
// EXPORTS //
46+
47+
export = isDataTypeObject;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import isDataTypeObject = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isDataTypeObject( {} ); // $ExpectType boolean
27+
isDataTypeObject( 'foo' ); // $ExpectType boolean
28+
}
29+
30+
// The compiler throws an error if the function is provided an unsupported number of arguments...
31+
{
32+
isDataTypeObject(); // $ExpectError
33+
isDataTypeObject( {}, 123 ); // $ExpectError
34+
}

0 commit comments

Comments
 (0)