4 ms·
Its all a problem of formatting, for me this is simple to read. const { status } = await send( capitalize(greeting) + "!" ) But i would
by progx 3y ago
Its all a problem of formatting, for me this is simple to read.
const { status } = await
send(
capitalize(greeting)
+ "!"
)
But i would not concat things in a method call, bad style.
const message = capitalize(greeting) + "!"
const { status } = await send(message)
The example from the page is a little bit too simple.
With complex operations a pipe-method would make more sense.
But i will wait for the native pipeline-operator <https://github.com/tc39/proposal-pipeline-operator https://github.com/tc39/proposal-pipeline-operator> instead using now a function.
- richeyryan 3y agoI think the use of template strings simplifies it, even inline: const { status } = await send(`${capitalize(greeting)}!`) console.log(status) It does reduce the number of discrete operations to make the pipe example look more impressive, though.
- progx 3y agoBut you have to look at the whole string and check if send has a further parameter. With `send(msg)` you see it without taking extra time of reading. And let the compiler optimize your code, that is the job of a compiler. Write your code for humans.