@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
17 lines • 663 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.sortAccountsByFiatValue = void 0;
/**
* Sorts accounts by their fiat value in descending order
* @param accounts - List of accounts with fiat values to sort
* @returns Sorted list of accounts by fiat value balance in descending order
*/
function sortAccountsByFiatValue(accounts) {
return [...accounts].sort((a, b) => {
const fiatValueA = a.fiatValue ?? 0;
const fiatValueB = b.fiatValue ?? 0;
return fiatValueB - fiatValueA;
});
}
exports.sortAccountsByFiatValue = sortAccountsByFiatValue;
//# sourceMappingURL=sortAccountsByFiatValue.js.map