fantasy-promises

0.1.0 • Public • Published

Fantasy Promises

This library implements purely functional, monadic promises.

Promise(fork)

Promise is a constructor which takes a fork function. The fork function takes one argument:

fork(resolve)

The resolve callback gets called on a value.

Promise.of(x)

Creates a Promise that contains a successful value.

chain(f)

Returns a new promise that evaluates f when the current promise is successfully fulfilled. f must return a new promise.

map(f)

Returns a new promise that evaluates f on a value and passes it through to the resolve function.

extract()

Executes a promise to get a value.

extend(f)

Returns a new promise that evaluates f over the promise to get a value.

Fantasy Land Compatible

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    12
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    12
  • 0.0.1
    0

Package Sidebar

Install

npm i fantasy-promises

Weekly Downloads

12

Version

0.1.0

License

MIT

Last publish

Collaborators

  • puffnfresh
  • trevorbasinger