An implementation of Rubys #tap
for TypeScript
Use on any object:
import { tap } from "rtap";
const user: User = tap(new User(), (u: User) => {
u.name = "Foo";
});
Added as a mixin to a class:
import { tappify } from "rtap";
const User = tappify(BaseUser);
const user = new User().tap((u: User) => {
u.name = "Foo";
})