require-in-the-middle
Advanced tools
Comparing version 7.2.0 to 7.2.1
19
index.js
@@ -227,8 +227,17 @@ 'use strict' | ||
// fullModuleName = 'foo/bar' | ||
if (hasWhitelist === true && modules.includes(moduleName) === false) { | ||
if (modules.includes(fullModuleName) === false) return exports // abort if module name isn't on whitelist | ||
let isWhitelistedSubmodule = false | ||
if (hasWhitelist) { | ||
// abort if module name isn't on whitelist | ||
if (!modules.includes(moduleName) && !modules.includes(fullModuleName)) { | ||
return exports | ||
} | ||
// if we get to this point, it means that we're requiring a whitelisted sub-module | ||
moduleName = fullModuleName | ||
} else { | ||
if (modules.includes(fullModuleName) && moduleName !== fullModuleName) { | ||
// if we get to this point, it means that we're requiring a whitelisted sub-module | ||
moduleName = fullModuleName | ||
isWhitelistedSubmodule = true | ||
} | ||
} | ||
if (!isWhitelistedSubmodule) { | ||
// figure out if this is the main module file, or a file inside the module | ||
@@ -235,0 +244,0 @@ let res |
{ | ||
"name": "require-in-the-middle", | ||
"version": "7.2.0", | ||
"version": "7.2.1", | ||
"description": "Module to hook into the Node.js require function", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16423
268