0.4.1 • Published 3 years ago

promise-stuff v0.4.1

Weekly downloads
15
License
MIT
Repository
github
Last release
3 years ago

Promise-stuff

Because promises can use a lot more stuff!

npm

API

promise-stuff is an awesome little library that adds extra functionality to your promises. It can be installed on any promise implementation or used as a set of static functions.

Using promise-stuff

There are a few ways of using the functions offerred by promise stuff.

As operators

Here is an example:

import {Operators} from 'promise-stuff'
let p = new Promise(...);
let result = Operators.lastly(p, x => {
	//cleanup
});

These operators return a promise of exactly the same type as the original.

Create a new, derived promise

Create a new promise constructor from an existing one, like a native Promise or a different implementation.

import {PromiseStuff} from 'promise-stuff';
export MyExtendedPromise = PromiseStuff.deriveNew(Promise);
let newPromise = new MyExtendedPromise(...); //promise constructor
newPromise.lastly(x => {
	//cleanup
});

Install on an existing promise

import {PromiseStuff} from 'promise-stuff';
PromiseStuff.extendExisting(Promise);
let pr = new Promise(...);
pr.lastly(x => {
	//cleanup
});

Examples

Promise-stuff-es6

npm

This is a small package designed to integrate promsise-stuff into the native ES6 promise by doing:

PromiseStuff.extendExisting(Promise);
0.4.1

3 years ago

0.4.0

3 years ago

0.3.6

5 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.7-beta

6 years ago

0.1.6-beta

6 years ago

0.1.5-beta

6 years ago

0.1.4-beta

6 years ago

0.1.3-beta

6 years ago

0.1.2-beta

6 years ago

0.1.1-beta

6 years ago

0.1.0-beta

6 years ago