This operator lets you execute arbitrary functions; it is really useful for debugging purposes, as you can log the data and have a better understanding of the workflow of your observable.
It has the following signature:
It receives only one parameter and it is mandatory:
- execute: It is the function to be executed by this observable, it receives the value propagated by the observable as a parameter
An example usage of this operator can be seen in the following code:
Rx.Observable .of('Joe DiMaggio','Friedrich Nietzsche','Nayara Neves','Marco Antonio') .map((name)=>name.split(' ')) .do((data)=>console.log('[DEBUG] Data after map operator: '+data)) .filter((name)=>name.indexOf('N')===0) ...