Pointfree forking
Futures
const Task = require('data.task');
const fork = require('fork-future');
const timeout = (msg, time) => new Task((reject, resolve) => setTimeout(() => resolve(msg), time));
const forkAndLog = fork(onRejected, (result) => {
console.log('RESULT', result);
});
forkAndLog(timeout('POINTFREE', 3000));
fork(onRejected)(onResolved)(future)
const forkToPromise = require('fork-future').forkToPromise;
// Fork, then continue using a promise chain.
forkToPromise(future).then(...)
// Use async/await (if supported in your environment).
await forkToPromise(future)
MIT © stoeffel