Skip to content

Commit a00cd17

Browse files
legendecasBridgeAR
authored andcommitted
doc: reuse link indexes for n-api.md
PR-URL: #29787 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent d09f2b4 commit a00cd17

File tree

1 file changed

+45
-53
lines changed

1 file changed

+45
-53
lines changed

doc/api/n-api.md

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ properties:
3737
The N-API is a C API that ensures ABI stability across Node.js versions
3838
and different compiler levels. A C++ API can be easier to use.
3939
To support using C++, the project maintains a
40-
C++ wrapper module called
41-
[node-addon-api](https://github.com/nodejs/node-addon-api).
40+
C++ wrapper module called [node-addon-api][].
4241
This wrapper provides an inlineable C++ API. Binaries built
4342
with `node-addon-api` will depend on the symbols for the N-API C-based
4443
functions exported by Node.js. `node-addon-api` is a more
@@ -1557,8 +1556,7 @@ API.
15571556

15581557
## Working with JavaScript Values
15591558
N-API exposes a set of APIs to create all types of JavaScript values.
1560-
Some of these types are documented under
1561-
[Section 6](https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values)
1559+
Some of these types are documented under [Section 6][]
15621560
of the [ECMAScript Language Specification][].
15631561

15641562
Fundamentally, these APIs are used to do one of the following:
@@ -1594,9 +1592,7 @@ typedef enum {
15941592
```
15951593

15961594
Describes the type of a `napi_value`. This generally corresponds to the types
1597-
described in
1598-
[Section 6.1](https://tc39.github.io/ecma262/#sec-ecmascript-language-types) of
1599-
the ECMAScript Language Specification.
1595+
described in [Section 6.1][] of the ECMAScript Language Specification.
16001596
In addition to types in that section, `napi_valuetype` can also represent
16011597
`Function`s and `Object`s with external data.
16021598

@@ -1926,8 +1922,7 @@ Returns `napi_ok` if the API succeeded.
19261922
This API allocates a default JavaScript `Object`.
19271923
It is the equivalent of doing `new Object()` in JavaScript.
19281924

1929-
The JavaScript `Object` type is described in
1930-
[Section 6.1.7](https://tc39.github.io/ecma262/#sec-object-type) of the
1925+
The JavaScript `Object` type is described in [Section 6.1.7][] of the
19311926
ECMAScript Language Specification.
19321927

19331928
#### napi_create_symbol
@@ -1951,8 +1946,7 @@ Returns `napi_ok` if the API succeeded.
19511946

19521947
This API creates a JavaScript `Symbol` object from a UTF8-encoded C string.
19531948

1954-
The JavaScript `Symbol` type is described in
1955-
[Section 19.4](https://tc39.github.io/ecma262/#sec-symbol-objects)
1949+
The JavaScript `Symbol` type is described in [Section 19.4][]
19561950
of the ECMAScript Language Specification.
19571951

19581952
#### napi_create_typedarray
@@ -2093,11 +2087,8 @@ This API is used to convert from the C `int64_t` type to the JavaScript
20932087
The JavaScript `Number` type is described in [Section 6.1.6][]
20942088
of the ECMAScript Language Specification. Note the complete range of `int64_t`
20952089
cannot be represented with full precision in JavaScript. Integer values
2096-
outside the range of
2097-
[`Number.MIN_SAFE_INTEGER`](https://tc39.github.io/ecma262/#sec-number.min_safe_integer)
2098-
-(2^53 - 1) -
2099-
[`Number.MAX_SAFE_INTEGER`](https://tc39.github.io/ecma262/#sec-number.max_safe_integer)
2100-
(2^53 - 1) will lose precision.
2090+
outside the range of [`Number.MIN_SAFE_INTEGER`][] `-(2^53 - 1)` -
2091+
[`Number.MAX_SAFE_INTEGER`][] `(2^53 - 1)` will lose precision.
21012092

21022093
#### napi_create_double
21032094
<!-- YAML
@@ -2296,9 +2287,8 @@ Returns `napi_ok` if the API succeeded.
22962287

22972288
This API returns the length of an array.
22982289

2299-
`Array` length is described in
2300-
[Section 22.1.4.1](https://tc39.github.io/ecma262/#sec-properties-of-array-instances-length)
2301-
of the ECMAScript Language Specification.
2290+
`Array` length is described in [Section 22.1.4.1][] of the ECMAScript Language
2291+
Specification.
23022292

23032293
#### napi_get_arraybuffer_info
23042294
<!-- YAML
@@ -2671,11 +2661,8 @@ is passed in it returns `napi_number_expected`.
26712661
This API returns the C `int64` primitive equivalent of the given JavaScript
26722662
`Number`.
26732663

2674-
`Number` values outside the range of
2675-
[`Number.MIN_SAFE_INTEGER`](https://tc39.github.io/ecma262/#sec-number.min_safe_integer)
2676-
-(2^53 - 1) -
2677-
[`Number.MAX_SAFE_INTEGER`](https://tc39.github.io/ecma262/#sec-number.max_safe_integer)
2678-
(2^53 - 1) will lose precision.
2664+
`Number` values outside the range of [`Number.MIN_SAFE_INTEGER`][]
2665+
`-(2^53 - 1)` - [`Number.MAX_SAFE_INTEGER`][] `(2^53 - 1)` will lose precision.
26792666

26802667
Non-finite number values (`NaN`, `+Infinity`, or `-Infinity`) set the
26812668
result to zero.
@@ -2863,8 +2850,7 @@ This API returns the Undefined object.
28632850
## Working with JavaScript Values - Abstract Operations
28642851

28652852
N-API exposes a set of APIs to perform some abstract operations on JavaScript
2866-
values. Some of these operations are documented under
2867-
[Section 7](https://tc39.github.io/ecma262/#sec-abstract-operations)
2853+
values. Some of these operations are documented under [Section 7][]
28682854
of the [ECMAScript Language Specification][].
28692855

28702856
These APIs support doing one of the following:
@@ -2893,8 +2879,7 @@ napi_status napi_coerce_to_bool(napi_env env,
28932879
Returns `napi_ok` if the API succeeded.
28942880

28952881
This API implements the abstract operation `ToBoolean()` as defined in
2896-
[Section 7.1.2](https://tc39.github.io/ecma262/#sec-toboolean)
2897-
of the ECMAScript Language Specification.
2882+
[Section 7.1.2][] of the ECMAScript Language Specification.
28982883
This API can be re-entrant if getters are defined on the passed-in `Object`.
28992884

29002885
### napi_coerce_to_number
@@ -2916,8 +2901,7 @@ napi_status napi_coerce_to_number(napi_env env,
29162901
Returns `napi_ok` if the API succeeded.
29172902

29182903
This API implements the abstract operation `ToNumber()` as defined in
2919-
[Section 7.1.3](https://tc39.github.io/ecma262/#sec-tonumber)
2920-
of the ECMAScript Language Specification.
2904+
[Section 7.1.3][] of the ECMAScript Language Specification.
29212905
This API can be re-entrant if getters are defined on the passed-in `Object`.
29222906

29232907
### napi_coerce_to_object
@@ -2939,8 +2923,7 @@ napi_status napi_coerce_to_object(napi_env env,
29392923
Returns `napi_ok` if the API succeeded.
29402924

29412925
This API implements the abstract operation `ToObject()` as defined in
2942-
[Section 7.1.13](https://tc39.github.io/ecma262/#sec-toobject)
2943-
of the ECMAScript Language Specification.
2926+
[Section 7.1.13][] of the ECMAScript Language Specification.
29442927
This API can be re-entrant if getters are defined on the passed-in `Object`.
29452928

29462929
### napi_coerce_to_string
@@ -2962,8 +2945,7 @@ napi_status napi_coerce_to_string(napi_env env,
29622945
Returns `napi_ok` if the API succeeded.
29632946

29642947
This API implements the abstract operation `ToString()` as defined in
2965-
[Section 7.1.13](https://tc39.github.io/ecma262/#sec-tostring)
2966-
of the ECMAScript Language Specification.
2948+
[Section 7.1.13][] of the ECMAScript Language Specification.
29672949
This API can be re-entrant if getters are defined on the passed-in `Object`.
29682950

29692951
### napi_typeof
@@ -3013,9 +2995,7 @@ is true.
30132995
Returns `napi_ok` if the API succeeded.
30142996

30152997
This API represents invoking the `instanceof` Operator on the object as
3016-
defined in
3017-
[Section 12.10.4](https://tc39.github.io/ecma262/#sec-instanceofoperator)
3018-
of the ECMAScript Language Specification.
2998+
defined in [Section 12.10.4][] of the ECMAScript Language Specification.
30192999

30203000
### napi_is_array
30213001
<!-- YAML
@@ -3034,8 +3014,7 @@ napi_status napi_is_array(napi_env env, napi_value value, bool* result)
30343014
Returns `napi_ok` if the API succeeded.
30353015

30363016
This API represents invoking the `IsArray` operation on the object
3037-
as defined in [Section 7.2.2](https://tc39.github.io/ecma262/#sec-isarray)
3038-
of the ECMAScript Language Specification.
3017+
as defined in [Section 7.2.2][] of the ECMAScript Language Specification.
30393018

30403019
### napi_is_arraybuffer
30413020
<!-- YAML
@@ -3167,15 +3146,12 @@ napi_status napi_strict_equals(napi_env env,
31673146
Returns `napi_ok` if the API succeeded.
31683147

31693148
This API represents the invocation of the Strict Equality algorithm as
3170-
defined in
3171-
[Section 7.2.14](https://tc39.github.io/ecma262/#sec-strict-equality-comparison)
3172-
of the ECMAScript Language Specification.
3149+
defined in [Section 7.2.14][] of the ECMAScript Language Specification.
31733150

31743151
## Working with JavaScript Properties
31753152

31763153
N-API exposes a set of APIs to get and set properties on JavaScript
3177-
objects. Some of these types are documented under
3178-
[Section 7](https://tc39.github.io/ecma262/#sec-operations-on-objects) of the
3154+
objects. Some of these types are documented under [Section 7][] of the
31793155
[ECMAScript Language Specification][].
31803156

31813157
Properties in JavaScript are represented as a tuple of a key and a value.
@@ -3388,7 +3364,7 @@ property to be a JavaScript function represented by `method`. If this is
33883364
passed in, set `value`, `getter` and `setter` to `NULL` (since these members
33893365
won't be used).
33903366
* `attributes`: The attributes associated with the particular property.
3391-
See [`napi_property_attributes`](#n_api_napi_property_attributes).
3367+
See [`napi_property_attributes`][].
33923368
* `data`: The callback data passed into `method`, `getter` and `setter` if
33933369
this function is invoked.
33943370

@@ -3889,9 +3865,8 @@ be associated with the resulting JavaScript function (which is returned in the
38893865
`result` parameter) and freed whenever the function is garbage-collected by
38903866
passing both the JavaScript function and the data to [`napi_add_finalizer`][].
38913867

3892-
JavaScript `Function`s are described in
3893-
[Section 19.2](https://tc39.github.io/ecma262/#sec-function-objects)
3894-
of the ECMAScript Language Specification.
3868+
JavaScript `Function`s are described in [Section 19.2][] of the ECMAScript
3869+
Language Specification.
38953870

38963871
### napi_get_cb_info
38973872
<!-- YAML
@@ -5146,18 +5121,33 @@ This API may only be called from the main thread.
51465121
[Native Abstractions for Node.js]: https://github.com/nodejs/nan
51475122
[Object Lifetime Management]: #n_api_object_lifetime_management
51485123
[Object Wrap]: #n_api_object_wrap
5124+
[Section 6]: https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values
5125+
[Section 6.1]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types
5126+
[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type
5127+
[Section 6.1.6]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type
5128+
[Section 6.1.7]: https://tc39.github.io/ecma262/#sec-object-type
5129+
[Section 6.1.7.1]: https://tc39.github.io/ecma262/#table-2
5130+
[Section 7]: https://tc39.github.io/ecma262/#sec-abstract-operations
5131+
[Section 7.1.2]: https://tc39.github.io/ecma262/#sec-toboolean
5132+
[Section 7.1.3]: https://tc39.github.io/ecma262/#sec-tonumber
5133+
[Section 7.1.13]: https://tc39.github.io/ecma262/#sec-toobject
5134+
[Section 7.2.2]: https://tc39.github.io/ecma262/#sec-isarray
5135+
[Section 7.2.14]: https://tc39.github.io/ecma262/#sec-strict-equality-comparison
5136+
[Section 8.7]: https://tc39.es/ecma262/#sec-agents
5137+
[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc
51495138
[Section 12.5.5]: https://tc39.github.io/ecma262/#sec-typeof-operator
5139+
[Section 12.10.4]: https://tc39.github.io/ecma262/#sec-instanceofoperator
5140+
[Section 19.2]: https://tc39.github.io/ecma262/#sec-function-objects
5141+
[Section 19.4]: https://tc39.github.io/ecma262/#sec-symbol-objects
51505142
[Section 20.3]: https://tc39.github.io/ecma262/#sec-date-objects
51515143
[Section 22.1]: https://tc39.github.io/ecma262/#sec-array-objects
5144+
[Section 22.1.4.1]: https://tc39.github.io/ecma262/#sec-properties-of-array-instances-length
51525145
[Section 22.2]: https://tc39.github.io/ecma262/#sec-typedarray-objects
51535146
[Section 24.1]: https://tc39.github.io/ecma262/#sec-arraybuffer-objects
51545147
[Section 24.3]: https://tc39.github.io/ecma262/#sec-dataview-objects
51555148
[Section 25.4]: https://tc39.github.io/ecma262/#sec-promise-objects
5156-
[Section 6.1.4]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-string-type
5157-
[Section 6.1.6]: https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type
5158-
[Section 6.1.7.1]: https://tc39.github.io/ecma262/#table-2
5159-
[Section 8.7]: https://tc39.es/ecma262/#sec-agents
5160-
[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc
5149+
[`Number.MIN_SAFE_INTEGER`]: https://tc39.github.io/ecma262/#sec-number.min_safe_integer
5150+
[`Number.MAX_SAFE_INTEGER`]: https://tc39.github.io/ecma262/#sec-number.max_safe_integer
51615151
[Working with JavaScript Functions]: #n_api_working_with_javascript_functions
51625152
[Working with JavaScript Properties]: #n_api_working_with_javascript_properties
51635153
[Working with JavaScript Values - Abstract Operations]: #n_api_working_with_javascript_values_abstract_operations
@@ -5196,6 +5186,7 @@ This API may only be called from the main thread.
51965186
[`napi_open_callback_scope`]: #n_api_napi_open_callback_scope
51975187
[`napi_open_escapable_handle_scope`]: #n_api_napi_open_escapable_handle_scope
51985188
[`napi_open_handle_scope`]: #n_api_napi_open_handle_scope
5189+
[`napi_property_attributes`]: #n_api_napi_property_attributes
51995190
[`napi_property_descriptor`]: #n_api_napi_property_descriptor
52005191
[`napi_queue_async_work`]: #n_api_napi_queue_async_work
52015192
[`napi_reference_ref`]: #n_api_napi_reference_ref
@@ -5212,4 +5203,5 @@ This API may only be called from the main thread.
52125203
[`uv_unref`]: http://docs.libuv.org/en/v1.x/handle.html#c.uv_unref
52135204
[async_hooks `type`]: async_hooks.html#async_hooks_type
52145205
[context-aware addons]: addons.html#addons_context_aware_addons
5206+
[node-addon-api]: https://github.com/nodejs/node-addon-api
52155207
[worker threads]: https://nodejs.org/api/worker_threads.html

0 commit comments

Comments
 (0)