Last active
October 26, 2017 09:50
-
-
Save alersenkevich/37c6081ed32617d2cfe5adf8b11fe62d to your computer and use it in GitHub Desktop.
applyMiddleware function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dummy = ws => ws | |
export const applyMiddlewareForWebSocket = (ws, ...fnList) => { | |
let tmp = ws | |
fnList.forEach((fn, index) => { | |
tmp = fn(tmp, fnList[index + 1] || dummy) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment