Skip to content

Correia-jpv/fucking-awesome-promises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Promises/A+ logo

Awesome Promises Awesome

A curated list of useful resources for JavaScript Promises

Inspired by the 304043⭐  26877🍴 awesome) list thing. Not to be confused with other awesome promises like "I promise you a million dollars" or "I promise you'll stay fit and never have to go to the gym again".

Table of Contents

Resources, Blogs, and Books

For beginners

Deep Dive

References

Promises/A+ Implementations (ES6/ES2015 compatible)

Strict Implementations

These implement no more or less than the es6 spec. They make great polyfills and are exceptionally compatible with native promises.

  •    137⭐     19🍴 pinkie) - Ponyfill. Node-oriented, but  14539⭐   1187🍴 browserifyable). Extremely small implementation.
  •    725⭐     78🍴 native-promise-only) - Polyfill. Browser and node-compatible.
  •   7298⭐    593🍴 es6-promise) - Opt-in polyfill. A strict-spec subset of rsvp.js.
  •    746⭐     67🍴 lie) - Small, browserifyable with an opt-in polyfill.

Implementations with extras

All of these provide more features than the language yet remain compatible. Node + Browsers for all.

  •  20430⭐   2334🍴 bluebird) - Fully featured, extremely performant. Long stack traces & generator/coroutine support.
  •    273⭐     20🍴 creed) - Hyper performant & full featured like Bluebird, but FP-oriented. Coroutines, generators, promises, ES2015 iterables, & fantasy-land spec.
  •      ?⭐      ?🍴 rsvp.js) - Lightweight with a few extras. Compatible down to IE6!
  •  14952⭐   1202🍴 Q) - One of the original implementations. Long stack traces and other goodies.
  •   2561⭐    309🍴 then/promise) - Small with nodeify, denodify and done() additions.
  •   3436⭐    395🍴 when.js) - Packed with control flow, functional, and utility methods.

Fallbacks

  • 🌎 native-or-bluebird - Helps transition to completely native.
  •    119⭐     17🍴 pinkie-promise) - Use native, or fall back to pinkie. Great for node library authors.
  •    179⭐     18🍴 any-promise) - Loads the first available implementation. Safe for browserify.

Convenience Utilities

Native and strictly spec-compliant promises are awesome for compatibility, future-proofness, library authors, and browsers. However, libraries like bluebird patch goodies onto the Promise constructor and prototype. Solution? tiny modules of course!

sindresorhus's many Promise utilities (  4609⭐    126🍴 see notes))

  •    605⭐     43🍴 delay) - Delay a promise a specified amount of time.
  •   1503⭐     67🍴 pify) - Promisify ("denodify") a callback-style function.
  •    281⭐     24🍴 loud-rejection) - Make unhandled promise rejections fail loudly instead of the default silent fail.
  •    106⭐      8🍴 hard-rejection) - Make unhandled promise rejections fail hard right away instead of the default silent fail
  •   3281⭐    175🍴 p-queue) - Promise queue with concurrency control
  •     21⭐      5🍴 p-break) - Break out of a promise chain
  •    263⭐     10🍴 p-lazy) - Create a lazy promise that defers execution until .then() or .catch() is called
  •     66⭐      8🍴 p-defer) - Create a deferred promise
  •     58⭐      6🍴 p-if) - Conditional promise chains
  •    131⭐      9🍴 p-tap) - Tap into a promise chain without affecting its value or state
  •   1232⭐     56🍴 p-map) - Map over promises concurrently
  •    301⭐     13🍴 p-all) - Run promise-returning & async functions concurrently with optional limited concurrency
  •   1734⭐     95🍴 p-limit) - Run multiple promise-returning & async functions with limited concurrency
  •     36⭐      5🍴 p-times) - Run promise-returning & async functions a specific number of times concurrently
  •     37⭐      5🍴 p-catch-if) - Conditional promise catch handler
  •     68⭐      5🍴 p-time) - Measure the time a promise takes to resolve
  •     24⭐      4🍴 p-log) - Log the value/error of a promise
  •     70⭐      8🍴 p-filter) - Filter promises concurrently
  •     89⭐     11🍴 p-settle) - Settle promises concurrently and get their fulfillment value or rejection reason
  •    373⭐     32🍴 p-memoize) - Memoize promise-returning & async functions
  •     51⭐      8🍴 p-whilst) - Calls a function repeatedly while a condition returns true and then resolves the promise
  •    394⭐     28🍴 p-throttle) - Throttle promise-returning & async functions
  •    197⭐     23🍴 p-debounce) - Debounce promise-returning & async functions
  •    757⭐     58🍴 p-retry) - Retry a promise-returning or async function
  •    150⭐     19🍴 p-wait-for) - Wait for a condition to be true
  •    262⭐     29🍴 p-timeout) - Timeout a promise after a specified amount of time
  •     45⭐      5🍴 p-race) - A better Promise.race()
  •     52⭐     12🍴 p-try) - Promise#try() ponyfill - Starts a promise chain
  •     45⭐      8🍴 p-finally) - Promise#finally() ponyfill - Invoked when the promise is settled regardless of outcome
  •     54⭐      7🍴 p-any) - Wait for any promise to be fulfilled
  •     34⭐      8🍴 p-some) - Wait for a specified number of promises to be fulfilled
  •    118⭐     16🍴 p-pipe) - Compose promise-returning & async functions into a reusable pipeline
  •     48⭐      7🍴 p-each-series) - Iterate over promises serially
  •     46⭐      4🍴 p-map-series) - Map over promises serially
  •     66⭐      7🍴 p-reduce) - Reduce a list of values using promises into a promise for a value
  •    188⭐     25🍴 p-props) - Like Promise.all() but for Map and Object

Others

  •      2⭐      0🍴 promise-method) - Standalone bluebird.method. Turn a synchronously-returning method into a promise-returning one.
  •    281⭐     32🍴 is-promise) - Determine if something looks like a Promise.
  •     14⭐      0🍴 sprom) - Resolve when a stream ends. Optional buffering (be careful with this!)
  •   1631⭐     72🍴 task.js) - Write async functions in a blocking style using promises and generators. Like bluebird.coroutine.
  •  11873⭐    794🍴 co) - Like task.js and bluebird.coroutine, but supports thunks too.
  • 🌎 lie-fs - Promise wrappers for Node's FS API.
  •      1⭐      0🍴 promise-do-until) - Calls a function repeatedly until a condition returns true and then resolves the promise.
  •      3⭐      1🍴 promise-do-whilst) - Calls a function repeatedly while a condition returns true and then resolves the promise.
  •     29⭐     10🍴 promise-semaphore) - Push a set of work to be done in a configurable serial fashion
  •      2⭐      0🍴 promise-nodeify) - Standalone nodeify method which calls a Node-style callback on resolution or rejection.

License

Licensed under the 🌎 Creative Commons CC0 License.

Source

  1596⭐    132🍴 wbinnssmith/awesome-promises)