Skip to content

Commit

Permalink
Polish: use a default for name in Type.prototype.pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Nov 9, 2018
1 parent 486d2cb commit 2b4a4dd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ export class Type<A, O = A, I = mixed> implements Decoder<I, A>, Encoder<A, O> {
readonly encode: Encode<A, O>
) {}

pipe<B, IB, A extends IB, OB extends A>(this: Type<A, O, I>, ab: Type<B, OB, IB>, name?: string): Type<B, O, I> {
pipe<B, IB, A extends IB, OB extends A>(
this: Type<A, O, I>,
ab: Type<B, OB, IB>,
name: string = `pipe(${this.name}, ${ab.name})`
): Type<B, O, I> {
return new Type(
name || `pipe(${this.name}, ${ab.name})`,
name,
ab.is,
(i, c) => {
const validation = this.validate(i, c)
Expand Down

0 comments on commit 2b4a4dd

Please sign in to comment.