to-fun
Advanced Left-To-Right Function Composer
Better Function Composition
Don't Do This:
// NO! Pyramid of DOOM! Reversed Process Order!const foo = ;
Do This Instead!
// YES! Clear, Ordered Steps!const thingsToDo = doFirstThing doSecondThing doThirdThing doLastThing; // To Function!const doSomeThings = ; // And Done!const foo = ;
Or Even Skip the Explicit Array Declaration!
const doSomeThings = ; const foo = ;
Got An Async Process?
to-fun
understands promises!
const findUserByName = { return dbusers }; const activateUser = ...user activated: true; // To Function!const activateByName = ; // Invoke and catch errors like usual;
Got a Complex Multi-Stage Process?
to-fun
supports nested composition!
const access = readSession checkPermissions const sanitizeForm = sanitizeXss sanitizeSqlInject const validateForm = checkNonce validateCommentconst clean = sanitizeForm validateForm;// clearly-defined flow ;
Shut up and take my money!
Installation (npm):
npm install --save to-fun
For the import
-ers:
;
For the require
-ers:
var f = default;