-
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
create #2651
base: master
Are you sure you want to change the base?
create #2651
Conversation
src/convertToObject.js
Outdated
const sourceArr = sourceString.split(''); | ||
|
||
let sourseArr = sourceArr.filter((item, i) => { | ||
if (item === '\n' || (item === ' ' && sourceArr[i - 1] === ' ')) { | ||
return false; | ||
} | ||
|
||
return true; | ||
}); | ||
|
||
sourseArr = sourseArr.join(''); | ||
sourseArr = sourseArr.split(';'); |
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.
we can just split it by ';'
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.
and then remove spaces using the trim
method
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.
thanks, I went step by step, through the debugger and the console, and confused myself
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.
Pay attention on code style
const sourceArr = sourceString.split(';'); | ||
|
||
sourceArr.forEach((elem) => { | ||
const LastIndOfKey = elem.indexOf(':'); |
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.
camelCase
const LastIndOfKey = elem.indexOf(':'); | |
const lastIndOfKey = elem.indexOf(':'); |
No description provided.