A lightweight (3.5kB) cross-platform Promises/A+ spec and Fantasy Land compliant promise library. Vachan works both on the Browser and Node.js. Vachan provides extra features over the standard promise implementation
such as monitoring the complete internal chaining and rechaining of promises, queuing of callbacks and execution of callbacks, mode of execution, other utilitarian features and also gives you polyfills for ESNext functions - any
and allSettled
. Vachan also implements multiple algebras or algebraic structures, their operations and laws from the Fantasy Land specification (aka Algebraic JavaScript Specification) for increasing interoperability across other similarly adhereing libraries and frameworks and also getting verifiability for some properties and thier structural and semantic validity for the defined abstraction in a mathematical way. This project was partly a fruition of exploring promises from the perspective of an implementor and also in an effort to create a core ecosystem of libraries, constructs and utilities which can be reused across domains. Static Land compliance is a work in progess.
const { P } = require("vachan");
let a = [];
for(let i = 0;i < 10;i++)
{
a.push(
P.resolve(i*10)
.delay(.1*i)
);
}
P.all(a)
.then(vals => console.log(vals));
Algebraic version not published yet
npm i vachan
<script src="https://unpkg.com/vachan"></script>
<script src="https://unpkg.com/vachan/dist/browser/vachan.dist.min.js.gz"></script>
Complete reference has been given on the official documentation website link given below -
Vachan implements the following algebraic structures -