Skip to content

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

Notifications You must be signed in to change notification settings

sebinsua/then-while

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

then-while

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

By default the behaviour is that of a do while loop.

Example

const createThenWhile = 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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published