Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

skava / chain-able-deps   js

Repository URL to install this package:

Version: 6.0.4 

/ src / loop / fantasy / juxt.ts

import { fromArgumentsToArray as argumentor } from '../../cast/fromArgumentsToArray'
import converge from './converge'

/**
 * juxt applies a list of functions to a list of values.
 * @since 5.0.0-beta.7
 * @memberOf loop
 * @curried 1
 *
 * @param fns An array of functions
 * @return A function that returns a list of values after applying each of the original `fns` to its parameters.
 *
 * @func
 * @fork v0.19.0
 * @category Function
 * @sig [(a, b, ..., m) -> n] -> ((a, b, ..., m) -> [n])
 * @symb R.juxt([f, g, h])(a, b) = [f(a, b), g(a, b), h(a, b)]
 * @see R.applySpec
 *
 * @example
 *
 *      var getRange = juxt([Math.min, Math.max]);
 *      getRange(3, 4, 9, -3); //=> [-3, 9]
 *
 */
export default function juxt(fns: Function[]) {
  return converge(argumentor, fns)
}