New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-require-fallback

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-require-fallback - npm Package Compare versions

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.
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