tamda
Version:
Practical functional programming library for TypeScript
10 lines • 361 B
JavaScript
import { infer } from '../function/infer';
import { not } from '../logic/not';
export function takeWhile() {
return inferred.apply(undefined, arguments);
}
const inferred = infer((array, whileFn) => {
const index = array.findIndex(not(whileFn));
return index === -1 ? array : array.slice(0, index);
});
//# sourceMappingURL=takeWhile.js.map