@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
17 lines • 636 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.filterPlatformAccounts = filterPlatformAccounts;
const minimatch_1 = require("minimatch");
function filterPlatformAccounts(accounts, filters) {
const filterCurrencyRegexes = filters.currencies
? filters.currencies.map(filter => (0, minimatch_1.makeRe)(filter))
: null;
return accounts.filter(account => {
if (filterCurrencyRegexes &&
!filterCurrencyRegexes.some(regex => account.currency.match(regex))) {
return false;
}
return true;
});
}
//# sourceMappingURL=filters.js.map