require-in-the-middle
Advanced tools
+7
-7
@@ -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 @@ } |
+3
-3
| { | ||
| "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 | ||
| ] | ||
| } |
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
10885
-0.45%