Function: pipe()
Composes functions left-to-right.
Example
import {pipe} from "@longlast/pipe";
// Function definitions omitted for brevity. See `pipe/spec/test.ts` for a
// working example.
const capitalize = pipe(
split(""),
mapAt(0, toUpperCase),
join(""),
);
const pascalCase = pipe(
split(/\W+/),
map(capitalize),
join(""),
);
pascalCase("chunky-bacon"); // => "ChunkyBacon"
Limitations
The types for pipe only support composing up to ten functions at a time.
Call Signature
pipe<
A,B,C,D,E,F,G,H,I,J,K>(f: (a:A) =>B,g: (b:B) =>C,h: (c:C) =>D,i: (d:D) =>E,j: (e:E) =>F,k: (f:F) =>G,l: (g:G) =>H,m: (h:H) =>I,n: (i:I) =>J,o: (j:J) =>K):Piped<A,K>
Defined in: pkg/pipe/src/index.ts:12
Type Parameters
| Type Parameter |
|---|
A |
B |
C |
D |
E |
F |
G |
H |
I |
J |
K |
Parameters
| Parameter | Type |
|---|---|
f |
(a: A) => B |
g |
(b: B) => C |
h |
(c: C) => D |
i |
(d: D) => E |
j |
(e: E) => F |
k |
(f: F) => G |
l |
(g: G) => H |
m |
(h: H) => I |
n |
(i: I) => J |
o |
(j: J) => K |
Returns
Piped<A, K>
Call Signature
pipe<
A,B,C,D,E,F,G,H,I,J>(f: (a:A) =>B,g: (b:B) =>C,h: (c:C) =>D,i: (d:D) =>E,j: (e:E) =>F,k: (f:F) =>G,l: (g:G) =>H,m: (h:H) =>I,n: (i:I) =>J):Piped<A,J>
Defined in: pkg/pipe/src/index.ts:25
Type Parameters
| Type Parameter |
|---|
A |
B |
C |
D |
E |
F |
G |
H |
I |
J |
Parameters
| Parameter | Type |
|---|---|
f |
(a: A) => B |
g |
(b: B) => C |
h |
(c: C) => D |
i |
(d: D) => E |
j |
(e: E) => F |
k |
(f: F) => G |
l |
(g: G) => H |
m |
(h: H) => I |
n |
(i: I) => J |
Returns
Piped<A, J>
Call Signature
pipe<
A,B,C,D,E,F,G,H,I>(f: (a:A) =>B,g: (b:B) =>C,h: (c:C) =>D,i: (d:D) =>E,j: (e:E) =>F,k: (f:F) =>G,l: (g:G) =>H,m: (h:H) =>I):Piped<A,I>
Defined in: pkg/pipe/src/index.ts:37
Type Parameters
| Type Parameter |
|---|
A |
B |
C |
D |
E |
F |
G |
H |
I |
Parameters
| Parameter | Type |
|---|---|
f |
(a: A) => B |
g |
(b: B) => C |
h |
(c: C) => D |
i |
(d: D) => E |
j |
(e: E) => F |
k |
(f: F) => G |
l |
(g: G) => H |
m |
(h: H) => I |
Returns
Piped<A, I>
Call Signature
pipe<
A,B,C,D,E,F,G,H>(f: (a:A) =>B,g: (b:B) =>C,h: (c:C) =>D,i: (d:D) =>E,j: (e:E) =>F,k: (f:F) =>G,l: (g:G) =>H):Piped<A,H>
Defined in: pkg/pipe/src/index.ts:48
Type Parameters
| Type Parameter |
|---|
A |
B |
C |
D |
E |
F |
G |
H |
Parameters
| Parameter | Type |
|---|---|
f |
(a: A) => B |
g |
(b: B) => C |
h |
(c: C) => D |
i |
(d: D) => E |
j |
(e: E) => F |
k |
(f: F) => G |
l |
(g: G) => H |
Returns
Piped<A, H>
Call Signature
pipe<
A,B,C,D,E,F,G>(f: (a:A) =>B,g: (b:B) =>C,h: (c:C) =>D,i: (d:D) =>E,j: (e:E) =>F,k: (f:F) =>G):Piped<A,G>
Defined in: pkg/pipe/src/index.ts:58
Type Parameters
| Type Parameter |
|---|
A |
B |
C |
D |
E |
F |
G |
Parameters
| Parameter | Type |
|---|---|
f |
(a: A) => B |
g |
(b: B) => C |
h |
(c: C) => D |
i |
(d: D) => E |
j |
(e: E) => F |
k |
(f: F) => G |
Returns
Piped<A, G>
Call Signature
pipe<
A,B,C,D,E,F>(f: (a:A) =>B,g: (b:B) =>C,h: (c:C) =>D,i: (d:D) =>E,j: (e:E) =>F):Piped<A,F>
Defined in: pkg/pipe/src/index.ts:67
Type Parameters
| Type Parameter |
|---|
A |
B |
C |
D |
E |
F |
Parameters
| Parameter | Type |
|---|---|
f |
(a: A) => B |
g |
(b: B) => C |
h |
(c: C) => D |
i |
(d: D) => E |
j |
(e: E) => F |
Returns
Piped<A, F>
Call Signature
pipe<
A,B,C,D,E>(f: (a:A) =>B,g: (b:B) =>C,h: (c:C) =>D,i: (d:D) =>E):Piped<A,E>
Defined in: pkg/pipe/src/index.ts:75
Type Parameters
| Type Parameter |
|---|
A |
B |
C |
D |
E |
Parameters
| Parameter | Type |
|---|---|
f |
(a: A) => B |
g |
(b: B) => C |
h |
(c: C) => D |
i |
(d: D) => E |
Returns
Piped<A, E>
Call Signature
pipe<
A,B,C,D>(f: (a:A) =>B,g: (b:B) =>C,h: (c:C) =>D):Piped<A,D>
Defined in: pkg/pipe/src/index.ts:82
Type Parameters
| Type Parameter |
|---|
A |
B |
C |
D |
Parameters
| Parameter | Type |
|---|---|
f |
(a: A) => B |
g |
(b: B) => C |
h |
(c: C) => D |
Returns
Piped<A, D>
Call Signature
pipe<
A,B,C>(f: (a:A) =>B,g: (b:B) =>C):Piped<A,C>
Defined in: pkg/pipe/src/index.ts:88
Type Parameters
| Type Parameter |
|---|
A |
B |
C |
Parameters
| Parameter | Type |
|---|---|
f |
(a: A) => B |
g |
(b: B) => C |
Returns
Piped<A, C>