Skip to content

Commit

Permalink
Destructuring and filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mosowiecka committed Nov 12, 2023
1 parent 97d7d88 commit c4d2a8f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/convertToObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ function convertToObject(sourceString) {
.split(';')
.map((element) => element
.split(':')
.map((element2) => element2.trim())
).forEach((element) => {
if (element[0] !== '' && element[0] !== undefined) {
stylesObject[element[0]] = element[1];
}
.map((element2) => element2.trim()))
.filter((element) => element[0] !== '' && element[0] !== undefined)
.forEach((element) => {
const [key, value] = element;

stylesObject[key] = value;
}
);

Expand Down

0 comments on commit c4d2a8f

Please sign in to comment.