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: https://github.com/nodejs/node/pull/19205
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
pull/19568/head
Steven R. Loomis 2018-03-07 09:25:38 -08:00 committed by Tobias Nießen
parent 2289267fc2
commit 7921e53ac5
No known key found for this signature in database
GPG Key ID: 718207F8FD156B70
1 changed files with 1 additions and 1 deletions

View File

@ -246,7 +246,7 @@ napi_value Method(napi_env env, napi_callback_info args) {
napi_value greeting;
napi_status status;
status = napi_create_string_utf8(env, "hello", 6, &greeting);
status = napi_create_string_utf8(env, "hello", NAPI_AUTO_LENGTH, &greeting);
if (status != napi_ok) return nullptr;
return greeting;
}