loose-ts-check
Version:
Run TS type-check and ignore certain errors in some files
14 lines (13 loc) • 440 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.partition = void 0;
const partition = (arr, predicate) => {
const matchingItems = [];
const nonMatchingItems = [];
arr.forEach((item) => {
const arrayToAppend = predicate(item) ? matchingItems : nonMatchingItems;
arrayToAppend.push(item);
});
return [matchingItems, nonMatchingItems];
};
exports.partition = partition;