ocurry.js
Curry named-argument functions
Usage
// Function that takes an object of argument-propertiesvar { return argsprotocol + ' ' + argsmethod + ' ' + argshost + argspath;}; var http = ; ;// -> throws an error var fromLocalhost = ; ;// -> throws an error fromLocalhostcurried// -> { protocol: 'HTTP', host: 'localhost' } fromLocalhostrequired// -> [ 'method', 'path' ] var getFromLocalhost = ; getFromLocalhostcurried// -> { protocol: 'HTTP', host: 'localhost', method: 'GET' } getFromLocalhostrequired;// -> [ 'path' ] ;// -> throws an error ;// -> returns 'HTTP GET localhost/some/resource'
Documentation
Comments to the source are Docco-compatible. To generate an annotated source listing for browsing:
npm --global install doccodocco --output docs ocurry.js
License
See LICENSE.md.