js-resolver
Version:
A light weight Inversion of Control(IOC) container for module pattern approch.
1 lines • 758 B
JavaScript
!function(r,e,t){"use strict";var o={},n=function(r,n){if(n)o[r]=n;else if(!o.hasOwnProperty(r)){var s=r+" does not exists in $resolver.";throw e.error(s),new t(s)}return o[r]};n.prototype.constructor.has=function(r){return o.hasOwnProperty(r)},n.prototype.constructor.remove=function(r){o.hasOwnProperty(r)&&delete o[r]},n.prototype.constructor.service=function(r,o){n(r,o).extend=function(r,o){var n=this;if(n.hasOwnProperty(r)){var s=r+" is already registered in $resolver.";throw e.error(s),new t(s)}return n[r]=o,n}},n.prototype.constructor.extend=function(r,n,s){var i="";if(!o.hasOwnProperty(r))throw i=n+" does not exists in $resolver.",e.error(i),new t(i);return o[r].extend(n,s),this},Object.freeze(n),r.$resolver=n}(this,this.console,this.Error);