Very good point. In my examples I'm not naming the stream variable, but that is definitely also a good source for code clarity/self commenting code.
Also I agree that only having one function in the pipe chain is probably overkill, but really wanted to drive the point home.
To expand on this idea just a bit, you can still make a function more flexible in this case (multiplyBy10 is a bit rigid) by using a factory function:
function multiplyBy(amount: number) { return (numberFromStream: number) => amount * numberFromStream; } interval(500).pipe( map(multiplyBy(10)) )
Thanks for providing a bit of an alternative!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Very good point. In my examples I'm not naming the stream variable, but that is definitely also a good source for code clarity/self commenting code.
Also I agree that only having one function in the pipe chain is probably overkill, but really wanted to drive the point home.
To expand on this idea just a bit, you can still make a function more flexible in this case (multiplyBy10 is a bit rigid) by using a factory function:
Thanks for providing a bit of an alternative!