Skip to content

Commit 0e3bdc1

Browse files
committed
Auto-generated commit
1 parent a8af3fa commit 0e3bdc1

7 files changed

Lines changed: 100 additions & 48 deletions

File tree

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,40 @@
22

33
> Package changelog.
44
5+
<section class="release" id="unreleased">
6+
7+
## Unreleased (2026-05-12)
8+
9+
<section class="commits">
10+
11+
### Commits
12+
13+
<details>
14+
15+
- [`e88c94d`](https://github.com/stdlib-js/stdlib/commit/e88c94da24be1529fe78417dc727fad75752a839) - **refactor:** update to avoid circular dependency _(by Athan Reines)_
16+
17+
</details>
18+
19+
</section>
20+
21+
<!-- /.commits -->
22+
23+
<section class="contributors">
24+
25+
### Contributors
26+
27+
A total of 1 person contributed to this release. Thank you to this contributor:
28+
29+
- Athan Reines
30+
31+
</section>
32+
33+
<!-- /.contributors -->
34+
35+
</section>
36+
37+
<!-- /.release -->
38+
539
<section class="release" id="v0.1.1">
640

741
## 0.1.1 (2026-02-08)

dist/index.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/main.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
// MODULES //
2222

23-
var isFloat16Array = require( '@stdlib/assert-is-float16array' );
24-
var PINF = require( '@stdlib/constants-float64-pinf' ); // TODO: replace with `constants/float16/pinf`
23+
var PINF = require( '@stdlib/constants-float16-pinf' );
2524
var GlobalFloat16Array = require( './float16array.js' );
2625

2726

@@ -47,11 +46,15 @@ function hasFloat16ArraySupport() {
4746
try {
4847
arr = new GlobalFloat16Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );
4948
bool = (
50-
isFloat16Array( arr ) &&
49+
typeof arr === 'object' &&
50+
arr !== null &&
51+
arr.constructor.name === 'Float16Array' &&
52+
arr.BYTES_PER_ELEMENT === 2 &&
5153
arr[ 0 ] === 1.0 &&
5254
arr[ 1 ] !== 3.14 &&
5355
arr[ 2 ] !== -3.14 &&
54-
arr[ 3 ] === PINF
56+
arr[ 3 ] === PINF &&
57+
arr.length === 4
5558
);
5659
} catch ( err ) { // eslint-disable-line no-unused-vars
5760
bool = false;

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@
4040
"url": "https://github.com/stdlib-js/stdlib/issues"
4141
},
4242
"dependencies": {
43-
"@stdlib/assert-is-float16array": "^0.1.1",
4443
"@stdlib/cli-ctor": "^0.2.3",
45-
"@stdlib/constants-float64-pinf": "^0.2.3",
44+
"@stdlib/constants-float16-pinf": "^0.2.3",
4645
"@stdlib/fs-read-file": "^0.2.3"
4746
},
4847
"devDependencies": {

test/test.js

Lines changed: 50 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,92 +40,109 @@ tape( 'main export is a function', function test( t ) {
4040
});
4141

4242
tape( 'feature detection result is a boolean', function test( t ) {
43-
t.strictEqual( typeof detect(), 'boolean', 'detection result is a boolean' );
43+
t.strictEqual( typeof detect(), 'boolean', 'returns expected value' );
4444
t.end();
4545
});
4646

4747
tape( 'if `Float16Array` is supported, detection result is `true`', function test( t ) {
4848
var mocked;
4949
if ( hasFloat16Array ) {
50-
t.strictEqual( detect(), true, 'detection result is `true`' );
50+
t.strictEqual( detect(), true, 'returns expected value' );
5151
} else {
52-
t.strictEqual( detect(), false, 'detection result is `false`' );
52+
t.strictEqual( detect(), false, 'returns expected value' );
5353
}
5454
mocked = proxyquire( './../lib/main.js', {
55-
'./float16array.js': Mock,
56-
'@stdlib/assert-is-float16array': isArray
55+
'./float16array.js': Mock
5756
});
58-
t.strictEqual( mocked(), true, 'detection result is `true` (mocked)' );
57+
t.strictEqual( mocked(), true, 'returns expected value' );
5958

6059
t.end();
6160

62-
function isArray() {
63-
return true;
64-
}
65-
6661
function Mock() {
67-
return [
68-
1.0,
69-
3.0,
70-
-3.0,
71-
Number.POSITIVE_INFINITY
72-
];
62+
var mock = {
63+
'0': 1.0,
64+
'1': 3.0,
65+
'2': -3.0,
66+
'3': Number.POSITIVE_INFINITY,
67+
'length': 4,
68+
'constructor': {
69+
'name': 'Float16Array'
70+
},
71+
'BYTES_PER_ELEMENT': 2
72+
};
73+
return mock;
7374
}
7475
});
7576

7677
tape( 'if `Float16Array` is not supported, detection result is `false`', function test( t ) {
7778
var mocked;
7879
if ( hasFloat16Array ) {
79-
t.strictEqual( detect(), true, 'detection result is `true`' );
80+
t.strictEqual( detect(), true, 'returns expected value' );
8081
} else {
81-
t.strictEqual( detect(), false, 'detection result is `false`' );
82+
t.strictEqual( detect(), false, 'returns expected value' );
8283
}
8384
mocked = proxyquire( './../lib/main.js', {
8485
'./float16array.js': {}
8586
});
86-
t.strictEqual( mocked(), false, 'detection result is `false`' );
87+
t.strictEqual( mocked(), false, 'returns expected value' );
8788

8889
mocked = proxyquire( './../lib/main.js', {
8990
'./float16array.js': Mock1
9091
});
91-
t.strictEqual( mocked(), false, 'detection result is `false`' );
92+
t.strictEqual( mocked(), false, 'returns expected value' );
9293

9394
mocked = proxyquire( './../lib/main.js', {
94-
'./float16array.js': Mock2,
95-
'@stdlib/assert-is-float16array': isArray
95+
'./float16array.js': Mock2
9696
});
97-
t.strictEqual( mocked(), false, 'detection result is `false`' );
97+
t.strictEqual( mocked(), false, 'returns expected value' );
9898

9999
mocked = proxyquire( './../lib/main.js', {
100-
'./float16array.js': Mock3,
101-
'@stdlib/assert-is-float16array': isArray
100+
'./float16array.js': Mock3
102101
});
103-
t.strictEqual( mocked(), false, 'detection result is `false`' );
102+
t.strictEqual( mocked(), false, 'returns expected value' );
104103

105104
mocked = proxyquire( './../lib/main.js', {
106105
'./float16array.js': Mock4
107106
});
108-
t.strictEqual( mocked(), false, 'detection result is `false`' );
107+
t.strictEqual( mocked(), false, 'returns expected value' );
109108

110109
t.end();
111110

112-
function isArray() {
113-
return true;
114-
}
115-
116111
function Mock1() {
117112
// Not a typed array:
118113
return [];
119114
}
120115

121116
function Mock2() {
122117
// Does not lose precision...
123-
return [ 1.0, 3.14, -3.14, Number.POSITIVE_INFINITY ];
118+
var mock = {
119+
'0': 1.0,
120+
'1': 3.14,
121+
'2': -3.14,
122+
'3': Number.POSITIVE_INFINITY,
123+
'length': 4,
124+
'constructor': {
125+
'name': 'Float16Array'
126+
},
127+
'BYTES_PER_ELEMENT': 2
128+
};
129+
return mock;
124130
}
125131

126132
function Mock3() {
127133
// Does not overflow...
128-
return [ 1.0, 3.140625, -3.140625, 5.0e40 ];
134+
var mock = {
135+
'0': 1.0,
136+
'1': 3.140625,
137+
'2': -3.140625,
138+
'3': 5.0e40,
139+
'length': 4,
140+
'constructor': {
141+
'name': 'Float16Array'
142+
},
143+
'BYTES_PER_ELEMENT': 2
144+
};
145+
return mock;
129146
}
130147

131148
function Mock4() {

0 commit comments

Comments
 (0)