pragmatic-fp-ts
Version:
Opinionated functional programming library with easy use in mind
13 lines (12 loc) • 396 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.all = void 0;
const main_1 = require("./main");
function all(pred, coll) {
if (arguments.length === 1) {
return (_coll) => all(pred, _coll);
}
const values = (0, main_1.getValueOr)([], coll);
return values.reduce((result, nextVal) => result && pred(nextVal), true);
}
exports.all = all;