1.0.0 • Published 2 years ago

tap-decorator v1.0.0

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
2 years ago

tap-decorator

tap-decorator is a TypeScript library that enables you to use a Tap decorator to observe any function without interfering. It is perfect for debugging, testing, and logging your code with ease.

usage

import { Tap } from "tap-decorator";

class Foo {
  @Tap((ob) =>
    ob.subscribe(({ seq, result }) => {
      console.log("seq", seq);

      result.subscribe((x) => {
        console.log("result", x);
      });
    })
  )
  public foo() {
    return 1;
  }
}

const foo = new Foo();
foo.foo();
foo.foo();
1.0.0

2 years ago