Hmm, a fluent interface does lend itself to OO and OO lends itself to classes, but could be implemented with a plain object too. Not saying this would necessarily be perfect for your use case, but it could be done.
const fluent = { fn1: () => { console.log(1); return fluent }, fn2: () => { console.log(2); return fluent }, } fluent.fn1().fn2()
I'm actually implementing it now with a module design pattern. So basically, it's a function... that looks a heckuva lot like a class.
github.com/bytebodger/allow/blob/m...
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hmm, a fluent interface does lend itself to OO and OO lends itself to classes, but could be implemented with a plain object too. Not saying this would necessarily be perfect for your use case, but it could be done.
I'm actually implementing it now with a module design pattern. So basically, it's a function... that looks a heckuva lot like a class.
github.com/bytebodger/allow/blob/m...