You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

require-in-the-middle

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-in-the-middle - npm Package Compare versions

Comparing version

to
5.0.0

14

index.js

@@ -31,3 +31,3 @@ 'use strict'

this.cache = {}
this.cache = new Map()
this._unhooked = false

@@ -59,5 +59,5 @@ this._origRequire = Module.prototype.require

// return known patched modules immediately
if (Object.prototype.hasOwnProperty.call(self.cache, filename) === true) {
if (self.cache.has(filename) === true) {
debug('returning already patched cached module: %s', filename)
return self.cache[filename]
return self.cache.get(filename)
}

@@ -136,12 +136,12 @@

// only call onrequire the first time a module is loaded
if (Object.prototype.hasOwnProperty.call(self.cache, filename) === false) {
if (self.cache.has(filename) === false) {
// ensure that the cache entry is assigned a value before calling
// onrequire, in case calling onrequire requires the same module.
self.cache[filename] = exports
self.cache.set(filename, exports)
debug('calling require hook: %s', moduleName)
self.cache[filename] = onrequire(exports, moduleName, basedir)
self.cache.set(filename, onrequire(exports, moduleName, basedir))
}
debug('returning module: %s', moduleName)
return self.cache[filename]
return self.cache.get(filename)
}

@@ -148,0 +148,0 @@ }

{
"name": "require-in-the-middle",
"version": "4.0.1",
"version": "5.0.0",
"description": "Module to hook into the Node.js require function",

@@ -44,5 +44,5 @@ "main": "index.js",

"coordinates": [
55.6819147,
12.5720135
55.778265,
12.593155
]
}