Skip to content
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

Solution #3686

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Solution #3686

wants to merge 1 commit into from

Conversation

nataliia2211
Copy link

No description provided.

Copy link

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

Choose a reason for hiding this comment

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

Great job on implementing the convertToObject function! 🎉 Your code meets the task requirements and handles CSS style strings effectively. Just remember to trim both key and value to ensure no leading or trailing spaces sneak into your object. Keep up the great work! 🚀

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

Comment on lines +20 to +21
const [key, ...values] = el.split(':');
const value = values.join(':').trim();

Choose a reason for hiding this comment

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

The use of ...values and values.join(':') is correct for handling cases where the value itself might contain colons. However, ensure that the key is properly trimmed before using it to avoid any leading or trailing spaces in the object keys.

Comment on lines +23 to +24
if (key && value) {
styles[key.trim()] = value;

Choose a reason for hiding this comment

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

Ensure that both key and value are trimmed before checking their truthiness. This will prevent any issues with keys or values that might have only whitespace.

Copy link

@BudnikOleksii BudnikOleksii left a comment

Choose a reason for hiding this comment

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

Good work 👍

Comment on lines +17 to +19
.map((el) => el.trim())
.filter((el) => el.includes(':'))
.forEach((el) => {

Choose a reason for hiding this comment

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

  • arr/array/str/string/el/elem/obj/object/res/result are bad names, name should describe variable
  • You can use reduce to generate an object with it

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.

3 participants