Y
Hacker News
new
|
ask
|
show
|
jobs
by
cutler
3637 days ago
This killed it for me:
class Callback
.....
this.then = g => new Callback(callback =>
Can't we just keep OOP out of FP?
2 comments
homami
3637 days ago
Using class enables us to chain instances naturally in JS syntax, especially because JS lacks infix functions or custom operators. o1.then(f).then(g).run(cb)
link
BinaryIdiot
3636 days ago
You can avoid the class syntax here and write a function to return the same if you prefer.
link