Skip to content

Solution#4974

Open
oleshna27l-debug wants to merge 2 commits into
mate-academy:masterfrom
oleshna27l-debug:develop
Open

Solution#4974
oleshna27l-debug wants to merge 2 commits into
mate-academy:masterfrom
oleshna27l-debug:develop

Conversation

@oleshna27l-debug

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

I am requesting changes because there is still a checklist violation that is treated as a core requirement. Your reduce implementation in src/convertToObject.js currently mutates the accumulator object (e.g., on the line where you do something like acc[key] = value; inside reduce), which goes against [CHECKLIST ITEM #1]: “Don't use iteration methods to modify an already existing array/object (forEach is exception).” This is considered critical for this assignment, even though the functionality works correctly.

To fix this, adjust the reduce callback so it returns a new object on each iteration instead of mutating acc in place, for example by using object spread: return { ...acc, [key]: value };. Functionally, your convertToObject behavior is good: it parses the style string correctly, respects the no-loops rule, and uses filter/reduce appropriately. Once you update the reduce to be immutable, your solution will align fully with the checklist and be in great shape. Nice work overall on correctness and structure—this is a small but important refinement in iteration style.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/convertToObject.js Outdated
return acc;
}

acc[parts[0].trim()] = parts[1].split(';')[0].trim();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line violates checklist item #1: "Don't use iteration methods to modify an already existing array/object (forEach is exception). These methods return a new array, so you should use it." Here you are mutating the accumulator object in reduce; instead, build and return a new object on each iteration (e.g. via object spread) rather than assigning to acc directly.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

I am approving your solution because it now fully meets the functional requirements and the checklist constraints. Your convertToObject implementation correctly parses the CSS-style string, trims keys and values, and ignores empty or invalid lines so that the resulting object matches the expected example. You’ve removed all loops and rely solely on split, filter, and reduce for iteration, which satisfies the explicit technical constraint about avoiding loops. The reduce callback is implemented immutably by returning a new object on each iteration instead of mutating the accumulator, aligning with the checklist about non-mutating patterns. Variable naming is clear and avoids banned generic names, and the method chaining is formatted in a readable, compliant way. Overall, your code is clean, easy to follow, and adheres to both the functional and stylistic requirements—nice work finishing this task solidly.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants