async and flexible currying for js
Naan.js is a library that provides a set of useful functions for creating partially applied functions. It was originally created to work with node.js but also works in the browser, so long as you have also included the async module.
The best way to understand what naan does is to see it in action:
var statFoo = naancurryfsstat 'foo.txt';statFoo// stat result from foo;var renameToFoo = naanpositionCurryfsrename fsrename 'foo.txt' 1;renameToFoo'bar.txt'// 'bar.txt' has been renamed to 'foo.txt'var readFooContents = naancurryfsreadFile 'foo.txt';var writeFooContents = naancookfswriteFile readFooContents 1;writeFooContents'bar.txt'// The contents of 'foo.txt' has been written to 'bar.txt'// Naan works great with Async!var readers = 'foo.txt' 'bar.txt' 'bob.txt'mapreturn naancurryfsreadFile;asyncparallelreaders// contents == contents of foo.txt, bar.txt & bob.txt;
These are a few of the basic uses of Naan. Each of the available functions are listed below.
For node, just use npm:
npm install naan
Tested in IE9+. It currently uses some ES5 stuff which doesn't work in IE8, but this will be fixed shortly.
For info on how to test in the browser, see testing.
Development: naan.js - 9.5kb Uncompressed
Production: naan.min.js - 3.0kb Minified