abort-utils
abort-utils copied to clipboard
Add `abortAll(iterable)` and `abortAllAndClear(iterable)`
function abortAll(iterable) {
for (const controller of iterable) {
controller.abort();
}
}
function abortAllAndClear(iterable) {
abortAll(iterable);
if (Array.isArray(iterable)) {
iterable.length = 0;
} else {
iterable.clear();
}
}