Socket
Socket
Sign inDemoInstall

require-in-the-middle

Package Overview
Dependencies
Maintainers
1
Versions
30
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 4.0.1 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
]
}
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