diff options
author | hemanth.hm <hemanth.hm@gmail.com> | 2022-07-08 01:12:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-08 09:12:32 +0100 |
commit | 6317b8432eb86ceca1ef4b4993214f2ea92091e7 (patch) | |
tree | 556038f48747214c5a1065e02d081777d14bdb93 /doc | |
parent | 264d5fe8cb6a653a178f1b3c8f546eec71ff1981 (diff) | |
download | node-new-6317b8432eb86ceca1ef4b4993214f2ea92091e7.tar.gz |
module: add isBuiltIn method
PR-URL: https://github.com/nodejs/node/pull/43396
Fixes: https://github.com/nodejs/node/issues/42785
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/module.md | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/api/module.md b/doc/api/module.md index 85ba9a79e2..04b5263155 100644 --- a/doc/api/module.md +++ b/doc/api/module.md @@ -62,6 +62,22 @@ const require = createRequire(import.meta.url); const siblingModule = require('./sibling-module'); ``` +### `module.isBuiltin(moduleName)` + +<!-- YAML +added: REPLACEME +--> + +* `moduleName` {string} name of the module +* Returns: {boolean} returns true if the module is builtin else returns false + +```mjs +import { isBuiltin } from 'node:module'; +isBuiltin('node:fs'); // true +isBuiltin('fs'); // true +isBuiltin('wss'); // false +``` + ### `module.syncBuiltinESMExports()` <!-- YAML |