0.5.0 • Published 3 years ago
just-futures v0.5.0
About
That simple library allows you to work with 'Futures': map, combine and compose them
Installation
npm i --save just-futures
Examples
const future = Future.incompleted<number>(); // also you can use new Future<number>();
future.map(num => num * 10 / 2).then(console.log); // 5
future.map(num => `Number: ${num}`).then(console.log); // Number: 5
future.complete(1);
const future = Future.ofPromise(...)
.map(value => ...)
.compose(value => Future.ofPromise(...))
.combine(Future.ofPromise(...), (x, y) => ...)
.then(console.log);