| 3 | 3 | // convenience to get you started writing code faster. |
| 4 | 4 | // |
| 5 | 5 | |
| 6 | export const transform = () => { | |
| 7 | throw new Error('Remove this line and implement the function'); | |
| 6 | export const transform = (old) => { | |
| 7 | const result = {}; | |
| 8 | ||
| 9 | // Iterate through each score in the old format | |
| 10 | for (const [score, letters] of Object.entries(old)) { | |
| 11 | // Convert score to number | |
| 12 | const pointValue = parseInt(score, 10); | |
| 13 | ||
| 14 | // Iterate through each letter for this score | |
| 15 | for (const letter of letters) { | |
| 16 | // Convert letter to lowercase and assign the score | |
| 17 | result[letter.toLowerCase()] = pointValue; | |
| 18 | } | |
| 19 | } | |
| 20 | ||
| 21 | return result; | |
| 8 | 22 | }; |