Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cheap-di

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cheap-di - npm Package Compare versions

Comparing version 0.1.6 to 1.0.0

9

dist/container.js

@@ -22,4 +22,13 @@ "use strict";

registerInstance: function (instance) {
if (instance.constructor) {
if (dependencies.has(instance.constructor)) {
throw new Error(`The instance type (${instance.constructor.name}) is already registered`);
}
dependencies.set(instance.constructor, instance);
}
return {
as: (type) => {
if (instance.constructor) {
dependencies.delete(instance.constructor);
}
if (dependencies.has(type)) {

@@ -26,0 +35,0 @@ throw new Error(`The instance type (${type.name}) is already registered`);

7

package.json
{
"name": "cheap-di",
"version": "0.1.6",
"version": "1.0.0",
"description": "JavaScript dependency injection like Autofac in .Net",
"scripts": {
"build": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest src"
},
"devDependencies": {
"@types/jest": "^26.0.14",
"jest": "^26.4.2",
"ts-jest": "^26.4.1",
"tslib": "2.0.1",

@@ -11,0 +14,0 @@ "typescript": "3.9.7"

@@ -95,3 +95,2 @@ # cheap-di

constructor(userRepository, logger) {
super();
this.userRepository = userRepository;

@@ -138,1 +137,3 @@ this.logger = logger;

```
You can see more examples in `cheap-di/src/container.test.ts`

Sorry, the diff of this file is not supported yet

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