diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 3c2ce8d14eb080..f58f96742eecb3 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2877,15 +2877,17 @@ napi_value SayHello(napi_env env, napi_callback_info info) { return nullptr; } -void Init(napi_env env, napi_value exports, napi_value module, void* priv) { +napi_value Init(napi_env env, napi_value exports) { napi_status status; napi_value fn; - status = napi_create_function(env, NULL, SayHello, NULL, &fn); - if (status != napi_ok) return; + status = napi_create_function(env, nullptr, 0, SayHello, nullptr, &fn); + if (status != napi_ok) return nullptr; status = napi_set_named_property(env, exports, "sayHello", fn); - if (status != napi_ok) return; + if (status != napi_ok) return nullptr; + + return exports; } NAPI_MODULE(addon, Init)