Add some
.
This commit is contained in:
parent
78d26ef021
commit
ce97802a8e
3 changed files with 40 additions and 0 deletions
14
lib/index.js
14
lib/index.js
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue