From 01a6087f809a71e901443ab632702429cd51a960 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 7 Mar 2018 09:25:38 -0800 Subject: [PATCH] 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 --- doc/api/addons.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index 1db1e5ecaf9d5b..bc3cf2d41f56a0 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -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; }