Reading the pipeline proposal in javascript I found this snippet:
value.one().two().three()
And I wondered if there's a way to implement something like this.
Let's say it should work like this:
one().two().three() // "1-2-3"
two().one().three() // "2-1-3"
two().two().two().one() // "2-2-2-1"
The only thing close to this I was able to implement was this:
const one = () => ({ two: () => ({ three: () => "1-2-3" }) });
one().two().three() // 1-2-3
But this is obviously not a flexible solution to the problem.