Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clear-module

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clear-module

Clear a module from the cache

  • 4.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is clear-module?

The clear-module npm package allows you to clear a module from the require cache, enabling you to re-require it and get a fresh instance. This is particularly useful in scenarios where you need to reload a module without restarting the Node.js process, such as during development or testing.

What are clear-module's main functionalities?

Clear a single module

This feature allows you to clear a specific module from the require cache. By doing so, the next time you require this module, it will be reloaded as if it was required for the first time.

const clearModule = require('clear-module');
clearModule('./path/to/module');

Clear multiple modules

This feature allows you to clear multiple modules from the require cache in one go. This is useful when you need to refresh several modules at once.

const clearModule = require('clear-module');
['./path/to/module1', './path/to/module2'].forEach(clearModule);

Clear all modules

This feature allows you to clear all modules from the require cache. This can be useful in a development environment where you want to ensure that all modules are reloaded.

const clearModule = require('clear-module');
Object.keys(require.cache).forEach(clearModule);

Other packages similar to clear-module

Keywords

FAQs

Package last updated on 03 Nov 2021

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