fix repeated currencies
This commit is contained in:
parent
685a11cbfc
commit
6add7424de
2 changed files with 11 additions and 7 deletions
|
|
@ -111,18 +111,24 @@ RateService.prototype.fromFiat = function(amount, code) {
|
|||
return amount / this.getRate(code) * this.BTC_TO_SAT;
|
||||
};
|
||||
|
||||
RateService.prototype.listAlternatives = function() {
|
||||
RateService.prototype.listAlternatives = function(sort) {
|
||||
var self = this;
|
||||
if (!this.isAvailable()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return self.lodash.map(this.getAlternatives(), function(item) {
|
||||
var alternatives = self.lodash.map(this.getAlternatives(), function(item) {
|
||||
return {
|
||||
name: item.name,
|
||||
isoCode: item.isoCode
|
||||
}
|
||||
});
|
||||
if (sort) {
|
||||
alternatives.sort(function(a, b) {
|
||||
return a.name.toLowerCase() > b.name.toLowerCase() ? 1 : -1;
|
||||
});
|
||||
}
|
||||
return self.lodash.uniq(alternatives, 'isoCode');
|
||||
};
|
||||
|
||||
angular.module('copayApp.services').factory('rateService', function($http, lodash) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue