Skip to content

Commit

Permalink
doc: fix outdated code sample in n-api.md
Browse files Browse the repository at this point in the history
code samples of napi_create_object and napi_property_descriptor were
not updated to latest API.

Backport-PR-URL: #19447
PR-URL: #15581
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
rebornix authored and MylesBorins committed Apr 16, 2018
1 parent 2bc8a59 commit e9a6dff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/api/n-api.md
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

0 comments on commit e9a6dff

Please sign in to comment.