UNPKG

ng-injector

Version:

Injector decorator for writing angular 1.x with ES6/TypeScript

6 lines 964 B
/*! * ng-injector v0.4.5 * (c) 2016 Yinan * Released under the MIT License. */ !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(t.injector=t.injector||{})}(this,function(t){"use strict";function r(t,r){if(t){var e=void 0;if(t instanceof Array){e=t.length;for(var n=e-1;n>=0;n--)r(t[n],n)}else{var o=Object.keys(t),i=void 0;e=o.length;for(var f=0;e>f;f++)i=o[f],r(t[i],i)}}}var e=function(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];if("string"==typeof t)t=[t];else if(!(t instanceof Array))throw new Error("deps must be Array");return function(e){var n=function(n){var o=function(){var o=this;return r(n,function(r,e){return o[t[e]]=r}),e.call(this)};return o.prototype=e.prototype,new o},o=function(){for(var t=arguments.length,r=Array(t),e=0;t>e;e++)r[e]=arguments[e];return n(r)};return o.$inject=t,o.prototype=e.prototype,o}};t.injector=e});