Socket
Socket
Sign inDemoInstall

@owja/ioc

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@owja/ioc - npm Package Compare versions

Comparing version 1.0.0-beta.0 to 1.0.0-beta.1

2

dist/ioc.js

@@ -1,2 +0,2 @@

var t=function(t){this.t=t};t.prototype.inSingletonScope=function(){this.t.singleton=!0};var n=function(t){this.t=t};n.prototype.to=function(n){return this.t.object=n,new t(this.t)},n.prototype.toFactory=function(n){return this.t.factory=n,new t(this.t)},n.prototype.toValue=function(t){if(void 0===t)throw"cannot bind a value of type undefined";this.t.value=t};var i=function(){this.i={},this.o=[]};i.prototype.bind=function(t){return new n(this.u(t))},i.prototype.rebind=function(t){return this.remove(t).bind(t)},i.prototype.remove=function(t){if(void 0===this.i[t.toString()])throw t.toString()+" was never bound";return delete this.i[t.toString()],this},i.prototype.get=function(t){var n=this;if(void 0===this.i[t.toString()])throw"nothing bound to "+t.toString();var i=this.i[t.toString()],o=i.object,r=i.factory,u=i.value,e=i.cache,h=i.singleton,s=function(i){return h&&void 0!==e?e:(h&&(n.i[t.toString()].cache=i),i)};if(void 0!==o)return s(new o);if(void 0!==r)return s(r());if(void 0!==u)return u;throw"nothing is bound to "+t.toString()},i.prototype.snapshot=function(){return this.o.push(Object.assign({},this.i)),this},i.prototype.restore=function(){return this.i=this.o.pop()||this.i,this},i.prototype.u=function(t){if("object"==typeof this.i[t.toString()])throw"object can only bound once: "+t.toString();return this.i[t.toString()]={singleton:!1,tags:[]},this.i[t.toString()]},exports.Container=i,exports.createDecorator=function(t){return function(n){return function(t,n){return function(i,o){Object.defineProperty(i,o,{get:function(){return n.get(t)},enumerable:!0})}}(n,t)}};
var t=function(t){this.t=t};t.prototype.inSingletonScope=function(){this.t.singleton=!0};var n=function(t){this.t=t};n.prototype.to=function(n){return this.t.object=n,new t(this.t)},n.prototype.toFactory=function(n){return this.t.factory=n,new t(this.t)},n.prototype.toValue=function(t){if(void 0===t)throw"cannot bind a value of type undefined";this.t.value=t};var i=function(){this.i={},this.o=[]};i.prototype.bind=function(t){return new n(this.u(t))},i.prototype.rebind=function(t){return this.remove(t).bind(t)},i.prototype.remove=function(t){if(void 0===this.i[t.toString()])throw t.toString()+" was never bound";return delete this.i[t.toString()],this},i.prototype.get=function(t){var n=this.i[t.toString()];if(void 0===n)throw"nothing bound to "+t.toString();var i=n.object,o=n.factory,r=n.value,u=n.cache,e=n.singleton,h=function(t){return e&&void 0!==u?u:e?(n.cache=t(),n.cache):t()};if(void 0!==r)return r;if(void 0!==i)return h(function(){return new i});if(void 0!==o)return h(function(){return o()});throw"nothing is bound to "+t.toString()},i.prototype.snapshot=function(){return this.o.push(Object.assign({},this.i)),this},i.prototype.restore=function(){return this.i=this.o.pop()||this.i,this},i.prototype.u=function(t){if("object"==typeof this.i[t.toString()])throw"object can only bound once: "+t.toString();return this.i[t.toString()]={singleton:!1},this.i[t.toString()]},exports.Container=i,exports.createDecorator=function(t){return function(n){return function(t,n){return function(i,o){Object.defineProperty(i,o,{get:function(){return n.get(t)},enumerable:!0})}}(n,t)}};
//# sourceMappingURL=ioc.js.map
interface IConfig<T> {
tags: string[];
object?: INewAble<T>;

@@ -4,0 +3,0 @@ factory?: Factory<T>;

{
"name": "@owja/ioc",
"version": "1.0.0-beta.0",
"version": "1.0.0-beta.1",
"description": "dependency injection for javascript",

@@ -5,0 +5,0 @@ "main": "dist/ioc.js",

@@ -23,3 +23,3 @@ ![OWJA! IoC](resources/owja-ioc-logo.png)

##### Step 3 - Create symbols for our dependencies
##### Step 2 - Create symbols for our dependencies

@@ -34,3 +34,3 @@ Now we create the folder ***services*** and add the new file ***services/types.ts***:

##### Step 2 - Creating a container
##### Step 3 - Creating a container

@@ -56,3 +56,3 @@ Next we need a container to bind our dependencies to. Let's create the file ***services/container.ts***

##### Step 3 - Injecting dependencies
##### Step 4 - Injecting dependencies

@@ -59,0 +59,0 @@ Lets create a ***example.ts*** file in our source root:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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