juxt

v3.0.3
Creates a function that calls multiple functions with the same arguments.
juxtaposition juxtaposition function call multiple functions with same arguments

juxt (juxtaposition)

Creates a function that calls multiple functions with the same arguments.

Takes several functions and returns a function that applies its arguments to each of those functions. An array of the results is returned.

Installation

yarn add juxt or npm i juxt


Usage

juxt (fn<function>, fn<function>...)

  • returns {array}
import juxt from 'juxt'


const incr = val => val + 1
const decr = val => val - 1


const juxtaposedCount = juxt(incr, decr)
juxtaposedCount(0)
// [1, -1]
npm i juxt

Metadata

  • MIT
  • Whatever
  • Jared Lunde
  • released 8/20/2018

Downloads

Maintainers