Socket
Book a DemoInstallSign in
Socket

require-mod

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-mod

Tool to modify the require-process of a module

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

Require Modifier (require-mod)

RequireMod is a NodeJS-Package which provides the functionality to modify the require-process of a nodejs-module instance.

Installation

This module is installed via npm:

$ npm install require-mod

Usage

Include the ProxyScope constructor:

var ProxyScope = require('require-mod').ProxyScope;

Create a new proxyScope:

var scope = new ProxyScope(module);

Register a redirection:

scope.when(/^fs$/).redirect("fse");

var fse = require("fs"); // the "fse" module instance 

After the regitration the require function of the current module has been modified and loads the registered module-proxy

The Module is also Typescript compatible, you can use the mtype:require-mod to install the definitions.

Keywords

require

FAQs

Package last updated on 18 Dec 2015

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