3 ms·
I use ppipe: https://github.com/egeozcan/ppipe https://github.com/egeozcan/ppipe Looks tidier to my eyes const newPipe = ppipe.extend({ divide (x, y
by patates 3y ago
I use ppipe: https://github.com/egeozcan/ppipe https://github.com/egeozcan/ppipe
Looks tidier to my eyes
const newPipe = ppipe.extend({
divide (x, y) {
return x / y;
},
log(...params) {
console.log(...params);
return params[params.length - 1];
}
});
const res = await newPipe(10)
.pipe(x => x + 1)
.divide(_, 11)
.log("here is our x: ") //logs "here is our x: 1"
.pipe(x => x + 1) // 2
- corbezzoli 3y agoBut then you have to define each method in advance, it doesn’t look like the pipeline operator at all, but more like the old jQuery.fn.method shenanigans.
- patates 3y agoThat's not the case at all, have a look at the docs. The thing is pretty powerful.