Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

is-builtin-module

sindresorhus27.5mMIT5.0.0TypeScript support: included

Check if a string matches the name of a Node.js builtin module

builtin, built-in, builtins, node, modules, core, bundled, list, array, names, is, detect, check, match

readme

is-builtin-module

Check if a string matches the name of a Node.js builtin module

Note that this matches based a static list of modules from the latest Node.js version. If you want to check for a module in the current Node.js, use the core isBuiltin method.

Install

npm install is-builtin-module

Usage

import isBuiltinModule from 'is-builtin-module';

isBuiltinModule('fs');
//=> true

isBuiltinModule('fs/promises');
//=> true

isBuiltinModule('node:fs/promises');
//=> true

isBuiltinModule('unicorn');
//=> false
  • builtin-modules - A static list of the Node.js builtin modules from the latest Node.js version