Skip to content

Commit a7450e1

Browse files
committed
docs: api
Signed-off-by: Lexus Drumgold <[email protected]>
1 parent 1332188 commit a7450e1

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Universal drop-in replacement for [`module.builtinModules`][1]
1818
- [Install](#install)
1919
- [Use](#use)
2020
- [API](#api)
21+
- [`builtinModules`](#builtinmodules)
2122
- [Types](#types)
2223
- [Related](#related)
2324
- [Contribute](#contribute)
@@ -28,8 +29,8 @@ This package is a universal drop-in replacement for the [`builtinModules`][1] co
2829

2930
## When should I use this?
3031

31-
This package exports an array containing all modules provided by Node.js. It can be used to not only verify a Node.js
32-
module, but to also determine if a module can be imported using the [`node:`][3] protocol.
32+
This package exports an array containing the names of modules provided by Node.js. It can be used to not only verify
33+
that a module is maintained by Node.js, but to also determine if a module can be imported using a [`node:` URL][3].
3334

3435
## Install
3536

@@ -58,7 +59,20 @@ yarn add @flex-development/builtin-modules@flex-development/builtin-modules
5859

5960
## API
6061

61-
**TODO**: api documentation.
62+
This package exports the identifier `builtinModules`.
63+
64+
There is no default export.
65+
66+
### `builtinModules`
67+
68+
An array containing the names of modules provided by Node.js.
69+
70+
The array is a **superset** of [`module.builtinModules`][1] given the running version of Node.js.
71+
72+
Possible use cases:
73+
74+
- Check if a module can be imported using a [`node:` URL][3]
75+
- Check if a module is maintained by Node.js
6276

6377
## Types
6478

src/builtin-modules.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@
44
*/
55

66
/**
7-
* Names of modules provided by Node.js.
7+
* Array containing the names of modules provided by Node.js.
8+
*
9+
* The array is a **superset** of [`module.builtinModules`][1] given the running
10+
* version of Node.js.
811
*
912
* Possible use cases:
1013
*
11-
* - Check if a module can be imported using the [`node:`][1] protocol
14+
* - Check if a module can be imported using a [`node:` URL][2]
1215
* - Check if a module is maintained by Node.js
1316
*
14-
* [1]: https://nodejs.org/api/esm.html#node-imports
17+
* [1]: https://nodejs.org/api/module.html#modulebuiltinmodules
18+
* [2]: https://nodejs.org/api/esm.html#node-imports
1519
*
1620
* @const {string[]} builtinModules
1721
*/

0 commit comments

Comments
 (0)