Skip to content

Commit

Permalink
[readme] add another userland implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 26, 2024
1 parent 62e1b94 commit a3e3fd7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 16,7 @@ If I want `f` to be run on the same tick - since, after all, it might be synchro
Using `Promise.try(f)`, I can get the same semantics as the `new Promise` mess above, nicely mirroring `async function`, and allowing optimistically synchronous, but safe, execution of a function, and being able to work with a Promise afterwards. Yay!

Userland implementations
- [`p-try` package](https://www.npmjs.com/package/p-try) (44M weekly downloads, [8.9B total downloads](https://npm-stat.com/charts.html?package=p-try&from=2011-01-01))
- Bluebird: [`Promise.try`/`Promise.attempt`](http://bluebirdjs.com/docs/api/promise.try.html) - takes one function, calls it with no args.
- Q: [`Q.try`/`Promise.prototype.fcall`](https://github.com/kriskowal/q/wiki/API-Reference#promisefcallargs) - `Q.try` takes one function, calls it with no args. `Promise#fcall` is deprecated, but takes a list of arguments, and invokes the given function with that list of arguments.
- when: [`when.try`/`when.attempt`](https://github.com/cujojs/when/blob/master/docs/api.md#whentry) - takes one function, and an optional list of arguments, and invokes the given function with that list of arguments.
Expand Down

0 comments on commit a3e3fd7

Please sign in to comment.