{"_id":"url-join@5.1.1","bugs":{"url":"https://github.com/jfromaniello/url-join/issues"},"dist":{"shasum":"4a12e586625edee5c1c94e07a6a39978614eb11e","tarball":"http://registry-npm.ywwl.com/url-join/download/url-join-5.1.1.tgz","fileCount":5,"integrity":"sha512-5+M4YX5pEFeXSdMyt3J5iXr949UC+j6yHRkZUEv6ljTusAfdCdS4pSTudnYGzYEbKkdK5xIE0E3i5xzIzoiFrQ==","signatures":[{"sig":"MEUCIQDC5BRXRMctOBWbHaDIe8y7wtaacJNf0L9w+FPfCFQuQAIgM8uy2oGK8vcrcZY3RtWZ5FCdl+w866spXJWB3Uv0PVQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCCBLfmpwFz/hnmAEbQgPe0yyMUu/mKt6wQ97Ay85U6jAIgLRoij1CklN2LzO1ntR2el4PZjyNybvzHVylzvKPHFB8="}],"unpackedSize":8371,"size":3588,"noattachment":false,"key":"/url-join/-/url-join-5.1.1.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":"0a8a999b88147b703be5f07c605e8f1e69aab9fd","license":"MIT","scripts":{"test":"node --test"},"version":"5.1.1","_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_5.1.1_1791933978278_0.47912643975851354"},"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\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":1791933978360,"_cnpm_publish_time":1791933978360,"dist-tags":{"latest":"6.0.0"}}