ironcorelabs / futurejs Goto Github PK
View Code? Open in Web Editor NEWPromise-alternative library for doing asynchronous operations
License: MIT License
Promise-alternative library for doing asynchronous operations
License: MIT License
GitHub is reporting a high severity vulnerability CVE2019-10747 in set-value
.
By default, our Future library exists errors to be Error
instances. In a number of places we use our own custom error type, so we should allow users to define this custom error type as part of the Future constructor.
I love this library!
I was wondering if y'all were open to an API addition to support Objects with Future.all(<array>)
?
Similar to the .all()
function in my FP library: https://www.fpromises.io/#fp-all
Thanks @madison-kerndt for kindly sharing this with me!
yarn.lock update suggested: handlebars ~> 4.0.14.
yarn.lock update suggested: js-yaml ~> 3.13.1.
This is pretty edge case and strange behavior. This was discovered while using the library where the Future in question changed test state. When an assertion in the .engage
on that future failed, it caused the handleWith
code of the already engaged Future to be called again, which cause the map to be called again, which then blew up because the state had already changed. I pushed a minimal reproduction of the bug on the branch handle-called-out-of-scope
.
test("does not get run if engages above this scope throw", (done) => {
let mapCalledTimes = 0;
let handleWithCalledTimes = 0;
const action = Future.of(33)
.handleWith((e) => {
console.log(`failed an infallible future: ${e}`);
handleWithCalledTimes++;
return Future.of(-1);
})
.map((r) => {
mapCalledTimes++;
return r;
});
try {
action.engage(
(e) => {
throw e;
},
(r) => {
throw new Error(`oh no, something went wrong after the future has run to completion on ${r}`);
}
);
} catch (e) {
expect(handleWithCalledTimes).toBe(0);
expect(mapCalledTimes).toBe(1);
done();
}
});
That's the test entirely though. The error thrown in the .engage
causes the whole chain of the Future the engage
was called on to run when it's somehow caught by the handleWith
. The same thing happens if you start with a rejected Future, though then everything in the chain is run twice including the handleWith
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.