(rows, limit = 6)
| 115 | } |
| 116 | |
| 117 | function toBarRows(rows, limit = 6) { |
| 118 | const subset = rows.slice(0, limit); |
| 119 | const max = subset.reduce((value, row) => Math.max(value, row.value), 0) || 1; |
| 120 | return subset.map((row) => ({ |
| 121 | label: row.label, |
| 122 | value: row.value, |
| 123 | width: Math.max(8, Math.round((row.value / max) * 100)) |
| 124 | })); |
| 125 | } |
| 126 | |
| 127 | function tokenRowsFromTotals(tokens) { |
| 128 | if (!tokens) { |
no outgoing calls
no test coverage detected