Browse Source

Remove pointless extra loop

new-api
Luke Childs 6 years ago
parent
commit
894ab525cd
  1. 13
      src/calculate-bias.js

13
src/calculate-bias.js

@ -18,17 +18,14 @@ const calculateBias = data => {
const currency = data.clusters.find(cluster => cluster.abbr === symbol);
if (currency) {
currencies.push(currency);
currencies.push({
symbol: currency.abbr,
name: currency.display,
influence: currency.score
});
}
}
// Format the currency objects
currencies = currencies.map(currency => ({
symbol: currency.abbr,
name: currency.display,
influence: currency.score
}));
// Derive bias from influence
const largestInfluence = Math.max(...currencies.map(currency => currency.influence));
currencies = currencies.map(currency => {

Loading…
Cancel
Save