pragmatic-fp-ts
Version:
Opinionated functional programming library with easy use in mind
21 lines (20 loc) • 658 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.eqBy = void 0;
const main_1 = require("./main");
function eqBy(toComparable, a, b) {
if (arguments.length === 1) {
return function (_a, _b) {
return arguments.length === 1
? eqBy(toComparable, _a)
: eqBy(toComparable, _a, _b);
};
}
else if (arguments.length === 2) {
return (_b) => eqBy(toComparable, a, _b);
}
const valA = toComparable((0, main_1.getValue)(a));
const valB = toComparable((0, main_1.getValue)(b));
return (0, main_1.equals)(valA, valB);
}
exports.eqBy = eqBy;