Skip to content

Commit cfe45e8

Browse files
committed
fix: drop undeclared err check, document BigInt return, and compare via Number in napi/create-uint64
The @example block and README C example referenced an err variable that stdlib_napi_create_uint64 never produces; added the missing C API note that the generated JavaScript value is a BigInt (matching create-int64); the native test compared the returned BigInt to a Number via strictEqual.
1 parent 480bda5 commit cfe45e8

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

lib/node_modules/@stdlib/napi/create-uint64/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
119119
napi_value value;
120120
napi_status status = stdlib_napi_create_uint64( env, 1, &value );
121121
assert( status == napi_ok );
122-
if ( err != NULL ) {
123-
assert( napi_throw( env, err ) == napi_ok );
124-
return NULL;
125-
}
126122

127123
// ...
128124
}
@@ -187,6 +183,8 @@ The macro expects the following arguments:
187183
188184
<section class="notes">
189185
186+
- The generated JavaScript value is a `BigInt` (N-API Version 6+).
187+
190188
</section>
191189
192190
<!-- /.notes -->

lib/node_modules/@stdlib/napi/create-uint64/src/main.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@
4040
* napi_value value;
4141
* napi_status status = stdlib_napi_create_uint64( env, 1, &value );
4242
* assert( status == napi_ok );
43-
* if ( err != NULL ) {
44-
* assert( napi_throw( env, err ) == napi_ok );
45-
* return NULL;
46-
* }
4743
*
4844
* // ...
4945
* }

lib/node_modules/@stdlib/napi/create-uint64/test/test.native.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var tape = require( 'tape' );
25+
var Number = require( '@stdlib/number/ctor' );
2526
var tryRequire = require( '@stdlib/utils/try-require' );
2627

2728

@@ -78,7 +79,7 @@ tape( 'the function does not throw an error if provided a non-negative number',
7879
];
7980
for ( i = 0; i < values.length; i++ ) {
8081
v = addon( values[ i ] );
81-
t.strictEqual( v, values[ i ], 'returns expected value when provided '+values[ i ] );
82+
t.strictEqual( Number( v ), values[ i ], 'returns expected value when provided '+values[ i ] );
8283
}
8384
t.end();
8485
});

0 commit comments

Comments
 (0)