-
Notifications
You must be signed in to change notification settings - Fork 476
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
What is the point of directory, suffix, etc? #393
Comments
Hey there, sorry for the late reply - currently on the road…
I remember having had that discussion when the URL spec was written. It was decided that these utilities were not strictly necessary and therefore omitted completely. URI.js is a collection of pretty much everything (or at least most things) you could do with an URL. That does not say that these features are really necessary. URL class shows what the standard settled on. For me that's been 99% sufficient. The rare cases of actually having had to mangle paths I resorted to node's path module.
Is there a reason you're not going for parity with URL? That would be my choice in this day and age…
I do not. And I would not recommend using it since support (including polyfills) for URL has become wide spread. |
Yes, well I liked your library better :) Because the documentation makes strong statements about the functionality and it looked more robust. But I did not have any evidence those features are strictly necessary, and some other people are pressuring me not to include them in my URL library (which is here (https://github.com/vinniefalco/url).
Yes, given that I can't find any evidence of user need for things like |
Are things like
directory()
andsuffix()
really necessary? The RFC doesn't say much about this, and there are plenty of cases where "all but the last non-empty segment" is not actually the directory. For example: in/x/index.php/y/z
, the directory isx
, the file isindex.php
, and/y/z
is an additional argument passed to the php script.I note that Mozilla URL and Node.js URL don't offer these conveniences.
I ask, because I am modeling my C++ URL library after this one and I am hearing a lot of voices from self-professed experts that "these features are not necessary." So before I do a bunch of possibly unnecessary work, are there use cases for manipulating the directory? For replacing path segments in the middle (i.e. replace the middle path segment with these 3 new segments)? Do you have any links to projects that make heavy use of URI.js?
Thanks!
The text was updated successfully, but these errors were encountered: