Added definition and test for when.unfold

This commit is contained in:
Michael Nahkies
2015-10-23 14:49:02 +13:00
parent b70895565d
commit 2af0f2eaf4
2 changed files with 25 additions and 0 deletions
+8
View File
@@ -116,6 +116,14 @@ when.iterate(function (x) {
console.log(err);
});
when.unfold(function (x) {
return [{foo: 'bar'}, x + 1];
}, function (x) {
return x < 10;
}, function (y) {
delete y.foo;
}, 0);
/* when.promise(resolver) */
promise = when.promise<number>(resolve => resolve(5));