Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zbraniecki/syncpromise

Sync drop in replacement for Promises
https://github.com/zbraniecki/syncpromise

Last synced: 3 months ago
JSON representation

Sync drop in replacement for Promises

Awesome Lists containing this project

README

        

# SyncPromise

SyncPromise is an incomplete implementation of Promise API. SyncPromise executes your Promise based code synchronously.

## Why

Because sometimes you need to test your Promise based code in a sync scenario.

## Features

* Small
* ES6 based
* With tests
* Most of new Promise()
* Most of Promise.prototype.then
* Most of Promise.resolve
* Most of Promise.reject
* Most of Promise.all

### Restrictions

Can't handle Promise.prototype.catch for obvious reasons.

## Differences from ECMAScript promises

* Throws when SyncPromise callback ends without resolving the promise
* Throws when attempting to resolve an already resolved promise
* No Promise.prototype.catch
* No Promise.prototype.race (we accept patches!)
* Some other things probably missing...