Skip to content

Commit c1e591d

Browse files
refactor: update math/base/assert/is-even to follow latest project conventions
1 parent 57c527e commit c1e591d

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

lib/node_modules/@stdlib/math/base/assert/is-even/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"@stdlib/math/base/assert/is-integer",
4242
"@stdlib/napi/export",
4343
"@stdlib/napi/argv",
44-
"@stdlib/napi/argv-double"
44+
"@stdlib/napi/argv-double",
45+
"@stdlib/napi/create-double"
4546
]
4647
},
4748
{

lib/node_modules/@stdlib/math/base/assert/is-even/src/addon.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
#include "stdlib/math/base/assert/is_even.h"
2020
#include "stdlib/napi/argv.h"
2121
#include "stdlib/napi/argv_double.h"
22+
#include "stdlib/napi/create_double.h"
2223
#include "stdlib/napi/export.h"
2324
#include <node_api.h>
24-
#include <assert.h>
25-
25+
#include <stdint.h>
2626

2727
/**
2828
* Receives JavaScript callback invocation data.
@@ -32,17 +32,10 @@
3232
* @return Node-API value
3333
*/
3434
static napi_value addon( napi_env env, napi_callback_info info ) {
35-
STDLIB_NAPI_ARGV( env, info, argv, argc, 1 );
36-
STDLIB_NAPI_ARGV_DOUBLE( env, x, argv, 0 );
37-
38-
// Check if the number is even:
39-
bool result = stdlib_base_is_even( x );
40-
41-
napi_value v;
42-
napi_status status = napi_get_boolean( env, result, &v );
43-
assert( status == napi_ok );
44-
45-
return v;
35+
STDLIB_NAPI_ARGV( env, info, argv, argc, 1 );
36+
STDLIB_NAPI_ARGV_DOUBLE( env, x, argv, 0 );
37+
STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_base_is_even( x ), out );
38+
return out;
4639
}
4740

4841
STDLIB_NAPI_MODULE_EXPORT_FCN( addon )

0 commit comments

Comments
 (0)