{"_id":"url-join@6.0.0","bugs":{"url":"https://github.com/jfromaniello/url-join/issues"},"dist":{"shasum":"7c6366428eb8abd0d83ac02df6a01df2ea11db37","tarball":"http://registry-npm.ywwl.com/url-join/download/url-join-6.0.0.tgz","fileCount":5,"integrity":"sha512-GrPbZO5/Il4fCWGbvu9nWsanTvCBOPluHf3lzCA+NlfTyObhpt4T6MufVyRj4HAkh3XARV1OTPGHmJfj6LI/jg==","signatures":[{"sig":"MEUCIQCgba70JkFwCnWfBclfIuBIz4VXEasMNbT6hPAEhKfcWgIgAmrG/qivXLBsOOiSjLqKPC2jqsyAv4XBfl5AwaP40+E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDQYt5rszd7YBm5N2LwRpcHpy4TLZhm61GaxnnQGXUmVAIhALubEJnGBr4vyrhzU1I4PfM1NWac4AxB34c00SHkMzcW"}],"unpackedSize":9587,"size":4104,"noattachment":false,"key":"/url-join/-/url-join-6.0.0.tgz"},"main":"./lib/url-join.js","name":"url-join","type":"module","types":"./lib/url-join.d.ts","author":{"url":"http://joseoncode.com","name":"José F. Romaniello","email":"jfromaniello@gmail.com"},"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"exports":"./lib/url-join.js","gitHead":"d1df5a926c9b61467bda4b05e6d33b38c7a5cf03","license":"MIT","scripts":{"test":"node --test"},"version":"6.0.0","_npmUser":{"name":"jfromaniello","email":"jfromaniello@gmail.com"},"homepage":"https://github.com/jfromaniello/url-join#readme","keywords":["url","join"],"repository":{"url":"git://github.com/jfromaniello/url-join.git","type":"git"},"_npmVersion":"11.10.1","description":"Join urls and normalize as in path.join.","directories":{},"maintainers":[{"name":"jkoops","email":"jonkoops@gmail.com"},{"name":"jfromaniello","email":"jfromaniello@gmail.com"}],"sideEffects":false,"_nodeVersion":"25.7.0","_hasShrinkwrap":false,"devDependencies":{"conventional-changelog":"^8.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/url-join_6.0.0_1792854960091_0.9113244652269559"},"readme":"Join all arguments together and normalize the resulting URL.\n\n## Install\n\n```bash\nnpm install url-join\n```\n\nIf you want to use it directly in a browser use a CDN like [Skypack](https://www.skypack.dev/view/url-join).\n\n## Usage\n\n```javascript\nimport urlJoin from 'url-join';\n\nconst fullUrl = urlJoin('http://www.google.com', 'a', '/b/cd', '?foo=123', '&bar=456', '#heading-1');\n\nconsole.log(fullUrl.toString()); // 'http://www.google.com/a/b/cd?foo=123&bar=456#heading-1'\n```\n\nAn initial `host:port` with a numeric port, such as `localhost:3000`, is kept\nwithout adding protocol slashes. This form is ambiguous with a protocol followed\nby a numeric value. Use `my_app://123` or separate arguments (`'my_app:', '123'`)\nto explicitly request protocol normalization in that case.\n\n## You might not need this library\n\nThis library was originally created before the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL_API) was standardized and widely available in popular runtimes such as browsers and Node.js. Depending on your use-case you might want to consider using the standardized API over this library.\n\n### In the Browser\n\nFor example, the equivalent code for the above example would look as follows when using the URL API:\n\n```javascript\nconst fullUrl = new URL('http://www.google.com');\n\nfullUrl.pathname = '/a/b/cd';\nfullUrl.searchParams.append('foo', '123');\nfullUrl.searchParams.append('bar', '456');\nfullUrl.hash = 'heading-1';\n\nconsole.log(fullUrl.toString()); // 'http://www.google.com/a/b/cd?foo=123&bar=456#heading-1'\n```\n\n### Joining paths\n\nThis library provides the missing piece for the URL API, joining multiple paths together:\n\n```javascript\nimport urlJoin from 'url-join';\n\nconst fullUrl = new URL('http://www.google.com');\n\nfullUrl.pathname = urlJoin('a', '/b/cd');\n\nconsole.log(fullUrl.toString()); // 'http://www.google.com/a/b/cd'\n```\n\n### In Node.js\n\nIf you are using Node.js, the `path/posix` module can join paths in a way that is compatible with URL pathnames:\n\n```javascript\nimport { join as joinPath } from 'node:path/posix';\n\nconst fullUrl = new URL('http://www.google.com');\n\nfullUrl.pathname = joinPath('a', '/b/cd');\n\nconsole.log(fullUrl.toString()); // 'http://www.google.com/a/b/cd'\n```\n\n### Caveats of URL API\n\nThere are a couple of caveats to take into account when utilizing the standard APIs. Firstly, a `URL` must always include a complete and valid base, which means specifying the scheme and domain name (e.g. http://example.com).\n\nSecondly, it is not possible to join together and normalize the path of a URL. You must do this manually by joining your paths and then assigning the pathname property.\n\n## License\n\nMIT\n","publish_time":1792854960191,"_cnpm_publish_time":1792854960191,"dist-tags":{"latest":"6.0.0"}}