3

According to the documentation in event-stream, seems like the difference of this two method is sync or async. But I'm still not sure what the difference really means.

MorrisLiang
  • 702
  • 2
  • 7
  • 20

1 Answers1

4

Well, the difference is basically something completely different:

While the through stream only re-emits, the map stream also is able to modify the data. The first one simply emits what it gets, the data is sent 1:1 to the subscriber. The last one has an additional transformation step, so the data may be 1:1, but does not need to be.

In other words, the through stream is a kind of identity, while the map is a kind of mapping.

Golo Roden
  • 140,679
  • 96
  • 298
  • 425
  • 1
    But if I change the data in es.through with `that.emit('data', 'foo')` is then map and though the same? – Pylinux Jul 31 '15 at 11:53