then-while

0.1.0 • Public • Published

then-while

Call an (a)sync function until an (a)sync predicate returns false.

Example

const thenWhile = require('then-while')

const predicate = value => Promise.resolve(value < 0.5)
const performStep = message => Promise.resolve(`${(Math.random())}`)

const generateNumber = createThenWhile(predicate, performStep)

generateNumber('some arguments')
  .then(randomNumber => console.log('random number:', randomNumber))

Install

yarn add then-while

Versions

Current Tags

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

Version History

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

Package Sidebar

Install

npm i then-while

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • sebinsua