Function: compose()
Returns a function that takes a single parameter and pipes it through the given functions.
Example
import { compose, map, reduce, toArray } from 'lfi'
const screamify = compose(
map(word => word.toUpperCase()),
reduce(toArray()),
// Also works with non-`lfi` functions!
array => array.sort(),
)
console.log(screamify([`sloth`, `lazy`, `sleep`]))
//=> [ 'SLOTH', 'LAZY', 'SLEEP' ]
Since
v0.0.2
Call Signature
compose(): <
Value
>(value
) =>Value
Returns
Function
Type Parameters
• Value
Parameters
value
Value
Returns
Value
Defined in
Call Signature
compose<
A
,B
>(fn
): (value
) =>B
Type Parameters
• A
• B
Parameters
fn
(a
) => B
Returns
Function
Parameters
value
A
Returns
B
Defined in
Call Signature
compose<
A
,B
,C
>(fn1
,fn2
): (value
) =>C
Type Parameters
• A
• B
• C
Parameters
fn1
(a
) => B
fn2
(b
) => C
Returns
Function
Parameters
value
A
Returns
C
Defined in
Call Signature
compose<
A
,B
,C
,D
>(fn1
,fn2
,fn3
): (value
) =>D
Type Parameters
• A
• B
• C
• D
Parameters
fn1
(a
) => B
fn2
(b
) => C
fn3
(c
) => D
Returns
Function
Parameters
value
A
Returns
D
Defined in
Call Signature
compose<
A
,B
,C
,D
,E
>(fn1
,fn2
,fn3
,fn4
): (value
) =>E
Type Parameters
• A
• B
• C
• D
• E
Parameters
fn1
(a
) => B
fn2
(b
) => C
fn3
(c
) => D
fn4
(d
) => E
Returns
Function
Parameters
value
A
Returns
E
Defined in
Call Signature
compose<
A
,B
,C
,D
,E
,F
>(fn1
,fn2
,fn3
,fn4
,fn5
): (value
) =>F
Type Parameters
• A
• B
• C
• D
• E
• F
Parameters
fn1
(a
) => B
fn2
(b
) => C
fn3
(c
) => D
fn4
(d
) => E
fn5
(e
) => F
Returns
Function
Parameters
value
A
Returns
F
Defined in
Call Signature
compose<
A
,B
,C
,D
,E
,F
,G
>(fn1
,fn2
,fn3
,fn4
,fn5
,fn6
): (value
) =>G
Type Parameters
• A
• B
• C
• D
• E
• F
• G
Parameters
fn1
(a
) => B
fn2
(b
) => C
fn3
(c
) => D
fn4
(d
) => E
fn5
(e
) => F
fn6
(f
) => G
Returns
Function
Parameters
value
A
Returns
G
Defined in
Call Signature
compose<
A
,B
,C
,D
,E
,F
,G
,H
>(fn1
,fn2
,fn3
,fn4
,fn5
,fn6
,fn7
): (value
) =>H
Type Parameters
• A
• B
• C
• D
• E
• F
• G
• H
Parameters
fn1
(a
) => B
fn2
(b
) => C
fn3
(c
) => D
fn4
(d
) => E
fn5
(e
) => F
fn6
(f
) => G
fn7
(g
) => H
Returns
Function
Parameters
value
A
Returns
H
Defined in
Call Signature
compose<
A
,B
,C
,D
,E
,F
,G
,H
,I
>(fn1
,fn2
,fn3
,fn4
,fn5
,fn6
,fn7
,fn8
): (value
) =>I
Type Parameters
• A
• B
• C
• D
• E
• F
• G
• H
• I
Parameters
fn1
(a
) => B
fn2
(b
) => C
fn3
(c
) => D
fn4
(d
) => E
fn5
(e
) => F
fn6
(f
) => G
fn7
(g
) => H
fn8
(h
) => I
Returns
Function
Parameters
value
A
Returns
I
Defined in
Call Signature
compose<
A
,B
,C
,D
,E
,F
,G
,H
,I
,J
>(fn1
,fn2
,fn3
,fn4
,fn5
,fn6
,fn7
,fn8
,fn9
): (value
) =>J
Type Parameters
• A
• B
• C
• D
• E
• F
• G
• H
• I
• J
Parameters
fn1
(a
) => B
fn2
(b
) => C
fn3
(c
) => D
fn4
(d
) => E
fn5
(e
) => F
fn6
(f
) => G
fn7
(g
) => H
fn8
(h
) => I
fn9
(i
) => J
Returns
Function
Parameters
value
A
Returns
J