Skip to content

Commit 82458b3

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 c8c290a commit 82458b3

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

doc/api/n-api.md

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ clear the exception. On success, result will contain the handle to
999999
the last JavaScript `Object` thrown. If it is determined, after
10001000
retrieving the exception, the exception cannot be handled after all
10011001
it can be re-thrown it with [`napi_throw`][] where error is the
1002-
JavaScript `Error` object to be thrown.
1002+
JavaScript value to be thrown.
10031003

10041004
The following utility functions are also available in case native code
10051005
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,
11521152
* `[in] env`: The environment that the API is invoked under.
11531153
* `[in] code`: Optional `napi_value` with the string for the error code to be
11541154
associated with the error.
1155-
* `[in] msg`: `napi_value` that references a JavaScript `String` to be used as
1155+
* `[in] msg`: `napi_value` that references a JavaScript `string` to be used as
11561156
the message for the `Error`.
11571157
* `[out] result`: `napi_value` representing the error created.
11581158

@@ -1176,7 +1176,7 @@ NAPI_EXTERN napi_status napi_create_type_error(napi_env env,
11761176
* `[in] env`: The environment that the API is invoked under.
11771177
* `[in] code`: Optional `napi_value` with the string for the error code to be
11781178
associated with the error.
1179-
* `[in] msg`: `napi_value` that references a JavaScript `String` to be used as
1179+
* `[in] msg`: `napi_value` that references a JavaScript `string` to be used as
11801180
the message for the `Error`.
11811181
* `[out] result`: `napi_value` representing the error created.
11821182

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

@@ -2322,14 +2322,14 @@ napi_status napi_create_symbol(napi_env env,
23222322

23232323
* `[in] env`: The environment that the API is invoked under.
23242324
* `[in] description`: Optional `napi_value` which refers to a JavaScript
2325-
`String` to be set as the description for the symbol.
2326-
* `[out] result`: A `napi_value` representing a JavaScript `Symbol`.
2325+
`string` to be set as the description for the symbol.
2326+
* `[out] result`: A `napi_value` representing a JavaScript `symbol`.
23272327

23282328
Returns `napi_ok` if the API succeeded.
23292329

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

2332-
The JavaScript `Symbol` type is described in [Section 19.4][]
2332+
The JavaScript `symbol` type is described in [Section 19.4][]
23332333
of the ECMAScript Language Specification.
23342334

23352335
#### napi_create_typedarray
@@ -2416,14 +2416,14 @@ napi_status napi_create_int32(napi_env env, int32_t value, napi_value* result)
24162416

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

24212421
Returns `napi_ok` if the API succeeded.
24222422

24232423
This API is used to convert from the C `int32_t` type to the JavaScript
2424-
`Number` type.
2424+
`number` type.
24252425

2426-
The JavaScript `Number` type is described in
2426+
The JavaScript `number` type is described in
24272427
[Section 6.1.6][] of the ECMAScript Language Specification.
24282428

24292429
#### napi_create_uint32
@@ -2438,14 +2438,14 @@ napi_status napi_create_uint32(napi_env env, uint32_t value, napi_value* result)
24382438

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

24432443
Returns `napi_ok` if the API succeeded.
24442444

24452445
This API is used to convert from the C `uint32_t` type to the JavaScript
2446-
`Number` type.
2446+
`number` type.
24472447

2448-
The JavaScript `Number` type is described in
2448+
The JavaScript `number` type is described in
24492449
[Section 6.1.6][] of the ECMAScript Language Specification.
24502450

24512451
#### napi_create_int64
@@ -2460,14 +2460,14 @@ napi_status napi_create_int64(napi_env env, int64_t value, napi_value* result)
24602460

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

24652465
Returns `napi_ok` if the API succeeded.
24662466

24672467
This API is used to convert from the C `int64_t` type to the JavaScript
2468-
`Number` type.
2468+
`number` type.
24692469

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

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

24902490
Returns `napi_ok` if the API succeeded.
24912491

24922492
This API is used to convert from the C `double` type to the JavaScript
2493-
`Number` type.
2493+
`number` type.
24942494

2495-
The JavaScript `Number` type is described in
2495+
The JavaScript `number` type is described in
24962496
[Section 6.1.6][] of the ECMAScript Language Specification.
24972497

24982498
#### napi_create_bigint_int64
@@ -2581,14 +2581,14 @@ napi_status napi_create_string_latin1(napi_env env,
25812581
* `[in] str`: Character buffer representing an ISO-8859-1-encoded string.
25822582
* `[in] length`: The length of the string in bytes, or `NAPI_AUTO_LENGTH` if it
25832583
is null-terminated.
2584-
* `[out] result`: A `napi_value` representing a JavaScript `String`.
2584+
* `[out] result`: A `napi_value` representing a JavaScript `string`.
25852585

25862586
Returns `napi_ok` if the API succeeded.
25872587

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

2591-
The JavaScript `String` type is described in
2591+
The JavaScript `string` type is described in
25922592
[Section 6.1.4][] of the ECMAScript Language Specification.
25932593

25942594
#### napi_create_string_utf16
@@ -2608,14 +2608,14 @@ napi_status napi_create_string_utf16(napi_env env,
26082608
* `[in] str`: Character buffer representing a UTF16-LE-encoded string.
26092609
* `[in] length`: The length of the string in two-byte code units, or
26102610
`NAPI_AUTO_LENGTH` if it is null-terminated.
2611-
* `[out] result`: A `napi_value` representing a JavaScript `String`.
2611+
* `[out] result`: A `napi_value` representing a JavaScript `string`.
26122612

26132613
Returns `napi_ok` if the API succeeded.
26142614

2615-
This API creates a JavaScript `String` object from a UTF16-LE-encoded C string.
2615+
This API creates a JavaScript `string` value from a UTF16-LE-encoded C string.
26162616
The native string is copied.
26172617

2618-
The JavaScript `String` type is described in
2618+
The JavaScript `string` type is described in
26192619
[Section 6.1.4][] of the ECMAScript Language Specification.
26202620

26212621
#### napi_create_string_utf8
@@ -2635,14 +2635,14 @@ napi_status napi_create_string_utf8(napi_env env,
26352635
* `[in] str`: Character buffer representing a UTF8-encoded string.
26362636
* `[in] length`: The length of the string in bytes, or `NAPI_AUTO_LENGTH` if it
26372637
is null-terminated.
2638-
* `[out] result`: A `napi_value` representing a JavaScript `String`.
2638+
* `[out] result`: A `napi_value` representing a JavaScript `string`.
26392639

26402640
Returns `napi_ok` if the API succeeded.
26412641

2642-
This API creates a JavaScript `String` object from a UTF8-encoded C string.
2642+
This API creates a JavaScript `string` value from a UTF8-encoded C string.
26432643
The native string is copied.
26442644

2645-
The JavaScript `String` type is described in
2645+
The JavaScript `string` type is described in
26462646
[Section 6.1.4][] of the ECMAScript Language Specification.
26472647

26482648
### Functions to convert from Node-API to C types
@@ -2806,7 +2806,7 @@ napi_status napi_get_dataview_info(napi_env env,
28062806
* `[in] env`: The environment that the API is invoked under.
28072807
* `[in] dataview`: `napi_value` representing the `DataView` whose
28082808
properties to query.
2809-
* `[out] byte_length`: `Number` of bytes in the `DataView`.
2809+
* `[out] byte_length`: Number of bytes in the `DataView`.
28102810
* `[out] data`: The data buffer underlying the `DataView`.
28112811
If byte_length is `0`, this may be `NULL` or any other pointer value.
28122812
* `[out] arraybuffer`: `ArrayBuffer` underlying the `DataView`.
@@ -2879,15 +2879,15 @@ napi_status napi_get_value_double(napi_env env,
28792879
```
28802880

28812881
* `[in] env`: The environment that the API is invoked under.
2882-
* `[in] value`: `napi_value` representing JavaScript `Number`.
2882+
* `[in] value`: `napi_value` representing JavaScript `number`.
28832883
* `[out] result`: C double primitive equivalent of the given JavaScript
2884-
`Number`.
2884+
`number`.
28852885

28862886
Returns `napi_ok` if the API succeeded. If a non-number `napi_value` is passed
28872887
in it returns `napi_number_expected`.
28882888

28892889
This API returns the C double primitive equivalent of the given JavaScript
2890-
`Number`.
2890+
`number`.
28912891

28922892
#### napi_get_value_bigint_int64
28932893
<!-- YAML
@@ -3005,15 +3005,15 @@ napi_status napi_get_value_int32(napi_env env,
30053005
```
30063006

30073007
* `[in] env`: The environment that the API is invoked under.
3008-
* `[in] value`: `napi_value` representing JavaScript `Number`.
3008+
* `[in] value`: `napi_value` representing JavaScript `number`.
30093009
* `[out] result`: C `int32` primitive equivalent of the given JavaScript
3010-
`Number`.
3010+
`number`.
30113011

30123012
Returns `napi_ok` if the API succeeded. If a non-number `napi_value`
30133013
is passed in `napi_number_expected`.
30143014

30153015
This API returns the C `int32` primitive equivalent
3016-
of the given JavaScript `Number`.
3016+
of the given JavaScript `number`.
30173017

30183018
If the number exceeds the range of the 32 bit integer, then the result is
30193019
truncated to the equivalent of the bottom 32 bits. This can result in a large
@@ -3035,17 +3035,17 @@ napi_status napi_get_value_int64(napi_env env,
30353035
```
30363036

30373037
* `[in] env`: The environment that the API is invoked under.
3038-
* `[in] value`: `napi_value` representing JavaScript `Number`.
3038+
* `[in] value`: `napi_value` representing JavaScript `number`.
30393039
* `[out] result`: C `int64` primitive equivalent of the given JavaScript
3040-
`Number`.
3040+
`number`.
30413041

30423042
Returns `napi_ok` if the API succeeded. If a non-number `napi_value`
30433043
is passed in it returns `napi_number_expected`.
30443044

30453045
This API returns the C `int64` primitive equivalent of the given JavaScript
3046-
`Number`.
3046+
`number`.
30473047

3048-
`Number` values outside the range of [`Number.MIN_SAFE_INTEGER`][]
3048+
`number` values outside the range of [`Number.MIN_SAFE_INTEGER`][]
30493049
`-(2**53 - 1)` - [`Number.MAX_SAFE_INTEGER`][] `(2**53 - 1)` will lose
30503050
precision.
30513051

@@ -3076,7 +3076,7 @@ napi_status napi_get_value_string_latin1(napi_env env,
30763076
* `[out] result`: Number of bytes copied into the buffer, excluding the null
30773077
terminator.
30783078

3079-
Returns `napi_ok` if the API succeeded. If a non-`String` `napi_value`
3079+
Returns `napi_ok` if the API succeeded. If a non-`string` `napi_value`
30803080
is passed in it returns `napi_string_expected`.
30813081

30823082
This API returns the ISO-8859-1-encoded string corresponding the value passed
@@ -3106,7 +3106,7 @@ napi_status napi_get_value_string_utf8(napi_env env,
31063106
* `[out] result`: Number of bytes copied into the buffer, excluding the null
31073107
terminator.
31083108

3109-
Returns `napi_ok` if the API succeeded. If a non-`String` `napi_value`
3109+
Returns `napi_ok` if the API succeeded. If a non-`string` `napi_value`
31103110
is passed in it returns `napi_string_expected`.
31113111

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

3138-
Returns `napi_ok` if the API succeeded. If a non-`String` `napi_value`
3138+
Returns `napi_ok` if the API succeeded. If a non-`string` `napi_value`
31393139
is passed in it returns `napi_string_expected`.
31403140

31413141
This API returns the UTF16-encoded string corresponding the value passed in.
@@ -3153,7 +3153,7 @@ napi_status napi_get_value_uint32(napi_env env,
31533153
```
31543154

31553155
* `[in] env`: The environment that the API is invoked under.
3156-
* `[in] value`: `napi_value` representing JavaScript `Number`.
3156+
* `[in] value`: `napi_value` representing JavaScript `number`.
31573157
* `[out] result`: C primitive equivalent of the given `napi_value` as a
31583158
`uint32_t`.
31593159

@@ -3243,8 +3243,8 @@ of the [ECMAScript Language Specification][].
32433243

32443244
These APIs support doing one of the following:
32453245

3246-
1. Coerce JavaScript values to specific JavaScript types (such as `Number` or
3247-
`String`).
3246+
1. Coerce JavaScript values to specific JavaScript types (such as `number` or
3247+
`string`).
32483248
2. Check the type of a JavaScript value.
32493249
3. Check for equality between two JavaScript values.
32503250

@@ -3284,7 +3284,7 @@ napi_status napi_coerce_to_number(napi_env env,
32843284

32853285
* `[in] env`: The environment that the API is invoked under.
32863286
* `[in] value`: The JavaScript value to coerce.
3287-
* `[out] result`: `napi_value` representing the coerced JavaScript `Number`.
3287+
* `[out] result`: `napi_value` representing the coerced JavaScript `number`.
32883288

32893289
Returns `napi_ok` if the API succeeded.
32903290

@@ -3328,7 +3328,7 @@ napi_status napi_coerce_to_string(napi_env env,
33283328

33293329
* `[in] env`: The environment that the API is invoked under.
33303330
* `[in] value`: The JavaScript value to coerce.
3331-
* `[out] result`: `napi_value` representing the coerced JavaScript `String`.
3331+
* `[out] result`: `napi_value` representing the coerced JavaScript `string`.
33323332

33333333
Returns `napi_ok` if the API succeeded.
33343334

@@ -3612,7 +3612,7 @@ following forms:
36123612
* Named: a simple UTF8-encoded string
36133613
* Integer-Indexed: an index value represented by `uint32_t`
36143614
* JavaScript value: these are represented in Node-API by `napi_value`. This can
3615-
be a `napi_value` representing a `String`, `Number`, or `Symbol`.
3615+
be a `napi_value` representing a `string`, `number`, or `symbol`.
36163616

36173617
Node-API values are represented by the type `napi_value`.
36183618
Any Node-API call that requires a JavaScript value takes in a `napi_value`.
@@ -3807,7 +3807,7 @@ typedef struct {
38073807
} napi_property_descriptor;
38083808
```
38093809

3810-
* `utf8name`: Optional `String` describing the key for the property,
3810+
* `utf8name`: Optional string describing the key for the property,
38113811
encoded as UTF8. One of `utf8name` or `name` must be provided for the
38123812
property.
38133813
* `name`: Optional `napi_value` that points to a JavaScript string or symbol
@@ -4003,8 +4003,8 @@ napi_status napi_has_own_property(napi_env env,
40034003
Returns `napi_ok` if the API succeeded.
40044004

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

40094009
#### napi_set_named_property
40104010
<!-- YAML
@@ -4281,7 +4281,7 @@ NAPI_EXTERN napi_status napi_call_function(napi_env env,
42814281
```
42824282

42834283
* `[in] env`: The environment that the API is invoked under.
4284-
* `[in] recv`: The `this` object passed to the called function.
4284+
* `[in] recv`: The `this` value passed to the called function.
42854285
* `[in] func`: `napi_value` representing the JavaScript function to be invoked.
42864286
* `[in] argc`: The count of elements in the `argv` array.
42874287
* `[in] argv`: Array of `napi_values` representing JavaScript values passed in
@@ -5247,7 +5247,7 @@ NAPI_EXTERN napi_status napi_make_callback(napi_env env,
52475247
for `async_context` does not result in an error. However, this results
52485248
in incorrect operation of async hooks. Potential issues include loss of
52495249
async context when using the `AsyncLocalStorage` API.
5250-
* `[in] recv`: The `this` object passed to the called function.
5250+
* `[in] recv`: The `this` value passed to the called function.
52515251
* `[in] func`: `napi_value` representing the JavaScript function to be invoked.
52525252
* `[in] argc`: The count of elements in the `argv` array.
52535253
* `[in] argv`: Array of JavaScript values as `napi_value` representing the

0 commit comments

Comments
 (0)