1.2.0 • Public • Published


Functional programming has a number of common, idiomatic operations: maps, folds, currying and so on. There are a number of excellent JavaScript libraries which provide access to these fundamentals in a more-or-less functional style. Ojay's core extensions, Oliver Steele's Functional and Jeremy Ashkenas' Underscore are all good examples.

Udon is cast in a similar mould to the above. It aims to provide basic support for functional programming in JavaScript, initially by porting some elements of Haskell's Data.List library.

Installing Udon

Udon is available from npm, so if you want to use Udon with Node you can just run the following command to globally install the library.

npm install -g udon

Then it's just a matter of requiring it in your Node project. The module exported by the library is just the top-level Udon object.

var Udon = require('udon');

Udon.sum([1, 2, 3, 4]); // -> 10

Otherwise, you can grab pre-built versions from the Udon website or build it yourself as described below.

Building the library

If you've checked out the Git repository and want to build a minified version of the library from source, you will need Ruby, Rubygems and the Jake gem, which you can get by running (with sudo if you like)

gem install jake

from the command line. Then just cd into your Udon directory and run


which will build the library in the /pkg directory.

Deploying with Helium

Udon includes a jake.yml file for use with the Jake build tool, as explained above. This also means that it is easily deployed with Helium, a Git-backed JavaScript package server. It should also fit into any other build or deploy system based on JS.Packages.

Running the test suite

The Udon test suite is written with the JS.Test testing framework. The test suite runs on several JavaScript platforms, including Node and all modern web browsers.

To run the test suite from the command line, run the following command (replacing node with Rhino, V8 etc. where relevant).

node test/console.js

To run the test suite in a browser, open the test/browser.html file in a web browser.

Building the Udon website

The website is built with Hakyll, a static site generator written in Haskell. To build it you will need GHC and cabal-install; the simplest way to get hold of these is to install the Haskell Platform. You'll also need to install the hakyll package from Hackage:

cabal install hakyll

Then, to build the site, just run this from your Udon directory:

ghc --make -Wall site/site




Package Sidebar


npm i udon

Weekly Downloads






Last publish


  • beastaugh