diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 5d0ad4bb4208db..1d2004cea268aa 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -2879,15 +2879,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(NODE_GYP_MODULE_NAME, Init)