Skip to content

Create mentoring.md #2309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions tracks/typescript/exercises/etl/etl/mentoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Mentoring

## ETL

### Problem asks
Restructure grouped letters by point values into individual mappings.
Transform the old format (point-value groups)
into a new format (letter-score pairs) in TypeScript.
Associate lowercase letters with their corresponding point values,
transitioning from grouped data to individual letter scoring.

## Reasonable Solution

The code snippet provided in TypeScript represents a function named transform.
This function takes in an object oldData, which has keys representing point values (as strings)
and values as arrays of strings (letters associated with those point values).

The function iterates through the oldData object,
assigning each letter (converted to lowercase) to
its corresponding score in the newData object.
The return value of the function is an object where keys are
lowercase letters and values are the associated point values (as numbers).

```typescript
export function transform(oldData: { [key: string]: string[] }): { [key: string]: number } {
const newData: { [key: string]: number } = {};

for (const [score, letters] of Object.entries(oldData)) {
letters.forEach((letter: string) => {
newData[letter.toLowerCase()] = parseInt(score);
});
}

return newData;
}
```