diff --git a/src/convertToObject.js b/src/convertToObject.js index 32c556ea4..317e5bcf7 100644 --- a/src/convertToObject.js +++ b/src/convertToObject.js @@ -6,7 +6,15 @@ * @return {object} */ function convertToObject(sourceString) { - // write your code here + return sourceString.split(';').reduce(addStyle, {}); +} + +function addStyle(styles, string) { + const style = string.split(':').map((item) => item.trim()); + + styles[style[0]] = style[1]; + + return styles; } module.exports = convertToObject;