You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
URI.js is currently lacking a utility like Node's path.join() to simply concatenate a few tokens to generate a path. Here's a naive (and not quite accurate) approach:
URI.joinPaths=function(){varsegments=[].reduce.call(arguments,function(previous,current){var_segments=newURI(current).segment();returnprevious.concat(_segments);},[]).filter(Boolean);returnnewURI('').segment(segments);};URI.joinPaths('/a/b','/c','d','/e').toString();// "a/b/c/d/e"// (should have leading "/")URI.joinPaths('a/b','http://example.com/c',newURI('d/'),'/e').toString();// "a/b/c/d/e"URI.joinPaths('a').toString();// "a"URI.joinPaths('').toString();// "/"// (should be empty string "")URI.joinPaths('a','','','b','','').toString();// "a/b"// (should have trailing "/")
Somewhat related is the need to resolve paths similarly to Node's path.resolve() but that should probably be a separate PR.
The text was updated successfully, but these errors were encountered:
URI.js is currently lacking a utility like Node's
path.join()
to simply concatenate a few tokens to generate a path. Here's a naive (and not quite accurate) approach:Somewhat related is the need to resolve paths similarly to Node's
path.resolve()
but that should probably be a separate PR.The text was updated successfully, but these errors were encountered: