1.2.1 • Published 7 years ago

better-promise v1.2.1

Weekly downloads
17
License
MIT
Repository
github
Last release
7 years ago

BetterPromise

Forcing a minimum timeout on a Promise like the spec requires is needless and wasteful. BetterPromise allows synchronous resolutions to keep things moving quickly. In addition, BetterPromise will throw an error for any uncaught rejections, much like the Node.js Promise.

Try it out in your browser.

Install

npm install better-promise

API

Reference the BetterPromise class by require-ing it.

const Promise = require('better-promise');

BetterPromise has the same API as the native Promise class with the addition of a few static helper methods.

BetterPromise.defer() => Deferred

Returns a deferred object with promise, resolve, and reject properties.

BetterPromise.isPromise(obj) => Boolean

Recevies any value and returns whether or not that value looks like a Promise.

BetterPromise.promisify(fn[, context]) => Function

Receives a function and an optional context and returns a function that returns the given function wrapped in a BetterPromise.

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago