@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
18 lines (17 loc) • 497 B
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
exports.filterAsync = filterAsync;
/*
Collects a AsyncIterable into an array with an optional filter predicate
*/
async function filterAsync(iterable, predicate) {
const results = [];
for await (const item of iterable) {
if (predicate && predicate(item)) {
results.push(item);
}
}
return results;
}