JSPM

futurize-p

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q31601F
  • License CC0-1.0

Turns a function that returns a promise into a function that returns a future.

Package Exports

  • futurize-p

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (futurize-p) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

futurize-p

Turns a function that returns a promise into a function that returns a future.

install

npm install futurize-p

example

const {Future} = require('ramda-fantasy')
const futurize = require('futurize-p')(Future) // pass in an implementation of Future

const incrementLater = (ms, n) => new Promise((resolve, reject) => {
  setTimeout(() => {
    resolve(n + 1)
  }, ms)
})

const futureIncrement = futurize(incrementLater)
futureIncrement(500, 7).fork(
  console.error,
  console.log //=> 8
)