Skip to content

Commit

Permalink
fix(coinmarket): fix logic that returns only topX coins
Browse files Browse the repository at this point in the history
  • Loading branch information
benmarten committed Jan 6, 2018
1 parent 666e305 commit 860ac07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/model/Coinmarket.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ export default class Coinmarket {
static getCoins(limit) {
let result = {}
for (let key in coins) {
result[key] = new Coin(coins[key].symbol, 0, null, coins[key].rank)
if (result[key].rank === limit) {
break
let coin = coins[key]
if (!limit || parseInt(coin.rank) <= limit) {
result[key] = new Coin(coin.symbol, 0, null, coin.rank)
}
}
return result
Expand Down

0 comments on commit 860ac07

Please sign in to comment.