diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 6115bc14674429..ec15f7cf7a41b2 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -1025,7 +1025,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 @@ -1178,7 +1178,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. @@ -1202,7 +1202,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. @@ -1226,7 +1226,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. @@ -2357,14 +2357,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 @@ -2451,14 +2451,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 @@ -2473,14 +2473,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 @@ -2495,14 +2495,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)` - @@ -2520,14 +2520,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 @@ -2616,14 +2616,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 @@ -2643,14 +2643,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 @@ -2670,14 +2670,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 @@ -2841,7 +2841,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`. @@ -2914,15 +2914,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