Last active
February 9, 2019 07:23
-
-
Save cartant/85f1c103696cb087b330b0fd79e2c27f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { MonoTypeOperatorFunction, Observable } from "rxjs"; | |
| import { tap } from "rxjs/operators"; | |
| export function debug<T>(): MonoTypeOperatorFunction<T> { | |
| return source => new Observable<T>(subscriber => { | |
| let index = -1; | |
| return source.pipe( | |
| tap(t => console.log(`[${++index}]: ${t}`)) | |
| ).subscribe(subscriber); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment