Skip to content

Commit f763e7c

Browse files
author
Sampson Gao
committed
Update according to new napi changes
1 parent 3dd7b70 commit f763e7c

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

2_function_arguments/napi/addon.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
void Add(napi_env env, napi_callback_info info) {
55
napi_status status;
66

7-
int argc;
7+
size_t argc;
88
status = napi_get_cb_args_length(env, info, &argc);
99
assert(status == napi_ok);
1010

@@ -18,11 +18,11 @@ void Add(napi_env env, napi_callback_info info) {
1818
assert(status == napi_ok);
1919

2020
napi_valuetype valuetype0;
21-
status = napi_get_type_of_value(env, args[0], &valuetype0);
21+
status = napi_typeof(env, args[0], &valuetype0);
2222
assert(status == napi_ok);
2323

2424
napi_valuetype valuetype1;
25-
status = napi_get_type_of_value(env, args[1], &valuetype1);
25+
status = napi_typeof(env, args[1], &valuetype1);
2626
assert(status == napi_ok);
2727

2828
if (valuetype0 != napi_number || valuetype1 != napi_number) {

6_object_wrap/napi/myobject.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void MyObject::New(napi_env env, napi_callback_info info) {
5151
double value = 0;
5252

5353
napi_valuetype valuetype;
54-
status = napi_get_type_of_value(env, args[0], &valuetype);
54+
status = napi_typeof(env, args[0], &valuetype);
5555
assert(status == napi_ok);
5656

5757
if (valuetype != napi_undefined) {
@@ -82,7 +82,7 @@ void MyObject::New(napi_env env, napi_callback_info info) {
8282
status = napi_get_cb_args(env, info, args, 1);
8383
assert(status == napi_ok);
8484

85-
const int argc = 1;
85+
const size_t argc = 1;
8686
napi_value argv[argc] = {args[0]};
8787

8888
napi_value cons;
@@ -165,7 +165,7 @@ void MyObject::Multiply(napi_env env, napi_callback_info info) {
165165
assert(status == napi_ok);
166166

167167
napi_valuetype valuetype;
168-
status = napi_get_type_of_value(env, args[0], &valuetype);
168+
status = napi_typeof(env, args[0], &valuetype);
169169
assert(status == napi_ok);
170170

171171
double multiple = 1;

7_factory_wrap/napi/myobject.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void MyObject::New(napi_env env, napi_callback_info info) {
3939
assert(status == napi_ok);
4040

4141
napi_valuetype valuetype;
42-
status = napi_get_type_of_value(env, args[0], &valuetype);
42+
status = napi_typeof(env, args[0], &valuetype);
4343
assert(status == napi_ok);
4444

4545
MyObject* obj = new MyObject();

8_passing_wrapped/napi/myobject.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void MyObject::New(napi_env env, napi_callback_info info) {
3434
MyObject* obj = new MyObject();
3535

3636
napi_valuetype valuetype;
37-
status = napi_get_type_of_value(env, args[0], &valuetype);
37+
status = napi_typeof(env, args[0], &valuetype);
3838
assert(status == napi_ok);
3939

4040
if (valuetype == napi_undefined) {

0 commit comments

Comments
 (0)