node-require-fallback
Advanced tools
Comparing version 0.1.1 to 0.1.2
10
index.js
@@ -11,3 +11,3 @@ function exists(nodeModule) { | ||
function requireIfExists(nodeModule, fallbackModule) { | ||
function requireIfExists(nodeModule, fallbackModule1, fallbackModule2) { | ||
if (exists(nodeModule)) { | ||
@@ -17,6 +17,10 @@ return require(nodeModule) | ||
if (fallbackModule) { | ||
return require(fallbackModule); | ||
if (exists(fallbackModule1)) { | ||
return require(fallbackModule1); | ||
} | ||
if (exists(fallbackModule2)) { | ||
return require(fallbackModule2); | ||
} | ||
return null; | ||
@@ -23,0 +27,0 @@ } |
{ | ||
"name": "node-require-fallback", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Require another package in Node.js if your first choice doesn't exist.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -22,3 +22,3 @@ # node-require-fallback | ||
`myModule` will now hold `module1` if it existed, `module2` otherwise. | ||
`myModule` may be `null`, if `module2` wasn't available. | ||
`myModule` will now hold `module1` if it exists or `module2` otherwise. | ||
`myModule` will be `null`, if `module2` wasn't available as well. |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance 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
2871
21
0
4