Add some.

This commit is contained in:
David Braun 2017-10-17 11:02:12 -04:00
parent 78d26ef021
commit ce97802a8e
3 changed files with 40 additions and 0 deletions

View file

@ -225,6 +225,20 @@ const Channel = function(bufferLength = 0) {
})();
return output;
},
some: async (callbackfn, thisArg) => {
for (;;) {
const value = await readOnly.shift();
if (value === undefined) {
return false;
} else {
if (callbackfn.call(thisArg, value)) {
return true;
}
}
}
}
});