midware
Version:
Module for creating connect-style middlewares. Dependency-free. Runs in the browser and node.js
2 lines • 1.04 kB
JavaScript
(function(e,n){if(typeof define==="function"&&define.amd){define(["exports"],n)}else if(typeof exports==="object"){n(exports);if(typeof module==="object"&&module!==null){module.exports=exports=exports.midware}}else{n(e)}})(this,function(e){"use strict";function n(e){var n=f.stack=[];e=e||null;function f(){t(arguments).filter(function(e){return typeof e==="function"}).forEach(function(e){n.push(e)});return e}f.run=function r(){var f,r=t(arguments);if(typeof r[r.length-1]==="function"){f=r.pop()}if(!n.length){if(f)f.call(e);return}var i=n.slice();r.push(u);function o(){var n=i.shift();n.apply(e,r)}function u(n,t){if(n||t||!i.length){i=null;if(f)f.call(e,n,t)}else{o()}}o()};f.remove=function(e){for(var t=0,f=n.length;t<f;t+=1){var r=n[t];if(r===e||r.name===e){n.splice(t,1);break}}};f.flush=function(){n.splice(0)};return f}function t(e){var n=new Array(e.length);for(var t=0,f=n.length;t<f;t+=1){n[t]=e[t]}return n}n.VERSION="0.1.7";e.midware=n});
//# sourceMappingURL=http://cdn.rawgit.com/h2non/midware/0.1.7/midware.min.js.map