2 ms·
Not really... F#-style pipeline syntax would be a bit more explicit about it, assuming you could use % for a variable name... Object.keys(envars) |>
by tracker1 4y ago
Not really... F#-style pipeline syntax would be a bit more explicit about it, assuming you could use % for a variable name...
Object.keys(envars)
|> % => %.map(envar => `${envar}=${envars[envar]}`)
|> % => %.join(' ')
|> % => `$ ${%}`
|> % => chalk.dim(%, 'node', args.join(' '))
|> % => console.log(%);
To be honest, I've pretty much given up the hopes that TC39 would actually resolve pipelines and decorators at this point... I think it's been around a decade now.
- jameshart 4y agoBut then why would you call all those different variables ‘%’? Reading this version though I also notice something else that the F# style enables that the Hack style doesn’t which is that it supports destructuring. So in F# style, I can more easily make pipe steps that pass on multiple values in a structured object or array, then access them easily down-pipe.
- tracker1 4y agoUnfortunately F# pipelines have been rejected a few times by TC39 to advance... I used it for a while via Babel/6to5, but I gave up (like with decorators) after many years of no advancement. I doubt I'll see either any time soon.