| Total Complexity | 5 |
| Complexity/F | 1.25 |
| Lines of Code | 33 |
| Function Count | 4 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | export interface BoxConfig { |
||
| 2 | index: number; |
||
| 3 | bitValue: number; |
||
| 4 | ariaLabel: string; |
||
| 5 | } |
||
| 6 | |||
| 7 | export function calculateBitValue(index: number): number { |
||
| 8 | return Math.pow(2, 11 - index); |
||
| 9 | } |
||
| 10 | |||
| 11 | export function generateBoxAriaLabel(index: number, bitValue: number): string { |
||
| 12 | return `Bit ${index + 1}, value ${bitValue}`; |
||
| 13 | } |
||
| 14 | |||
| 15 | export function generateBoxConfigs(): BoxConfig[] { |
||
| 16 | const configs: BoxConfig[] = []; |
||
| 17 | |||
| 18 | for (let i = 0; i < 12; i++) { |
||
| 19 | const bitValue = calculateBitValue(i); |
||
| 20 | configs.push({ |
||
| 21 | index: i, |
||
| 22 | bitValue, |
||
| 23 | ariaLabel: generateBoxAriaLabel(i, bitValue), |
||
| 24 | }); |
||
| 25 | } |
||
| 26 | |||
| 27 | return configs; |
||
| 28 | } |
||
| 29 | |||
| 30 | export function getBoxCount(): number { |
||
| 31 | return 12; |
||
| 32 | } |
||
| 33 |