Skip to content

Commit b2fc3b5

Browse files
srl295BethGriggs
authored andcommitted
doc: fix n-api example string
- using a length of 6 for `"hello"` includes a terminating null yielding `"hello\u0000"` - length of 5 would work, but comparing to the N-API docs gives `NAPI_AUTO_LENGTH` instead PR-URL: #19205 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent d79e7d6 commit b2fc3b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/api/addons.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ napi_value Method(napi_env env, napi_callback_info args) {
246246
napi_value greeting;
247247
napi_status status;
248248

249-
status = napi_create_string_utf8(env, "hello", 6, &greeting);
249+
status = napi_create_string_utf8(env, "hello", NAPI_AUTO_LENGTH, &greeting);
250250
if (status != napi_ok) return nullptr;
251251
return greeting;
252252
}

0 commit comments

Comments
 (0)