Open vinniefalco opened 4 years ago
Hey there,
sorry for the late reply - currently on the road…
Are things like
directory()
andsuffix()
really necessary?
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.
I ask, because I am modeling my C++ URL library after this one
Is there a reason you're not going for parity with URL? That would be my choice in this day and age…
Do you have any links to projects that make heavy use of URI.js?
I do not. And I would not recommend using it since support (including polyfills) for URL has become wide spread.
Is there a reason you're not going for parity with URL?
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).
URL class shows what the standard settled on. For me that's been 99% sufficient.
Yes, given that I can't find any evidence of user need for things like directory
and the others (which still seem thoughtful and nice), my second choice will be simply to copy the URL class specification which is straight forward enough, subject to the modifications necessary to adhere to "Modern C++."
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!