0.1.0 • Published 7 years ago

then-while v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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