I played with several different ways of chaining a feature set and didn't seem to find what I particularly like. The following is the last one I settled on, but I'm still not addicted to it.
Can someone suggest a cleaner and more concise template? I do not want to choose Async.js or the library.
[ this.connectDatabase.bind(this), this.connectServer.bind(this), this.listen.bind(this) ].reduce( (chain, fn) => { let p = new Promise(fn); chain.then(p); return p; }, Promise.resolve() );
Ps. Any other tips are more than welcome.
source share