Socket
Socket
Sign inDemoInstall

is-module

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-module

check if a source string is an es6 module


Version published
Weekly downloads
6.4M
decreased by-2.8%
Maintainers
1
Weekly downloads
 
Created

What is is-module?

The is-module npm package is a utility that helps determine if a given source string is an ES6 module. It is particularly useful for developers who need to differentiate between CommonJS and ES6 module formats in their codebases.

What are is-module's main functionalities?

Check if a string is an ES6 module

This feature allows you to check if a given string of source code is an ES6 module. In the example, the string 'export default 42' is identified as an ES6 module.

const isModule = require('is-module');
const sourceCode = 'export default 42';
console.log(isModule(sourceCode)); // true

Check if a string is not an ES6 module

This feature allows you to check if a given string of source code is not an ES6 module. In the example, the string 'module.exports = 42' is identified as not being an ES6 module.

const isModule = require('is-module');
const sourceCode = 'module.exports = 42';
console.log(isModule(sourceCode)); // false

Other packages similar to is-module

Keywords

FAQs

Package last updated on 01 Apr 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc