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

r42

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

r42 - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

8

lib/index.js

@@ -93,1 +93,9 @@ 'use strict';

};
/**
* For debugging purposes
*
setTimeout(function () {
console.log(require('util').inspect(mc.$modules, {colors: true, depth: null}));
}, 5000);
//*/

40

lib/moduleContext.js

@@ -11,2 +11,29 @@ 'use strict';

function executeCallbacks(callbacks, err, value) {
_.each(callbacks, function (cb) {
cb(err, value);
});
callbacks.splice(0, callbacks.length);
}
function isDependentOf(modules, modA, modB) {
var lookedIn = [];
var toLook = [modB];
while (toLook.length > 0) {
lookedIn = lookedIn.concat(toLook);
var tmp = toLook;
toLook = [];
if (_.some(tmp, function (mod) {
toLook = toLook.concat(_.difference(tmp, lookedIn));
return modules[mod].dependent.indexOf(modA) >= 0;
})) {
return true;
}
}
return false;
}
function ModuleContext(config, define) {

@@ -35,4 +62,6 @@ if (!(this instanceof ModuleContext)) {

moduleFn(function (err, module) {
this.$modules[resolvedName].callbacks.push(callback);
this.$modules[resolvedName].loading = false;
if (err) {
return callback(err);
return executeCallbacks(this.$modules[resolvedName].callbacks, err);
}

@@ -45,8 +74,3 @@ if (module.constructor.name === 'Object') {

}
this.$modules[resolvedName].loading = false;
_.each(this.$modules[resolvedName].callbacks, function (callback) {
callback(null, this.$modules[resolvedName].content);
}.bind(this));
this.$modules[resolvedName].callbacks = [];
callback(null, this.$modules[resolvedName].content);
executeCallbacks(this.$modules[resolvedName].callbacks, null, this.$modules[resolvedName].content);
}.bind(this));

@@ -60,3 +84,3 @@ };

if (this.$modules[name].loading) {
if (this.$modules[callee].dependent.indexOf(name) < 0) {
if (!isDependentOf(this.$modules, callee, name)) {//this.$modules[callee].dependent.indexOf(name) < 0) {
this.$modules[name].callbacks.push(callback);

@@ -63,0 +87,0 @@ return;

2

package.json
{
"name": "r42",
"version": "0.0.18",
"version": "0.0.19",
"description": "Dependency injection done right.",

@@ -5,0 +5,0 @@ "author": "Quentin Raynaud <npm@qraynaud.eu>",

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