Skip to content

Commit 8b90250

Browse files
rebornixjasnell
authored andcommitted
doc: fix outdated code sample in n-api.md
code samples of napi_create_object and napi_property_descriptor were not updated to latest API. PR-URL: #15581 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f98687d commit 8b90250

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/api/n-api.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2349,7 +2349,7 @@ napi_status status = napi_status_generic_failure;
23492349

23502350
// const obj = {};
23512351
napi_value obj;
2352-
status = napi_create_obj(env, &obj);
2352+
status = napi_create_object(env, &obj);
23532353
if (status != napi_ok) return status;
23542354

23552355
// Create napi_values for 123 and 456
@@ -2360,9 +2360,9 @@ status = napi_create_int32(env, 456, &barValue);
23602360
if (status != napi_ok) return status;
23612361

23622362
// Set the properties
2363-
napi_property_descriptors descriptors[] = {
2364-
{ "foo", fooValue, 0, 0, 0, napi_default, 0 },
2365-
{ "bar", barValue, 0, 0, 0, napi_default, 0 }
2363+
napi_property_descriptor descriptors[] = {
2364+
{ "foo", nullptr, 0, 0, 0, fooValue, napi_default, 0 },
2365+
{ "bar", nullptr, 0, 0, 0, barValue, napi_default, 0 }
23662366
}
23672367
status = napi_define_properties(env,
23682368
obj,

0 commit comments

Comments
 (0)