Skip to content

Instantly share code, notes, and snippets.

@voltrevo
Last active February 17, 2016 00:46
Show Gist options
  • Save voltrevo/09a2af01510ceab8287a to your computer and use it in GitHub Desktop.
Save voltrevo/09a2af01510ceab8287a to your computer and use it in GitHub Desktop.
'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