-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
task finished #2757
base: master
Are you sure you want to change the base?
task finished #2757
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! Approve) Was little bit hard with variables names)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! You can do it in less actions and do not overfill your code by logic, even if you do it not as in my comment 😉
src/convertToObject.js
Outdated
.reduce((accumulator, param) => { | ||
accumulator[param[0]] = param[1]; | ||
|
||
return accumulator; | ||
}, objectWithCssParams); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to use reduce
, but you could process every item inside this method and get rid of other methods like
return sourceString.split(";").reduce((result, style) => {
there you get array from the whole string style.split(":");
there you trim every pair key = yourPair[0]?.trim();
there you trim every pair value = yourPair[1]?.trim();
if (key && value) {
result[key] = value;
}
return result;
}, {});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESLint forbids "?" before trim :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 🔥
No description provided.