-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmithril-di.min.js
1 lines (1 loc) · 972 Bytes
/
mithril-di.min.js
1
!function(){var e;return e=[],Mithril.factory=function(n,r){if("undefined"==typeof n||"string"!=typeof n||0===n.length)throw new Error("Dependency name undefined");if("undefined"!=typeof e[n])throw new Error("Duplicate dependency entry");if("function"!=typeof r&&(!Array.isArray(r)||0===r.length))throw new Error("Empty dependency list");if(e[n]={fn:"function"==typeof r?r:r.pop()||null,dependencies:Array.isArray(r)?r||null:null,instance:null},null===e[n].fn)throw delete e[n],new Error("Empty repository entry");if("function"!=typeof e[n].fn)throw delete e[n],new Error("Dependency not a function");return!0},Mithril.resolve=function(n,r,t){var i;if("undefined"==typeof e[n])throw new Error("Undefined dependency resolve: "+n);return null===e[n].instance&&(i=[],null!==e[n].dependencies&&e[n].dependencies.forEach(function(e){return i.push(Mithril.resolve(e))}),e[n].instance=e[n].fn.apply(t||{},i.concat(Array.prototype.slice.call(r||[],0)))),e[n].instance},Mithril}();