Skip to content
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

Open
wants to merge 5 commits into
base: Kim-Yangha
Choose a base branch
from

Conversation

ummaeha
Copy link
Member

@ummaeha ummaeha commented Jan 29, 2021

HELLO!

전에 필요없는 커밋들이 함께 들어가서 새브랜치로 재 pr 날립니다.
(체리픽, 리베이스, 다해봤는데, 뭔가 꼬인듯 합닏,....)

효율적이지 못한 부분이 있어서, 다른 분들 코드보고 참고하고 싶습니다.

퀘스트 내주신 @GiPyoo님과 완료하신 @vvvpiano 님께 리뷰 부탁드립니다 :)
image

@ummaeha ummaeha requested a review from GiPyoo January 29, 2021 11:54

constructor(url) {
this.#url = url;
this.#full_path = url.split('://')[1].split(':')[1].split('/');
Copy link
Member

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]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드만 딱 보았을때 어떤 부분을 어떻게 골라낼 의도인지 바로 보이지 않아서 아쉽네요! 이 부분에 관한 처리는 메소드로 따로 빼서 변수 네이밍을 활용하면 이해가 더 쉽지 않을까 조심스레 제안해봅니당

Copy link
Contributor

@GiPyoo GiPyoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다. PR 다시 날려주세요.

Comment on lines +6 to +17
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')}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jest 라이브러리를 사용해보는 것은 어떠신가요?
테스팅 라이브러리 입니다.

Comment on lines +46 to +50
let fullPath = '';
for(let i of this.#full_path) {
fullPath += ('/'+i);
}
return fullPath;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reduce 한 번 사용하시는 건 어떤가용

@ummaeha ummaeha changed the base branch from master to Kim-Yangha January 31, 2021 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants