Skip to content

juxt

juxt<A, B, C>(fns): (a) => [B, C]

Defined in: Composition/juxt.ts:14

Applies an input to an array of functions and collects the results into a tuple.

A

B

C

[(a) => B, (a) => C]

(a): [B, C]

A

[B, C]

const nameParts = juxt([
  (name: string) => name.split(" ")[0],
  (name: string) => name.split(" ").slice(1).join(" "),
]);

nameParts("Alice Smith"); // ["Alice", "Smith"]

juxt<A, B, C, D>(fns): (a) => [B, C, D]

Defined in: Composition/juxt.ts:15

Applies an input to an array of functions and collects the results into a tuple.

A

B

C

D

[(a) => B, (a) => C, (a) => D]

(a): [B, C, D]

A

[B, C, D]

const nameParts = juxt([
  (name: string) => name.split(" ")[0],
  (name: string) => name.split(" ").slice(1).join(" "),
]);

nameParts("Alice Smith"); // ["Alice", "Smith"]

juxt<A, B, C, D, E>(fns): (a) => [B, C, D, E]

Defined in: Composition/juxt.ts:18

Applies an input to an array of functions and collects the results into a tuple.

A

B

C

D

E

[(a) => B, (a) => C, (a) => D, (a) => E]

(a): [B, C, D, E]

A

[B, C, D, E]

const nameParts = juxt([
  (name: string) => name.split(" ")[0],
  (name: string) => name.split(" ").slice(1).join(" "),
]);

nameParts("Alice Smith"); // ["Alice", "Smith"]

juxt<A, B>(fns): (a) => B[]

Defined in: Composition/juxt.ts:21

Applies an input to an array of functions and collects the results into a tuple.

A

B

readonly (a) => B[]

(a): B[]

A

B[]

const nameParts = juxt([
  (name: string) => name.split(" ")[0],
  (name: string) => name.split(" ").slice(1).join(" "),
]);

nameParts("Alice Smith"); // ["Alice", "Smith"]