A bare bones implementation of Promises/A intended to pass all promise-tests while being as small as possible.

This is intended to serve as a base for you to build your own promises libraries, which would typically be expected to provide all sorts of useful helpers. Promises created by this library (or any library based off of this) should be compatable with such helpers, but helpers won't ever be included in this library.

You can call then with tow optional args. The callback is called when the promise is fulfilled, the errback is called when the promise is rejected. Then also returns a fresh promise which is set to the result of the callback or errback. If you want to forward a rejection either make errback null, or re-throw the error in errback.

If you return a promise from callback or errback it will be resolved before being set as the result of the promise.