From 82458b30febeccf3b2f046cdc01a2ca04dced917 Mon Sep 17 00:00:00 2001 From: legendecas Date: Thu, 24 Jun 2021 00:30:09 +0800 Subject: [PATCH] doc: correct JavaScript primitive value names in n-api.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/39129 Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- doc/api/n-api.md | 108 +++++++++++++++++++++++------------------------ 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index bc32802ba1738a..5d235155a4adf1 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -999,7 +999,7 @@ clear the exception. On success, result will contain the handle to the last JavaScript `Object` thrown. If it is determined, after retrieving the exception, the exception cannot be handled after all it can be re-thrown it with [`napi_throw`][] where error is the -JavaScript `Error` object to be thrown. +JavaScript value to be thrown. The following utility functions are also available in case native code needs to throw an exception or determine if a `napi_value` is an instance @@ -1152,7 +1152,7 @@ NAPI_EXTERN napi_status napi_create_error(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] code`: Optional `napi_value` with the string for the error code to be associated with the error. -* `[in] msg`: `napi_value` that references a JavaScript `String` to be used as +* `[in] msg`: `napi_value` that references a JavaScript `string` to be used as the message for the `Error`. * `[out] result`: `napi_value` representing the error created. @@ -1176,7 +1176,7 @@ NAPI_EXTERN napi_status napi_create_type_error(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] code`: Optional `napi_value` with the string for the error code to be associated with the error. -* `[in] msg`: `napi_value` that references a JavaScript `String` to be used as +* `[in] msg`: `napi_value` that references a JavaScript `string` to be used as the message for the `Error`. * `[out] result`: `napi_value` representing the error created. @@ -1200,7 +1200,7 @@ NAPI_EXTERN napi_status napi_create_range_error(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] code`: Optional `napi_value` with the string for the error code to be associated with the error. -* `[in] msg`: `napi_value` that references a JavaScript `String` to be used as +* `[in] msg`: `napi_value` that references a JavaScript `string` to be used as the message for the `Error`. * `[out] result`: `napi_value` representing the error created. @@ -2322,14 +2322,14 @@ napi_status napi_create_symbol(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] description`: Optional `napi_value` which refers to a JavaScript - `String` to be set as the description for the symbol. -* `[out] result`: A `napi_value` representing a JavaScript `Symbol`. + `string` to be set as the description for the symbol. +* `[out] result`: A `napi_value` representing a JavaScript `symbol`. Returns `napi_ok` if the API succeeded. -This API creates a JavaScript `Symbol` object from a UTF8-encoded C string. +This API creates a JavaScript `symbol` value from a UTF8-encoded C string. -The JavaScript `Symbol` type is described in [Section 19.4][] +The JavaScript `symbol` type is described in [Section 19.4][] of the ECMAScript Language Specification. #### napi_create_typedarray @@ -2416,14 +2416,14 @@ napi_status napi_create_int32(napi_env env, int32_t value, napi_value* result) * `[in] env`: The environment that the API is invoked under. * `[in] value`: Integer value to be represented in JavaScript. -* `[out] result`: A `napi_value` representing a JavaScript `Number`. +* `[out] result`: A `napi_value` representing a JavaScript `number`. Returns `napi_ok` if the API succeeded. This API is used to convert from the C `int32_t` type to the JavaScript -`Number` type. +`number` type. -The JavaScript `Number` type is described in +The JavaScript `number` type is described in [Section 6.1.6][] of the ECMAScript Language Specification. #### napi_create_uint32 @@ -2438,14 +2438,14 @@ napi_status napi_create_uint32(napi_env env, uint32_t value, napi_value* result) * `[in] env`: The environment that the API is invoked under. * `[in] value`: Unsigned integer value to be represented in JavaScript. -* `[out] result`: A `napi_value` representing a JavaScript `Number`. +* `[out] result`: A `napi_value` representing a JavaScript `number`. Returns `napi_ok` if the API succeeded. This API is used to convert from the C `uint32_t` type to the JavaScript -`Number` type. +`number` type. -The JavaScript `Number` type is described in +The JavaScript `number` type is described in [Section 6.1.6][] of the ECMAScript Language Specification. #### napi_create_int64 @@ -2460,14 +2460,14 @@ napi_status napi_create_int64(napi_env env, int64_t value, napi_value* result) * `[in] env`: The environment that the API is invoked under. * `[in] value`: Integer value to be represented in JavaScript. -* `[out] result`: A `napi_value` representing a JavaScript `Number`. +* `[out] result`: A `napi_value` representing a JavaScript `number`. Returns `napi_ok` if the API succeeded. This API is used to convert from the C `int64_t` type to the JavaScript -`Number` type. +`number` type. -The JavaScript `Number` type is described in [Section 6.1.6][] +The JavaScript `number` type is described in [Section 6.1.6][] of the ECMAScript Language Specification. Note the complete range of `int64_t` cannot be represented with full precision in JavaScript. Integer values outside the range of [`Number.MIN_SAFE_INTEGER`][] `-(2**53 - 1)` - @@ -2485,14 +2485,14 @@ napi_status napi_create_double(napi_env env, double value, napi_value* result) * `[in] env`: The environment that the API is invoked under. * `[in] value`: Double-precision value to be represented in JavaScript. -* `[out] result`: A `napi_value` representing a JavaScript `Number`. +* `[out] result`: A `napi_value` representing a JavaScript `number`. Returns `napi_ok` if the API succeeded. This API is used to convert from the C `double` type to the JavaScript -`Number` type. +`number` type. -The JavaScript `Number` type is described in +The JavaScript `number` type is described in [Section 6.1.6][] of the ECMAScript Language Specification. #### napi_create_bigint_int64 @@ -2581,14 +2581,14 @@ napi_status napi_create_string_latin1(napi_env env, * `[in] str`: Character buffer representing an ISO-8859-1-encoded string. * `[in] length`: The length of the string in bytes, or `NAPI_AUTO_LENGTH` if it is null-terminated. -* `[out] result`: A `napi_value` representing a JavaScript `String`. +* `[out] result`: A `napi_value` representing a JavaScript `string`. Returns `napi_ok` if the API succeeded. -This API creates a JavaScript `String` object from an ISO-8859-1-encoded C +This API creates a JavaScript `string` value from an ISO-8859-1-encoded C string. The native string is copied. -The JavaScript `String` type is described in +The JavaScript `string` type is described in [Section 6.1.4][] of the ECMAScript Language Specification. #### napi_create_string_utf16 @@ -2608,14 +2608,14 @@ napi_status napi_create_string_utf16(napi_env env, * `[in] str`: Character buffer representing a UTF16-LE-encoded string. * `[in] length`: The length of the string in two-byte code units, or `NAPI_AUTO_LENGTH` if it is null-terminated. -* `[out] result`: A `napi_value` representing a JavaScript `String`. +* `[out] result`: A `napi_value` representing a JavaScript `string`. Returns `napi_ok` if the API succeeded. -This API creates a JavaScript `String` object from a UTF16-LE-encoded C string. +This API creates a JavaScript `string` value from a UTF16-LE-encoded C string. The native string is copied. -The JavaScript `String` type is described in +The JavaScript `string` type is described in [Section 6.1.4][] of the ECMAScript Language Specification. #### napi_create_string_utf8 @@ -2635,14 +2635,14 @@ napi_status napi_create_string_utf8(napi_env env, * `[in] str`: Character buffer representing a UTF8-encoded string. * `[in] length`: The length of the string in bytes, or `NAPI_AUTO_LENGTH` if it is null-terminated. -* `[out] result`: A `napi_value` representing a JavaScript `String`. +* `[out] result`: A `napi_value` representing a JavaScript `string`. Returns `napi_ok` if the API succeeded. -This API creates a JavaScript `String` object from a UTF8-encoded C string. +This API creates a JavaScript `string` value from a UTF8-encoded C string. The native string is copied. -The JavaScript `String` type is described in +The JavaScript `string` type is described in [Section 6.1.4][] of the ECMAScript Language Specification. ### Functions to convert from Node-API to C types @@ -2806,7 +2806,7 @@ napi_status napi_get_dataview_info(napi_env env, * `[in] env`: The environment that the API is invoked under. * `[in] dataview`: `napi_value` representing the `DataView` whose properties to query. -* `[out] byte_length`: `Number` of bytes in the `DataView`. +* `[out] byte_length`: Number of bytes in the `DataView`. * `[out] data`: The data buffer underlying the `DataView`. If byte_length is `0`, this may be `NULL` or any other pointer value. * `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`. @@ -2879,15 +2879,15 @@ napi_status napi_get_value_double(napi_env env, ``` * `[in] env`: The environment that the API is invoked under. -* `[in] value`: `napi_value` representing JavaScript `Number`. +* `[in] value`: `napi_value` representing JavaScript `number`. * `[out] result`: C double primitive equivalent of the given JavaScript - `Number`. + `number`. Returns `napi_ok` if the API succeeded. If a non-number `napi_value` is passed in it returns `napi_number_expected`. This API returns the C double primitive equivalent of the given JavaScript -`Number`. +`number`. #### napi_get_value_bigint_int64