Skip to content

Commit

Permalink
Revert "added function"
Browse files Browse the repository at this point in the history
This reverts commit c244a13.
  • Loading branch information
helga16 committed Nov 13, 2024
1 parent c244a13 commit feda5af
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
1 change: 0 additions & 1 deletion index.js

This file was deleted.

30 changes: 25 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
{
"name": "${PROJECT_NAME}",
"name": "style-to-object",
"version": "1.0.0",
"description": "",
"main": "index.js",
"description": "Convert style string to object",
"main": "src/convertToObject.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"init": "mate-scripts init",
"start": "mate-scripts start",
"format": "prettier --ignore-path .prettierignore --write './src/**/*.{html,css,scss,js}'",
"lint": "npm run format && mate-scripts lint",
"test:only": "mate-scripts test",
"update": "mate-scripts update",
"postinstall": "npm run update",
"test": "npm run lint && npm run test:only"
},
"private": true
"author": "Mate academy",
"license": "GPL-3.0",
"devDependencies": {
"@mate-academy/eslint-config": "latest",
"@mate-academy/scripts": "^1.8.6",
"eslint": "^8.57.0",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-node": "^11.1.0",
"jest": "^29.7.0",
"prettier": "^3.3.2"
},
"mateAcademy": {
"projectType": "javascript"
}
}
11 changes: 1 addition & 10 deletions src/convertToObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@
* @return {object}
*/
function convertToObject(sourceString) {
const arrayWithStyles = complexStylesString.split(';')
.map((el) => el.trim());
const resultObject = {};

for (const el of arrayWithStyles) {
const pair = el.split(':').map((el) => el.trim());
resultObject[pair[0]] = pair[1];
}

return resultObject;
// write your code here
}

module.exports = convertToObject;

0 comments on commit feda5af

Please sign in to comment.