-
Notifications
You must be signed in to change notification settings - Fork 67
/
bottle.min.js
10 lines (9 loc) · 3.38 KB
/
bottle.min.js
1
2
3
4
5
6
7
8
9
10
/**
* BottleJS v0.7.0 - 2014-12-06
* A powerful, extensible dependency injection micro container
*
* Copyright (c) 2014 Stephen Young
* Licensed MIT
*/
(function(){"use strict";var a=0,b=Array.prototype.slice,c=[],d=function(a,b){return a.concat(b)},e=function(a,b,c){var d=a[b];return d||(d=a[b]={}),c&&!d[c]&&(d[c]=[]),c?d[c]:d},f=function(a,b,f){return e(c,b,f).map(g.bind(null,a)).reduce(d,e(a,b,f)).concat(e(a,b,"__global__"))},g=function(a,b){return e(a,b.id,b.fullname)},h=function(a,b){return a[b]},i=function(a,b,c,d){"function"==typeof c&&(d=c,c="__global__"),e(a,b,c).push(d)},j=function(a,b){var c=a.split(".");return a=c.pop(),k.call(c.reduce(H,this.container),a,b),this},k=function(a,b){Object.defineProperty(this,a,{configurable:!1,enumerable:!0,value:b,writable:!1})},l=[],m=function(a,b){return i(l,this.id,a,b),this},n=[],o=function(a){return i(n,this.id,a),this},p=function(a){return a.split(".").reduce(h,this)},q=function(a){return(a||[]).map(p,this.container)},r=function(a,b){return A.call(this,a,function(){this.$get=b})},s=[],t=function(a,b,c,d){var e=f(s,a,b),g={configurable:!0,enumerable:!0};return e.length?g.get=function(){var a=0,b=function(){e[a]&&e[a++](c,b)};return b(),c}:(g.value=c,g.writable=!0),Object.defineProperty(d,b,g),d[b]},u=function(a,b){return i(s,this.id,a,b),this},v={},w=function(a){var b;return a?(b=v[a],b||(v[a]=b=new J),b):new J},x=[],y=[],z=function(a,b){return b(a)},A=function(a,b){var c,d,f,g,h;return g=this.id,d=e(y,g),d[a]?void 0:(d[a]=!0,c=a.split("."),f=c.shift(),h=c.length?C:B,h.call(this,f,b,a,c))},B=function(a,b){var c,d,e,g;return g=this.id,e=this.container,c=a+"Provider",d=Object.create(null),d[c]={configurable:!0,enumerable:!0,get:function(){var a=new b;return delete e[c],e[c]=a,a}},d[a]={configurable:!0,enumerable:!0,get:function(){var b,d=e[c];return d&&(delete e[c],delete e[a],b=f(l,g,a).reduce(z,d.$get(e))),b?t(g,a,b,e):b}},Object.defineProperties(e,d),this},C=function(a,b,d,f){var g,h,j,k;return k=this.id,h=e(x,k),g=h[a],g||(this.container[a]=(g=h[a]=J.pop()).container),j=f.join("."),g.provider(j,b),i(c,g.id,j,{fullname:d,id:k}),this},D=function(a){return this[a.$type||"service"].apply(this,[a.$name,a].concat(a.$inject||[]))},E=function(a){return e(n,this.id,"__global__").forEach(function(b){b(a)}),this},F=function(a,c){var d=arguments.length>2?b.call(arguments,1):null,e=this;return r.call(this,a,function(){return d&&(c=c.bind.apply(c,d.map(h.bind(e,e.container)))),new c})},G=function(a,b){var c;return c=a.split("."),a=c.pop(),I.call(c.reduce(H,this.container),a,b),this},H=function(a,b){var c={};return I.call(a,b,c),c},I=function(a,b){Object.defineProperty(this,a,{configurable:!0,enumerable:!0,value:b,writable:!0})},J=function L(b){return this instanceof L?(this.id=a++,void(this.container={$register:D.bind(this)})):L.pop(b)};J.prototype={constant:j,decorator:m,defer:o,digest:q,factory:r,middleware:u,provider:A,register:D,resolve:E,service:F,value:G},J.pop=w;var K={"function":!0,object:!0};!function(a){var b=K[typeof exports]&&exports&&!exports.nodeType&&exports,c=K[typeof module]&&module&&!module.nodeType&&module,d=c&&c.exports===b&&b,e=K[typeof global]&&global;!e||e.global!==e&&e.window!==e||(a=e),"function"==typeof define&&"object"==typeof define.amd&&define.amd?(a.Bottle=J,define(function(){return J})):b&&c?d?(c.exports=J).Bottle=J:b.Bottle=J:a.Bottle=J}(K[typeof window]&&window||this)}).call(this);
//# sourceMappingURL=bottle.min.js.map