Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
A simple dependency injection container.
npm install --save depin
const depin = require('depin');
const app = depin();
app.set('beatles', [
{ name: 'George' },
{ name: 'John' },
{ name: 'Paul' },
{ name: 'Ringo' },
]);
app.register('beatleService' (beatles) => ({
getCount() {
return beatles.length;
},
}));
app.get('beatleService').count(); // 4
apply( factory:function ) :*
Run a function with all arguments injected from the DI container by name and return the result.
app.set({ one: 1, two: 2, three: 3 });
app.apply((one, two, three) => one + two + three); // 6
get( [name:string] ) :*
Get a value from the DI container.
app.set({ one: 1 });
app.get('one'); // value
When no name is passed app.get
will return a dependency picker which is very useful when combined with object destructuring.
app.set({ one: 1, two: 2 });
const { one, two } = app.get();
register( factory:function ) :app
Register a factory.
app.set({ one: 1, two: 2 });
app.register(function myManager(one, two) {
return { add: () => one + two };
});
app.get('myManager').add(); // 3
Or set its name directly.
app.set({ one: 1, two: 2 });
app.register('myManager', (one, two) => {
return { add: () => one + two };
});
app.get('myManager').add(); // 3
run( func:function ) :app
Run a function with all arguments injected from the DI container by name.
app.set({ one: 1, two: 2 });
app.run((one, two) => {
//
});
set( properties:object ) :app
/ set( name:string, value:* ):app
Set values in the DI container.
FAQs
A simple dependency injection container.
We found that depin 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.