Socket
Socket
Sign inDemoInstall

is-core-module

Package Overview
Dependencies
1
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-core-module

Is this specifier a node.js core module?


Version published
Maintainers
1
Weekly downloads
46,487,395
decreased by-7.49%

Weekly downloads

Package description

What is is-core-module?

The is-core-module package is a simple utility that allows developers to check if a given module name corresponds to a Node.js core module. Core modules are modules that are included with Node.js itself, such as 'http', 'fs', and 'path'. This package is particularly useful when building tools that need to differentiate between core modules and third-party modules.

What are is-core-module's main functionalities?

Check if a module is a core module

This feature allows you to check if a string corresponds to a Node.js core module. It returns true if the module is a core module, and false otherwise.

const isCoreModule = require('is-core-module');

console.log(isCoreModule('fs')); // true
console.log(isCoreModule('express')); // false

Check if a module is a core module with a specific Node.js version

This feature allows you to check if a module is a core module in a specific version of Node.js. This is useful when dealing with different Node.js versions that may have different sets of core modules.

const isCoreModule = require('is-core-module');

console.log(isCoreModule('fs', { version: '8.0.0' })); // true
console.log(isCoreModule('http2', { version: '8.0.0' })); // false

Other packages similar to is-core-module

Readme

Source

is-core-module Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Is this specifier a node.js core module? Optionally provide a node version to check; defaults to the current node version.

Example

var isCore = require('is-core-module');
var assert = require('assert');
assert(isCore('fs'));
assert(!isCore('butts'));

Tests

Clone the repo, npm install, and run npm test

Keywords

FAQs

Last updated on 16 May 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc