diff --git a/src/convertToObject.js b/src/convertToObject.js index f92b2c673..a19cd3299 100644 --- a/src/convertToObject.js +++ b/src/convertToObject.js @@ -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; } );