2 ms·
I think one of the use cases is that it's easier to have a series of functions on immutable data compared to chaining classes. Considering JavaScript may get im
by Zababa 5y ago
I think one of the use cases is that it's easier to have a series of functions on immutable data compared to chaining classes. Considering JavaScript may get immutable data structures at some point, this would work well with them.
There is also the fact that JavaScript supports different types of programming, functional being one of them. Having a pipe operator helps you to make very clean and readable functional code.
Edit: the article also mentionned that methods can't be tree shaken. That's another improvement.
- graftak 5y agoTuples and records are proposed immutable data structures and currently in stage 2[1] (same as the pipe operator). [1] https://github.com/tc39/proposal-record-tuple https://github.com/tc39/proposal-record-tuple