Skip to content

Instantly share code, notes, and snippets.

@cartant
Last active February 9, 2019 07:24
Show Gist options
  • Select an option

  • Save cartant/78d47d52e4ca53038a755eb48152712f to your computer and use it in GitHub Desktop.

Select an option

Save cartant/78d47d52e4ca53038a755eb48152712f to your computer and use it in GitHub Desktop.
import { defer, MonoTypeOperatorFunction } from "rxjs";
import { tap } from "rxjs/operators";
export function debug<T>(): MonoTypeOperatorFunction<T> {
return source => defer(() => {
let index = -1;
return source.pipe(
tap(t => console.log(`[${++index}]: ${t}`))
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment