Skip to content

computationalabstraction/Vachan

Repository files navigation

License: MIT npm version Actions Status Maintainability Coverage: 99% JavaScript Style Guide

Promises/A+ logo Fantasy Land logo

Static Land logo

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.

Example Usage

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));

Installation

Algebraic version not published yet

Node

npm i vachan

Browser

<script src="https://unpkg.com/vachan"></script>

Browser Optimized (gzipped)

<script src="https://unpkg.com/vachan/dist/browser/vachan.dist.min.js.gz"></script>

Further Usage

Complete reference has been given on the official documentation website link given below -

Fantasy Land and Static Land

Vachan implements the following algebraic structures -

About

A lightweight algebraic cross-platform Promises/A+ spec compliant promise library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published