1.0.4 • Published 8 years ago
currying.js v1.0.4
Reduce code nesting by currying
var fs = require('fs')
var currying = require('currying.js');
/*
the f , which is the last arguments of the functions
refers to the next function
*/
var f1 = (f)=>{
fs.readFile('package.json',f)
};
var f2 = (err,data,f)=>{
console.log(data.toString());
fs.readFile('package.json',f);
};
var f3 = (err,data)=>{
console.log(data.toString());
}
currying(f1,f2,f3)();