bli-neder
v0.4.1
Published
A jewish implementation of Promise in TypeScript
Downloads
7
Readme
BliNeder
A jewish implementation of Promise in TypeScript.
Installation
Install the package from npm using your favorite package manager:
npm i bli-neder
Usage
Import the package in your code, and use it as you would use a regular Promise:
import { BliNeder } from 'bli-neder';
// Basic usage:
new BliNeder((resolve, reject) => {
resolve('Success!');
});
// Static methods:
const resolvedNeder = BliNeder.resolve('Success!');
const rejectedNeder = BliNeder.reject('Error!');
const allNeders = BliNeder.all([resolvedNeder, rejectedNeder]);
const allSettledNeders = BliNeder.allSettled([resolvedNeder, rejectedNeder]);
const racedNeders = BliNeder.race([resolvedNeder, rejectedNeder]);
const anyNeders = BliNeder.any([resolvedNeder, rejectedNeder]);
// Chaining:
BliNeder.reject('Error!')
.then((value) => {
return 'Success!';
})
.catch((error) => {
return 'Error!';
})
.finally(() => {
return 'Finally!';
});
Available Nethods
BliNeder.prototype.then(onFulfilled, onRejected)
- SeePromise.prototype.then
BliNeder.prototype.catch(onRejected)
- SeePromise.prototype.catch
BliNeder.prototype.finally(onFinally)
- SeePromise.prototype.finally
BliNeder.resolve(value)
- SeePromise.resolve
BliNeder.reject(reason)
- SeePromise.reject
BliNeder.all(promises)
- SeePromise.all
BliNeder.allSettled(promises)
- SeePromise.allSettled
BliNeder.race(promises)
- SeePromise.race
BliNeder.any(promises)
- SeePromise.any