Simple and lightweight functional toolset inspired by Clojure using
import
.
Getting Started
Use import
to bring in the necessary functions into your module. In the following example we're going to import
the partial
function and utilise it!
; const addNumbers = a + b;const addTwo = ; ;
Releases
📦
v0.1.x
identity(a)
trace(a)
curry(fn)
partial(fn, ...a)
compose(...fns)
composeDeferred(...fns)
Examples
Below are a set of examples for using Funkel
– although it's not an exhaustive list, and you should refer to the source and/or associated unit-tests if you need further information about what Funkel
provides and how it functions.
trace
If you have a compose
d function but are having troubles, it's useful to console.log
the current value at any given step, for these cases use trace
in the compose
function:
const pay = ;
Promise-Safe Composing
For cases where you have functions that return promises, you can use the composeDeferred
function.
; const addOne = ;const addTwo = a + 2;const addThree = ; const composedFn = ; ;