Email or username:

Password:

Forgot your password?
Niki Tonsky

Never parse stuff yourself, always use a library.

Core JS library:

8 comments
Feoh

@nikitonsky I've never tried to parse myself. I'm afraid of what I might find if I tried :)

James Conroy-Finn

@nikitonsky either way you’re handing the special case of default port numbers in your code.

Feels like a separate normalisation/presentation step would be preferable.

Niki Tonsky

@private_face what browser is that? I checked on FF, Safari and Chrome on macOS

полный мухоедства

@nikitonsky Firefox, but it is the same in all browsers. If a protocol part matches default port (http/80, https/443, ftp/21) then it returns an empty string

Niki Tonsky

@private_face right, I didn’t notice you switched http and https

Go Up