import { makeRe } from "minimatch";
import { isPlatformTokenCurrency } from "./helpers";
export function filterPlatformAccounts(accounts, filters) {
    const filterCurrencyRegexes = filters.currencies
        ? filters.currencies.map(filter => makeRe(filter))
        : null;
    return accounts.filter(account => {
        if (filterCurrencyRegexes &&
            !filterCurrencyRegexes.some(regex => account.currency.match(regex))) {
            return false;
        }
        return true;
    });
}
export function filterPlatformCurrencies(currencies, filters) {
    const filterCurrencyRegexes = filters.currencies
        ? filters.currencies.map(filter => makeRe(filter))
        : null;
    return currencies.filter(currency => {
        if (!filters.includeTokens && isPlatformTokenCurrency(currency)) {
            return false;
        }
        if (filterCurrencyRegexes && !filterCurrencyRegexes.some(regex => currency.id.match(regex))) {
            return false;
        }
        return true;
    });
}
//# sourceMappingURL=filters.js.map