pipe
Call Signature
pipe<
TInitial
>(init
):TInitial
A pipeline is a solution that allows you to perform successive transforms of a value using functions. This is useful when building up a transaction message.
Until the pipeline operator becomes part of JavaScript you can use this utility to create pipelines.
Following common implementations of pipe functions that use TypeScript, this function supports a maximum arity of 10 for type safety.
Note you can use nested pipes to extend this limitation, like so:
Type Parameters
Type Parameter |
---|
TInitial |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
Returns
TInitial
The initial value
See
- https://github.com/ramda/ramda/blob/master/source/pipe.js
- https://github.com/darky/rocket-pipes/blob/master/index.ts
Examples
Call Signature
pipe<
TInitial
,R1
>(init
,init_r1
):R1
Type Parameters
Type Parameter |
---|
TInitial |
R1 |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
init_r1 | (init ) => R1 | The function with which to transform the initial value |
Returns
R1
The return value of the final transform function
Call Signature
pipe<
TInitial
,R1
,R2
>(init
,init_r1
,r1_r2
):R2
Type Parameters
Type Parameter |
---|
TInitial |
R1 |
R2 |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
init_r1 | (init ) => R1 | The function with which to transform the initial value |
r1_r2 | (r1 ) => R2 | The function with which to transform the return value of the prior function |
Returns
R2
The return value of the final transform function
Call Signature
pipe<
TInitial
,R1
,R2
,R3
>(init
,init_r1
,r1_r2
,r2_r3
):R3
Type Parameters
Type Parameter |
---|
TInitial |
R1 |
R2 |
R3 |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
init_r1 | (init ) => R1 | The function with which to transform the initial value |
r1_r2 | (r1 ) => R2 | The function with which to transform the return value of the prior function |
r2_r3 | (r2 ) => R3 | The function with which to transform the return value of the prior function |
Returns
R3
The return value of the final transform function
Call Signature
pipe<
TInitial
,R1
,R2
,R3
,R4
>(init
,init_r1
,r1_r2
,r2_r3
,r3_r4
):R4
Type Parameters
Type Parameter |
---|
TInitial |
R1 |
R2 |
R3 |
R4 |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
init_r1 | (init ) => R1 | The function with which to transform the initial value |
r1_r2 | (r1 ) => R2 | The function with which to transform the return value of the prior function |
r2_r3 | (r2 ) => R3 | The function with which to transform the return value of the prior function |
r3_r4 | (r3 ) => R4 | The function with which to transform the return value of the prior function |
Returns
R4
The return value of the final transform function
Call Signature
pipe<
TInitial
,R1
,R2
,R3
,R4
,R5
>(init
,init_r1
,r1_r2
,r2_r3
,r3_r4
,r4_r5
):R5
Type Parameters
Type Parameter |
---|
TInitial |
R1 |
R2 |
R3 |
R4 |
R5 |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
init_r1 | (init ) => R1 | The function with which to transform the initial value |
r1_r2 | (r1 ) => R2 | The function with which to transform the return value of the prior function |
r2_r3 | (r2 ) => R3 | The function with which to transform the return value of the prior function |
r3_r4 | (r3 ) => R4 | The function with which to transform the return value of the prior function |
r4_r5 | (r4 ) => R5 | The function with which to transform the return value of the prior function |
Returns
R5
The return value of the final transform function
Call Signature
pipe<
TInitial
,R1
,R2
,R3
,R4
,R5
,R6
>(init
,init_r1
,r1_r2
,r2_r3
,r3_r4
,r4_r5
,r5_r6
):R6
Type Parameters
Type Parameter |
---|
TInitial |
R1 |
R2 |
R3 |
R4 |
R5 |
R6 |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
init_r1 | (init ) => R1 | The function with which to transform the initial value |
r1_r2 | (r1 ) => R2 | The function with which to transform the return value of the prior function |
r2_r3 | (r2 ) => R3 | The function with which to transform the return value of the prior function |
r3_r4 | (r3 ) => R4 | The function with which to transform the return value of the prior function |
r4_r5 | (r4 ) => R5 | The function with which to transform the return value of the prior function |
r5_r6 | (r5 ) => R6 | The function with which to transform the return value of the prior function |
Returns
R6
The return value of the final transform function
Call Signature
pipe<
TInitial
,R1
,R2
,R3
,R4
,R5
,R6
,R7
>(init
,init_r1
,r1_r2
,r2_r3
,r3_r4
,r4_r5
,r5_r6
,r6_r7
):R7
Type Parameters
Type Parameter |
---|
TInitial |
R1 |
R2 |
R3 |
R4 |
R5 |
R6 |
R7 |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
init_r1 | (init ) => R1 | The function with which to transform the initial value |
r1_r2 | (r1 ) => R2 | The function with which to transform the return value of the prior function |
r2_r3 | (r2 ) => R3 | The function with which to transform the return value of the prior function |
r3_r4 | (r3 ) => R4 | The function with which to transform the return value of the prior function |
r4_r5 | (r4 ) => R5 | The function with which to transform the return value of the prior function |
r5_r6 | (r5 ) => R6 | The function with which to transform the return value of the prior function |
r6_r7 | (r6 ) => R7 | The function with which to transform the return value of the prior function |
Returns
R7
The return value of the final transform function
Call Signature
pipe<
TInitial
,R1
,R2
,R3
,R4
,R5
,R6
,R7
,R8
>(init
,init_r1
,r1_r2
,r2_r3
,r3_r4
,r4_r5
,r5_r6
,r6_r7
,r7_r8
):R8
Type Parameters
Type Parameter |
---|
TInitial |
R1 |
R2 |
R3 |
R4 |
R5 |
R6 |
R7 |
R8 |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
init_r1 | (init ) => R1 | The function with which to transform the initial value |
r1_r2 | (r1 ) => R2 | The function with which to transform the return value of the prior function |
r2_r3 | (r2 ) => R3 | The function with which to transform the return value of the prior function |
r3_r4 | (r3 ) => R4 | The function with which to transform the return value of the prior function |
r4_r5 | (r4 ) => R5 | The function with which to transform the return value of the prior function |
r5_r6 | (r5 ) => R6 | The function with which to transform the return value of the prior function |
r6_r7 | (r6 ) => R7 | The function with which to transform the return value of the prior function |
r7_r8 | (r7 ) => R8 | The function with which to transform the return value of the prior function |
Returns
R8
The return value of the final transform function
Call Signature
pipe<
TInitial
,R1
,R2
,R3
,R4
,R5
,R6
,R7
,R8
,R9
>(init
,init_r1
,r1_r2
,r2_r3
,r3_r4
,r4_r5
,r5_r6
,r6_r7
,r7_r8
,r8_r9
):R9
Type Parameters
Type Parameter |
---|
TInitial |
R1 |
R2 |
R3 |
R4 |
R5 |
R6 |
R7 |
R8 |
R9 |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
init_r1 | (init ) => R1 | The function with which to transform the initial value |
r1_r2 | (r1 ) => R2 | The function with which to transform the return value of the prior function |
r2_r3 | (r2 ) => R3 | The function with which to transform the return value of the prior function |
r3_r4 | (r3 ) => R4 | The function with which to transform the return value of the prior function |
r4_r5 | (r4 ) => R5 | The function with which to transform the return value of the prior function |
r5_r6 | (r5 ) => R6 | The function with which to transform the return value of the prior function |
r6_r7 | (r6 ) => R7 | The function with which to transform the return value of the prior function |
r7_r8 | (r7 ) => R8 | The function with which to transform the return value of the prior function |
r8_r9 | (r8 ) => R9 | The function with which to transform the return value of the prior function |
Returns
R9
The return value of the final transform function
Call Signature
pipe<
TInitial
,R1
,R2
,R3
,R4
,R5
,R6
,R7
,R8
,R9
,R10
>(init
,init_r1
,r1_r2
,r2_r3
,r3_r4
,r4_r5
,r5_r6
,r6_r7
,r7_r8
,r8_r9
,r9_r10
):R10
Type Parameters
Type Parameter |
---|
TInitial |
R1 |
R2 |
R3 |
R4 |
R5 |
R6 |
R7 |
R8 |
R9 |
R10 |
Parameters
Parameter | Type | Description |
---|---|---|
init | TInitial | The initial value |
init_r1 | (init ) => R1 | The function with which to transform the initial value |
r1_r2 | (r1 ) => R2 | The function with which to transform the return value of the prior function |
r2_r3 | (r2 ) => R3 | The function with which to transform the return value of the prior function |
r3_r4 | (r3 ) => R4 | The function with which to transform the return value of the prior function |
r4_r5 | (r4 ) => R5 | The function with which to transform the return value of the prior function |
r5_r6 | (r5 ) => R6 | The function with which to transform the return value of the prior function |
r6_r7 | (r6 ) => R7 | The function with which to transform the return value of the prior function |
r7_r8 | (r7 ) => R8 | The function with which to transform the return value of the prior function |
r8_r9 | (r8 ) => R9 | The function with which to transform the return value of the prior function |
r9_r10 | (r9 ) => R10 | The function with which to transform the return value of the prior function |
Returns
R10
The return value of the final transform function