tamda
Version:
Practical functional programming library for TypeScript
12 lines • 439 B
JavaScript
import { infer } from '../function/infer';
export function split() {
return inferred.apply(undefined, arguments);
}
const inferred = infer((array, predicate) => array.reduce((tuple, item, index) => {
const match = predicate(item, index, array);
const which = match ? tuple[0] : tuple[1];
// Faster than spreading, safe here
which.push(item);
return tuple;
}, [[], []]));
//# sourceMappingURL=split.js.map