Skip to content

xdash API Reference v0.5.14


xdash API Reference / Chain

Class: Chain<I, O> ​

Defined in: src/chain.ts:7

Chain class to be used in a pipeline.

Example ​

ts
chain(5).pipe(add, 5).pipe(multiply, 2).unwrap() // returns 20

Type Parameters ​

I ​

I

O ​

O

Constructors ​

Constructor ​

new Chain<I, O>(initialValue, ops): Chain<I, O>

Defined in: src/chain.ts:8

Parameters ​

initialValue ​

I

ops ​

(value) => any[] = []

Returns ​

Chain<I, O>

Methods ​

pipe() ​

Call Signature ​

pipe<P, Q, R, S, T, U, V, W, X, Y, Z>(op1, op2, op3, op4, op5, op6, op7, op8, op9, op10, op11): Chain<I, Z>

Defined in: src/chain.ts:15

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Q ​

Q

R ​

R

S ​

S

T ​

T

U ​

U

V ​

V

W ​

W

X ​

X

Y ​

Y

Z ​

Z

Parameters ​
op1 ​

(value) => P

op2 ​

(value) => Q

op3 ​

(value) => R

op4 ​

(value) => S

op5 ​

(value) => T

op6 ​

(value) => U

op7 ​

(value) => V

op8 ​

(value) => W

op9 ​

(value) => X

op10 ​

(value) => Y

op11 ​

(value) => Z

Returns ​

Chain<I, Z>

a new chain with the result of the operations

Call Signature ​

pipe<P, Q, R, S, T, U, V, W, X, Y>(op1, op2, op3, op4, op5, op6, op7, op8, op9, op10): Chain<I, Y>

Defined in: src/chain.ts:16

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Q ​

Q

R ​

R

S ​

S

T ​

T

U ​

U

V ​

V

W ​

W

X ​

X

Y ​

Y

Parameters ​
op1 ​

(value) => P

op2 ​

(value) => Q

op3 ​

(value) => R

op4 ​

(value) => S

op5 ​

(value) => T

op6 ​

(value) => U

op7 ​

(value) => V

op8 ​

(value) => W

op9 ​

(value) => X

op10 ​

(value) => Y

Returns ​

Chain<I, Y>

a new chain with the result of the operations

Call Signature ​

pipe<P, Q, R, S, T, U, V, W, X>(op1, op2, op3, op4, op5, op6, op7, op8, op9): Chain<I, X>

Defined in: src/chain.ts:17

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Q ​

Q

R ​

R

S ​

S

T ​

T

U ​

U

V ​

V

W ​

W

X ​

X

Parameters ​
op1 ​

(value) => P

op2 ​

(value) => Q

op3 ​

(value) => R

op4 ​

(value) => S

op5 ​

(value) => T

op6 ​

(value) => U

op7 ​

(value) => V

op8 ​

(value) => W

op9 ​

(value) => X

Returns ​

Chain<I, X>

a new chain with the result of the operations

Call Signature ​

pipe<P, Q, R, S, T, U, V, W>(op1, op2, op3, op4, op5, op6, op7, op8): Chain<I, W>

Defined in: src/chain.ts:18

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Q ​

Q

R ​

R

S ​

S

T ​

T

U ​

U

V ​

V

W ​

W

Parameters ​
op1 ​

(value) => P

op2 ​

(value) => Q

op3 ​

(value) => R

op4 ​

(value) => S

op5 ​

(value) => T

op6 ​

(value) => U

op7 ​

(value) => V

op8 ​

(value) => W

Returns ​

Chain<I, W>

a new chain with the result of the operations

Call Signature ​

pipe<P, Q, R, S, T, U, V>(op1, op2, op3, op4, op5, op6, op7): Chain<I, V>

Defined in: src/chain.ts:19

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Q ​

Q

R ​

R

S ​

S

T ​

T

U ​

U

V ​

V

Parameters ​
op1 ​

(value) => P

op2 ​

(value) => Q

op3 ​

(value) => R

op4 ​

(value) => S

op5 ​

(value) => T

op6 ​

(value) => U

op7 ​

(value) => V

Returns ​

Chain<I, V>

a new chain with the result of the operations

Call Signature ​

pipe<P, Q, R, S, T, U>(op1, op2, op3, op4, op5, op6): Chain<I, U>

Defined in: src/chain.ts:20

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Q ​

Q

R ​

R

S ​

S

T ​

T

U ​

U

Parameters ​
op1 ​

(value) => P

op2 ​

(value) => Q

op3 ​

(value) => R

op4 ​

(value) => S

op5 ​

(value) => T

op6 ​

(value) => U

Returns ​

Chain<I, U>

a new chain with the result of the operations

Call Signature ​

pipe<P, Q, R, S, T>(op1, op2, op3, op4, op5): Chain<I, T>

Defined in: src/chain.ts:21

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Q ​

Q

R ​

R

S ​

S

T ​

T

Parameters ​
op1 ​

(value) => P

op2 ​

(value) => Q

op3 ​

(value) => R

op4 ​

(value) => S

op5 ​

(value) => T

Returns ​

Chain<I, T>

a new chain with the result of the operations

Call Signature ​

pipe<P, Q, R, S>(op1, op2, op3, op4): Chain<I, S>

Defined in: src/chain.ts:22

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Q ​

Q

R ​

R

S ​

S

Parameters ​
op1 ​

(value) => P

op2 ​

(value) => Q

op3 ​

(value) => R

op4 ​

(value) => S

Returns ​

Chain<I, S>

a new chain with the result of the operations

Call Signature ​

pipe<P, Q, R>(op1, op2, op3): Chain<I, R>

Defined in: src/chain.ts:23

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Q ​

Q

R ​

R

Parameters ​
op1 ​

(value) => P

op2 ​

(value) => Q

op3 ​

(value) => R

Returns ​

Chain<I, R>

a new chain with the result of the operations

Call Signature ​

pipe<P, Q>(op1, op2): Chain<I, Q>

Defined in: src/chain.ts:24

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Q ​

Q

Parameters ​
op1 ​

(value) => P

op2 ​

(value) => Q

Returns ​

Chain<I, Q>

a new chain with the result of the operations

Call Signature ​

pipe<P>(op1): Chain<I, P>

Defined in: src/chain.ts:25

Pipes a value through a series of functions.

Type Parameters ​
P ​

P

Parameters ​
op1 ​

(value) => P

Returns ​

Chain<I, P>

a new chain with the result of the operations


unwrap() ​

unwrap(): O

Defined in: src/chain.ts:37

Executes the pipeline and returns the final value.

Returns ​

O

The final value after all operations have been applied.

Released under the MIT License.