Last active
February 17, 2016 00:46
-
-
Save voltrevo/09a2af01510ceab8287a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function(condition, loop, result) { | |
return Promise.resolve((function run() { | |
if (!condition()) { | |
return result(); | |
} | |
return loop().then(run); | |
})()); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment