Is there an implementation where ‘then’ is added to Object.prototype as:
function(f, ...preargs) { return f(...preargs, this) }
And then you can use it to pipeline sync and async things together? It’s still kinda bad and seems pretty crazy though. Some obvious issues are:- the preargs thing presumably doesn’t work for promises so you’d need to use bind.
- there’s no great way to specify ‘the function which is property foo of the object being operated on’ to e.g. map an array that is in a promise you can’t write .then(.map, …). But I think this is also a problem with other pipe implementations.