"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sortAndFilter = exports.DEFAULT_SORT_BY = exports.sortByOptions = void 0;
exports.sortByOptions = ['apr', 'tvl', 'risk_reverse'];
exports.DEFAULT_SORT_BY = exports.sortByOptions[2];
function sortAndFilter(all, sortBy, chain) {
    var results = all;
    if (chain)
        results = results.filter(function (x) { return x.chain === chain; });
    return results.sort(function (a, b) { return (a[sortBy] > b[sortBy] ? 1 : -1); });
}
exports.sortAndFilter = sortAndFilter;
//# sourceMappingURL=sortAndFilter.js.map