-
Notifications
You must be signed in to change notification settings - Fork 15
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
Yasmin/url parser #18
base: Kim-Yangha
Are you sure you want to change the base?
Conversation
|
||
constructor(url) { | ||
this.#url = url; | ||
this.#full_path = url.split('://')[1].split(':')[1].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.
Uri에 포트번호가 없는 경우에는 두번째 스플릿에서 outofboundindex exception이 뜨지 않을까하는 생각이 듭니당...!
constructor(url) { | ||
this.#url = url; | ||
this.#full_path = url.split('://')[1].split(':')[1].split('/'); | ||
this.#before_query = url.split('://')[1].split(':')[1].split('/').slice(1, -1).concat(url.split('://')[1].split(':')[1].split('/').reverse()[0].split('?')[0]); |
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.
코드만 딱 보았을때 어떤 부분을 어떻게 골라낼 의도인지 바로 보이지 않아서 아쉽네요! 이 부분에 관한 처리는 메소드로 따로 빼서 변수 네이밍을 활용하면 이해가 더 쉽지 않을까 조심스레 제안해봅니당
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.
수고하셨습니다. PR 다시 날려주세요.
console.log(up.show()); | ||
console.log(`URI: ${up.getURI()}`); | ||
console.log(`Protocol: ${up.getProtocol()}`); //http | ||
console.log(`Host: ${up.getHost()}`); //opentutorials.org | ||
console.log(`Port: ${up.getPort()}`); //3000 | ||
// 리턴이 void 라서 undefined 뜸 | ||
// console.log(`Append Path : ${up.appendPath('econovation')}`); | ||
console.log(`LastPath: ${up.removeLastPath()}`); //path | ||
console.log(`Path: ${up.getPath()}`); //[main, path] path를 배열로 반환 | ||
console.log(`Full Path: ${up.getFullPath()}`); | ||
console.log(`Query String: ${up.getQueryString()}`); | ||
console.log(`Query String Value: ${up.getQueryStringValueOf('page')}`); |
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.
Jest 라이브러리를 사용해보는 것은 어떠신가요?
테스팅 라이브러리 입니다.
let fullPath = ''; | ||
for(let i of this.#full_path) { | ||
fullPath += ('/'+i); | ||
} | ||
return fullPath; |
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.
reduce 한 번 사용하시는 건 어떤가용
HELLO!
전에 필요없는 커밋들이 함께 들어가서 새브랜치로 재 pr 날립니다.
(체리픽, 리베이스, 다해봤는데, 뭔가 꼬인듯 합닏,....)
효율적이지 못한 부분이 있어서, 다른 분들 코드보고 참고하고 싶습니다.
퀘스트 내주신 @GiPyoo님과 완료하신 @vvvpiano 님께 리뷰 부탁드립니다 :)
![image](https://user-images.githubusercontent.com/48500209/106272226-90392000-61e5-11eb-80a6-829e39282577.png)