Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix outdated code sample in n-api.md #15581

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@ napi_status status = napi_status_generic_failure;

// const obj = {};
napi_value obj;
status = napi_create_obj(env, &obj);
status = napi_create_object(env, &obj);
if (status != napi_ok) return status;

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

// Set the properties
napi_property_descriptors descriptors[] = {
{ "foo", fooValue, 0, 0, 0, napi_default, 0 },
{ "bar", barValue, 0, 0, 0, napi_default, 0 }
napi_property_descriptor descriptors[] = {
{ "foo", nullptr, 0, 0, 0, fooValue, napi_default, 0 },
{ "bar", nullptr, 0, 0, 0, barValue, napi_default, 0 }
}
status = napi_define_properties(env,
obj,
Expand Down