Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1 KB

max.md

File metadata and controls

34 lines (25 loc) · 1 KB
id mainCompare lesson compare title learnAbout learnBackAbout layout class image preview_image preview_image_alt
max
reduce
26
reduce
max
How the RxJS "max" operator works under the hood (scan, reduce)
count
reduce
default
post
max/scanreducemax.gif
max/content_preview.jpg
scan, reduce, max

This is how a ❚ max operator would operate with an input stream:

  • When the input stream completes, the output stream:
    • emits the largest value emitted on the input stream
    • and immediately completes

Some reactive stream libraries (eg. RxJS) provide this ❚ max operator, while others don't. How would you code max yourself?

Comparer function

In RxJS, ❚ min and ❚ max accept on optional comparer function as an argument.

For example:

{:.w400}

See also

{:.w300}
Pipeable operators - Build your own with RxJS!