Skip to content

Instantly share code, notes, and snippets.

View omkar-joshi's full-sized avatar
💭
Done is the engine of more!

Omkar Joshi omkar-joshi

💭
Done is the engine of more!
View GitHub Profile
@darrenscerri
darrenscerri / Middleware.js
Last active July 11, 2023 02:59
A very minimal Javascript (ES5 & ES6) Middleware Pattern Implementation
var Middleware = function() {};
Middleware.prototype.use = function(fn) {
var self = this;
this.go = (function(stack) {
return function(next) {
stack.call(self, function() {
fn.call(self, next.bind(self));
});