export default class Pipe { constructor(private readonly value: V) {} map(mapper: (val: V, ...args: any[]) => R, ...args: any[]): Pipe { return new Pipe(mapper(this.value, ...args)); } async asyncMap( mapper: (val: V, ...args: any[]) => Promise, ...args: any[] ): Promise> { return new Pipe(await mapper(this.value, ...args)); } }