UNPKG

659 BTypeScriptView Raw
1/**
2Check if a string matches the name of a Node.js builtin module.
3
4This matches based a [static list of modules](https://github.com/sindresorhus/builtin-modules) from the latest Node.js version. If you want to check for a module in the current Node.js, use the core [`isBuiltin`](https://nodejs.org/api/module.html#moduleisbuiltinmodulename) method.
5
6@param moduleName - The name of the module.
7
8@example
9```
10import isBuiltinModule from 'is-builtin-module';
11
12isBuiltinModule('fs/promises');
13//=> true
14
15isBuiltinModule('node:fs');
16//=> true
17
18isBuiltinModule('unicorn');
19//=> false
20```
21*/
22export default function isBuiltinModule(moduleName: string): boolean;