Skip to content

Commit af1e1db

Browse files
legendecastargos
authored andcommitted
doc: correct JavaScript primitive value names in n-api.md
PR-URL: #39129 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 9af62a1 commit af1e1db

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

Diff for: doc/api/n-api.md

+54-54
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ clear the exception. On success, result will contain the handle to
10251025
the last JavaScript `Object` thrown. If it is determined, after
10261026
retrieving the exception, the exception cannot be handled after all
10271027
it can be re-thrown it with [`napi_throw`][] where error is the
1028-
JavaScript `Error` object to be thrown.
1028+
JavaScript value to be thrown.
10291029

10301030
The following utility functions are also available in case native code
10311031
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,
11781178
* `[in] env`: The environment that the API is invoked under.
11791179
* `[in] code`: Optional `napi_value` with the string for the error code to be
11801180
associated with the error.
1181-
* `[in] msg`: `napi_value` that references a JavaScript `String` to be used as
1181+
* `[in] msg`: `napi_value` that references a JavaScript `string` to be used as
11821182
the message for the `Error`.
11831183
* `[out] result`: `napi_value` representing the error created.
11841184

@@ -1202,7 +1202,7 @@ NAPI_EXTERN napi_status napi_create_type_error(napi_env env,
12021202
* `[in] env`: The environment that the API is invoked under.
12031203
* `[in] code`: Optional `napi_value` with the string for the error code to be
12041204
associated with the error.
1205-
* `[in] msg`: `napi_value` that references a JavaScript `String` to be used as
1205+
* `[in] msg`: `napi_value` that references a JavaScript `string` to be used as
12061206
the message for the `Error`.
12071207
* `[out] result`: `napi_value` representing the error created.
12081208

@@ -1226,7 +1226,7 @@ NAPI_EXTERN napi_status napi_create_range_error(napi_env env,
12261226
* `[in] env`: The environment that the API is invoked under.
12271227
* `[in] code`: Optional `napi_value` with the string for the error code to be
12281228
associated with the error.
1229-
* `[in] msg`: `napi_value` that references a JavaScript `String` to be used as
1229+
* `[in] msg`: `napi_value` that references a JavaScript `string` to be used as
12301230
the message for the `Error`.
12311231
* `[out] result`: `napi_value` representing the error created.
12321232

@@ -2357,14 +2357,14 @@ napi_status napi_create_symbol(napi_env env,
23572357

23582358
* `[in] env`: The environment that the API is invoked under.
23592359
* `[in] description`: Optional `napi_value` which refers to a JavaScript
2360-
`String` to be set as the description for the symbol.
2361-
* `[out] result`: A `napi_value` representing a JavaScript `Symbol`.
2360+
`string` to be set as the description for the symbol.
2361+
* `[out] result`: A `napi_value` representing a JavaScript `symbol`.
23622362

23632363
Returns `napi_ok` if the API succeeded.
23642364

2365-
This API creates a JavaScript `Symbol` object from a UTF8-encoded C string.
2365+
This API creates a JavaScript `symbol` value from a UTF8-encoded C string.
23662366

2367-
The JavaScript `Symbol` type is described in [Section 19.4][]
2367+
The JavaScript `symbol` type is described in [Section 19.4][]
23682368
of the ECMAScript Language Specification.
23692369

23702370
#### napi_create_typedarray
@@ -2451,14 +2451,14 @@ napi_status napi_create_int32(napi_env env, int32_t value, napi_value* result)
24512451

24522452
* `[in] env`: The environment that the API is invoked under.
24532453
* `[in] value`: Integer value to be represented in JavaScript.
2454-
* `[out] result`: A `napi_value` representing a JavaScript `Number`.
2454+
* `[out] result`: A `napi_value` representing a JavaScript `number`.
24552455

24562456
Returns `napi_ok` if the API succeeded.
24572457

24582458
This API is used to convert from the C `int32_t` type to the JavaScript
2459-
`Number` type.
2459+
`number` type.
24602460

2461-
The JavaScript `Number` type is described in
2461+
The JavaScript `number` type is described in
24622462
[Section 6.1.6][] of the ECMAScript Language Specification.
24632463

24642464
#### napi_create_uint32
@@ -2473,14 +2473,14 @@ napi_status napi_create_uint32(napi_env env, uint32_t value, napi_value* result)
24732473

24742474
* `[in] env`: The environment that the API is invoked under.
24752475
* `[in] value`: Unsigned integer value to be represented in JavaScript.
2476-
* `[out] result`: A `napi_value` representing a JavaScript `Number`.
2476+
* `[out] result`: A `napi_value` representing a JavaScript `number`.
24772477

24782478
Returns `napi_ok` if the API succeeded.
24792479

24802480
This API is used to convert from the C `uint32_t` type to the JavaScript
2481-
`Number` type.
2481+
`number` type.
24822482

2483-
The JavaScript `Number` type is described in
2483+
The JavaScript `number` type is described in
24842484
[Section 6.1.6][] of the ECMAScript Language Specification.
24852485

24862486
#### napi_create_int64
@@ -2495,14 +2495,14 @@ napi_status napi_create_int64(napi_env env, int64_t value, napi_value* result)
24952495

24962496
* `[in] env`: The environment that the API is invoked under.
24972497
* `[in] value`: Integer value to be represented in JavaScript.
2498-
* `[out] result`: A `napi_value` representing a JavaScript `Number`.
2498+
* `[out] result`: A `napi_value` representing a JavaScript `number`.
24992499

25002500
Returns `napi_ok` if the API succeeded.
25012501

25022502
This API is used to convert from the C `int64_t` type to the JavaScript
2503-
`Number` type.
2503+
`number` type.
25042504

2505-
The JavaScript `Number` type is described in [Section 6.1.6][]
2505+
The JavaScript `number` type is described in [Section 6.1.6][]
25062506
of the ECMAScript Language Specification. Note the complete range of `int64_t`
25072507
cannot be represented with full precision in JavaScript. Integer values
25082508
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)
25202520

25212521
* `[in] env`: The environment that the API is invoked under.
25222522
* `[in] value`: Double-precision value to be represented in JavaScript.
2523-
* `[out] result`: A `napi_value` representing a JavaScript `Number`.
2523+
* `[out] result`: A `napi_value` representing a JavaScript `number`.
25242524

25252525
Returns `napi_ok` if the API succeeded.
25262526

25272527
This API is used to convert from the C `double` type to the JavaScript
2528-
`Number` type.
2528+
`number` type.
25292529

2530-
The JavaScript `Number` type is described in
2530+
The JavaScript `number` type is described in
25312531
[Section 6.1.6][] of the ECMAScript Language Specification.
25322532

25332533
#### napi_create_bigint_int64
@@ -2616,14 +2616,14 @@ napi_status napi_create_string_latin1(napi_env env,
26162616
* `[in] str`: Character buffer representing an ISO-8859-1-encoded string.
26172617
* `[in] length`: The length of the string in bytes, or `NAPI_AUTO_LENGTH` if it
26182618
is null-terminated.
2619-
* `[out] result`: A `napi_value` representing a JavaScript `String`.
2619+
* `[out] result`: A `napi_value` representing a JavaScript `string`.
26202620

26212621
Returns `napi_ok` if the API succeeded.
26222622

2623-
This API creates a JavaScript `String` object from an ISO-8859-1-encoded C
2623+
This API creates a JavaScript `string` value from an ISO-8859-1-encoded C
26242624
string. The native string is copied.
26252625

2626-
The JavaScript `String` type is described in
2626+
The JavaScript `string` type is described in
26272627
[Section 6.1.4][] of the ECMAScript Language Specification.
26282628

26292629
#### napi_create_string_utf16
@@ -2643,14 +2643,14 @@ napi_status napi_create_string_utf16(napi_env env,
26432643
* `[in] str`: Character buffer representing a UTF16-LE-encoded string.
26442644
* `[in] length`: The length of the string in two-byte code units, or
26452645
`NAPI_AUTO_LENGTH` if it is null-terminated.
2646-
* `[out] result`: A `napi_value` representing a JavaScript `String`.
2646+
* `[out] result`: A `napi_value` representing a JavaScript `string`.
26472647

26482648
Returns `napi_ok` if the API succeeded.
26492649

2650-
This API creates a JavaScript `String` object from a UTF16-LE-encoded C string.
2650+
This API creates a JavaScript `string` value from a UTF16-LE-encoded C string.
26512651
The native string is copied.
26522652

2653-
The JavaScript `String` type is described in
2653+
The JavaScript `string` type is described in
26542654
[Section 6.1.4][] of the ECMAScript Language Specification.
26552655

26562656
#### napi_create_string_utf8
@@ -2670,14 +2670,14 @@ napi_status napi_create_string_utf8(napi_env env,
26702670
* `[in] str`: Character buffer representing a UTF8-encoded string.
26712671
* `[in] length`: The length of the string in bytes, or `NAPI_AUTO_LENGTH` if it
26722672
is null-terminated.
2673-
* `[out] result`: A `napi_value` representing a JavaScript `String`.
2673+
* `[out] result`: A `napi_value` representing a JavaScript `string`.
26742674

26752675
Returns `napi_ok` if the API succeeded.
26762676

2677-
This API creates a JavaScript `String` object from a UTF8-encoded C string.
2677+
This API creates a JavaScript `string` value from a UTF8-encoded C string.
26782678
The native string is copied.
26792679

2680-
The JavaScript `String` type is described in
2680+
The JavaScript `string` type is described in
26812681
[Section 6.1.4][] of the ECMAScript Language Specification.
26822682

26832683
### Functions to convert from Node-API to C types
@@ -2841,7 +2841,7 @@ napi_status napi_get_dataview_info(napi_env env,
28412841
* `[in] env`: The environment that the API is invoked under.
28422842
* `[in] dataview`: `napi_value` representing the `DataView` whose
28432843
properties to query.
2844-
* `[out] byte_length`: `Number` of bytes in the `DataView`.
2844+
* `[out] byte_length`: Number of bytes in the `DataView`.
28452845
* `[out] data`: The data buffer underlying the `DataView`.
28462846
If byte_length is `0`, this may be `NULL` or any other pointer value.
28472847
* `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`.
@@ -2914,15 +2914,15 @@ napi_status napi_get_value_double(napi_env env,
29142914
```
29152915

29162916
* `[in] env`: The environment that the API is invoked under.
2917-
* `[in] value`: `napi_value` representing JavaScript `Number`.
2917+
* `[in] value`: `napi_value` representing JavaScript `number`.
29182918
* `[out] result`: C double primitive equivalent of the given JavaScript
2919-
`Number`.
2919+
`number`.
29202920

29212921
Returns `napi_ok` if the API succeeded. If a non-number `napi_value` is passed
29222922
in it returns `napi_number_expected`.
29232923

29242924
This API returns the C double primitive equivalent of the given JavaScript
2925-
`Number`.
2925+
`number`.
29262926

29272927
#### napi_get_value_bigint_int64
29282928
<!-- YAML
@@ -3040,15 +3040,15 @@ napi_status napi_get_value_int32(napi_env env,
30403040
```
30413041

30423042
* `[in] env`: The environment that the API is invoked under.
3043-
* `[in] value`: `napi_value` representing JavaScript `Number`.
3043+
* `[in] value`: `napi_value` representing JavaScript `number`.
30443044
* `[out] result`: C `int32` primitive equivalent of the given JavaScript
3045-
`Number`.
3045+
`number`.
30463046

30473047
Returns `napi_ok` if the API succeeded. If a non-number `napi_value`
30483048
is passed in `napi_number_expected`.
30493049

30503050
This API returns the C `int32` primitive equivalent
3051-
of the given JavaScript `Number`.
3051+
of the given JavaScript `number`.
30523052

30533053
If the number exceeds the range of the 32 bit integer, then the result is
30543054
truncated to the equivalent of the bottom 32 bits. This can result in a large
@@ -3070,17 +3070,17 @@ napi_status napi_get_value_int64(napi_env env,
30703070
```
30713071

30723072
* `[in] env`: The environment that the API is invoked under.
3073-
* `[in] value`: `napi_value` representing JavaScript `Number`.
3073+
* `[in] value`: `napi_value` representing JavaScript `number`.
30743074
* `[out] result`: C `int64` primitive equivalent of the given JavaScript
3075-
`Number`.
3075+
`number`.
30763076

30773077
Returns `napi_ok` if the API succeeded. If a non-number `napi_value`
30783078
is passed in it returns `napi_number_expected`.
30793079

30803080
This API returns the C `int64` primitive equivalent of the given JavaScript
3081-
`Number`.
3081+
`number`.
30823082

3083-
`Number` values outside the range of [`Number.MIN_SAFE_INTEGER`][]
3083+
`number` values outside the range of [`Number.MIN_SAFE_INTEGER`][]
30843084
`-(2**53 - 1)` - [`Number.MAX_SAFE_INTEGER`][] `(2**53 - 1)` will lose
30853085
precision.
30863086

@@ -3111,7 +3111,7 @@ napi_status napi_get_value_string_latin1(napi_env env,
31113111
* `[out] result`: Number of bytes copied into the buffer, excluding the null
31123112
terminator.
31133113

3114-
Returns `napi_ok` if the API succeeded. If a non-`String` `napi_value`
3114+
Returns `napi_ok` if the API succeeded. If a non-`string` `napi_value`
31153115
is passed in it returns `napi_string_expected`.
31163116

31173117
This API returns the ISO-8859-1-encoded string corresponding the value passed
@@ -3141,7 +3141,7 @@ napi_status napi_get_value_string_utf8(napi_env env,
31413141
* `[out] result`: Number of bytes copied into the buffer, excluding the null
31423142
terminator.
31433143

3144-
Returns `napi_ok` if the API succeeded. If a non-`String` `napi_value`
3144+
Returns `napi_ok` if the API succeeded. If a non-`string` `napi_value`
31453145
is passed in it returns `napi_string_expected`.
31463146

31473147
This API returns the UTF8-encoded string corresponding the value passed in.
@@ -3170,7 +3170,7 @@ napi_status napi_get_value_string_utf16(napi_env env,
31703170
* `[out] result`: Number of 2-byte code units copied into the buffer, excluding
31713171
the null terminator.
31723172

3173-
Returns `napi_ok` if the API succeeded. If a non-`String` `napi_value`
3173+
Returns `napi_ok` if the API succeeded. If a non-`string` `napi_value`
31743174
is passed in it returns `napi_string_expected`.
31753175

31763176
This API returns the UTF16-encoded string corresponding the value passed in.
@@ -3188,7 +3188,7 @@ napi_status napi_get_value_uint32(napi_env env,
31883188
```
31893189

31903190
* `[in] env`: The environment that the API is invoked under.
3191-
* `[in] value`: `napi_value` representing JavaScript `Number`.
3191+
* `[in] value`: `napi_value` representing JavaScript `number`.
31923192
* `[out] result`: C primitive equivalent of the given `napi_value` as a
31933193
`uint32_t`.
31943194

@@ -3278,8 +3278,8 @@ of the [ECMAScript Language Specification][].
32783278

32793279
These APIs support doing one of the following:
32803280

3281-
1. Coerce JavaScript values to specific JavaScript types (such as `Number` or
3282-
`String`).
3281+
1. Coerce JavaScript values to specific JavaScript types (such as `number` or
3282+
`string`).
32833283
2. Check the type of a JavaScript value.
32843284
3. Check for equality between two JavaScript values.
32853285

@@ -3319,7 +3319,7 @@ napi_status napi_coerce_to_number(napi_env env,
33193319

33203320
* `[in] env`: The environment that the API is invoked under.
33213321
* `[in] value`: The JavaScript value to coerce.
3322-
* `[out] result`: `napi_value` representing the coerced JavaScript `Number`.
3322+
* `[out] result`: `napi_value` representing the coerced JavaScript `number`.
33233323

33243324
Returns `napi_ok` if the API succeeded.
33253325

@@ -3363,7 +3363,7 @@ napi_status napi_coerce_to_string(napi_env env,
33633363

33643364
* `[in] env`: The environment that the API is invoked under.
33653365
* `[in] value`: The JavaScript value to coerce.
3366-
* `[out] result`: `napi_value` representing the coerced JavaScript `String`.
3366+
* `[out] result`: `napi_value` representing the coerced JavaScript `string`.
33673367

33683368
Returns `napi_ok` if the API succeeded.
33693369

@@ -3647,7 +3647,7 @@ following forms:
36473647
* Named: a simple UTF8-encoded string
36483648
* Integer-Indexed: an index value represented by `uint32_t`
36493649
* JavaScript value: these are represented in Node-API by `napi_value`. This can
3650-
be a `napi_value` representing a `String`, `Number`, or `Symbol`.
3650+
be a `napi_value` representing a `string`, `number`, or `symbol`.
36513651

36523652
Node-API values are represented by the type `napi_value`.
36533653
Any Node-API call that requires a JavaScript value takes in a `napi_value`.
@@ -3842,7 +3842,7 @@ typedef struct {
38423842
} napi_property_descriptor;
38433843
```
38443844

3845-
* `utf8name`: Optional `String` describing the key for the property,
3845+
* `utf8name`: Optional string describing the key for the property,
38463846
encoded as UTF8. One of `utf8name` or `name` must be provided for the
38473847
property.
38483848
* `name`: Optional `napi_value` that points to a JavaScript string or symbol
@@ -4039,8 +4039,8 @@ napi_status napi_has_own_property(napi_env env,
40394039
Returns `napi_ok` if the API succeeded.
40404040

40414041
This API checks if the `Object` passed in has the named own property. `key` must
4042-
be a string or a `Symbol`, or an error will be thrown. Node-API will not perform
4043-
any conversion between data types.
4042+
be a `string` or a `symbol`, or an error will be thrown. Node-API will not
4043+
perform any conversion between data types.
40444044

40454045
#### napi_set_named_property
40464046
<!-- YAML
@@ -4317,7 +4317,7 @@ NAPI_EXTERN napi_status napi_call_function(napi_env env,
43174317
```
43184318

43194319
* `[in] env`: The environment that the API is invoked under.
4320-
* `[in] recv`: The `this` object passed to the called function.
4320+
* `[in] recv`: The `this` value passed to the called function.
43214321
* `[in] func`: `napi_value` representing the JavaScript function to be invoked.
43224322
* `[in] argc`: The count of elements in the `argv` array.
43234323
* `[in] argv`: Array of `napi_values` representing JavaScript values passed in
@@ -5283,7 +5283,7 @@ NAPI_EXTERN napi_status napi_make_callback(napi_env env,
52835283
for `async_context` does not result in an error. However, this results
52845284
in incorrect operation of async hooks. Potential issues include loss of
52855285
async context when using the `AsyncLocalStorage` API.
5286-
* `[in] recv`: The `this` object passed to the called function.
5286+
* `[in] recv`: The `this` value passed to the called function.
52875287
* `[in] func`: `napi_value` representing the JavaScript function to be invoked.
52885288
* `[in] argc`: The count of elements in the `argv` array.
52895289
* `[in] argv`: Array of JavaScript values as `napi_value` representing the

0 commit comments

Comments
 (0)