Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
functional utilities for javascript and node
tree: 767cf2a80e

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

FJS: Functional Utils For Javascript

Functional Utilties for Javascript


Allows you to easily curry functions. This means that if you call the curried version of a function with fewer arguments that it requires, it returns a function to call with the remaining arguments. The function short-circuits if you call it with the correct number of arguments, meaning that it doesn't affect performance unless it has to.


The syntax looks best in coffeescript, because you can just prefix a function definition with curry.

curry = require('fjs').curry

# just wrap your function in curry() and it will do the rest
add = curry (a, b) -> a + b
add2 = add(2)

assert.equal add(2,3), 5
assert.equal add2(3), 5
assert.equal add(2)(3), 5

assert.deepEqual [1,2,3].map(add(2)), [3,4,5]
Something went wrong with that request. Please try again.