Skip to main content
Module

x/fae/compose.ts>compose

A functional module for Deno inspired from Ramda.
Latest
function compose
import { compose } from "https://deno.land/x/fae@v1.1.1/compose.ts";

Performs a right-to-left function composition. The last function may have any number of arguments; the remaining must have single argument. Note: The returned function is automatically curried

 const classyGreeting = (firstName, lastName) => "The name's " + lastName + ", " + firstName + " " + lastName
 const yellGreeting = Fae.compose((x: string) => x.toUpperCase(), classyGreeting);
 yellGreeting('James', 'Bond'); //=> "THE NAME'S BOND, JAMES BOND"

 Fae.compose(Math.abs, Fae.add(1), Fae.multiply(2))(-4) //=> 7

Parameters

this: any
...functions: Func[]