metarhia/do

New syntax

tshemsedinov opened this issue · 0 comments

const chain = require('do');
const c1 = chain
  .do(readConfig, 'myConfig')
  .do(selectFromDb, 'select * from cities')
  .do(getHttpPage, 'http://kpi.ua')
  .do(readFile, 'README.md');

c1((err, data) => {});

Refs: metarhia/metasync#278

const chain = require('do');
const fs = require('fs');

const dc = chain.do(4); // collector

dc.pick('user', { name: 'Marcus Aurelius' });
fs.readFile('HISTORY.md',
  (err, data) => dc.collect('history', err, data)
);
dc.take('readme', fs.readFile, 'README.md');
setTimeout(() => dc.pick('timer', { date: new Date() }), 1000);