
Product
Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.
Simple dependency injection container for nodejs4+
$ npm install xcatalog --save
There are to different ways to load references into the xcatalog:
xcatalog.set(id, type, ref, deps)
"use strict";
//A.js
class A {
constructor (str) {
this.bar = str;
}
}
function foo (a, b) {
return a + " " + b;
}
//config.js
const xcatalog = require("xcatalog");
xcatalog
.set("MY_TEXT", "constant", "BANANA")
.set("a", "singleton", A, ["MY_TEXT"])
.set("foo", "factory", foo, ["MY_TEXT", "MY_TEXT"]);;
console.log(xcatalog("a").bar); // "BANANA"
console.log(xcatalog("foo")); // "BANANA BANANA"
"use strict";
//A.js
class A {
constructor () {
this.foo = "BANANA";
}
}
A.$xcatalog = { id: "a", type: "singleton" };
//B.js
class B {
constructor (a) {
this.bar = a.foo;
}
}
B.$xcatalog = { id: "b", type: "singleton", inject: ["a"] };
//config.js
const xcatalog = require("xcatalog");
//xcatalog.load(require("./A")).load(require("./B"));
xcatalog.load(A).load(B);
console.log(xcatalog("b").bar); // "BANANA"
Use xcatalog.loaddir(path) to load all resouces with $catalog annotation in the given path.
This function will require every .js file in the path and sub directories.
"use strict";
const xcatalog = require("xcatalog");
//Get service instance already built with dependencies
const myService = xcatalog("myService");
If any reference returns a promise the xcatalog cannot be used until is ready.
xcatalog.ready() returns a promise, that promise is fulfilled when the xcatalog is fully available or rejected is any pending promise es rejected.
"use strict";
const xcatalog = require("xcatalog");
const promise = Promise.resolve("BANANA");
xcatalog.set("VALUE", "constant", promise);
//Get service instance already builded with dependencies
xcatalog.ready().then(function () {
console.log(xcatalog("VALUE")); // "BANANA"
});
FAQs
Dependency injection container for JavaScript
We found that xcatalog demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.