{"name":"url-join","version":"5.1.2","keywords":["url","join"],"author":{"url":"http://joseoncode.com","name":"José F. Romaniello","email":"jfromaniello@gmail.com"},"license":"MIT","_id":"url-join@5.1.2","maintainers":[{"name":"jkoops","email":"jonkoops@gmail.com"},{"name":"jfromaniello","email":"jfromaniello@gmail.com"}],"homepage":"https://github.com/jfromaniello/url-join#readme","bugs":{"url":"https://github.com/jfromaniello/url-join/issues"},"dist":{"shasum":"ffe8ddf628843a8d06d6d614a89d060b1ed5182d","tarball":"http://registry-npm.ywwl.com/url-join/download/url-join-5.1.2.tgz","fileCount":5,"integrity":"sha512-FtX93bRHT08aVh5HmGvaFwYFwZjJgGThh5DEaQcuT//yx2ew0Lh11zPKrnRV1reyQt8rv8MNfARn6KvSTp6NQw==","signatures":[{"sig":"MEUCIGIj8D4rHcYt7FB4BpVOrg7gsEYDKrPljAEcgOBhm0gyAiEAvQUdoN5jE8IuJ5WzuKpAprpIJs5OF82kcLoZFQHK+Gg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIFqXCOCgRRurvpPWiaEO5hHRXNqzNEy9d+OhqrvIiSpfAiAhYK6uPxPoZyLZKGRFN5EKJofeUBcrGhUi/CSMbbkPOw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8371,"size":3589,"noattachment":false,"key":"/url-join/-/url-join-5.1.2.tgz"},"main":"./lib/url-join.js","type":"module","types":"./lib/url-join.d.ts","engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"exports":"./lib/url-join.js","gitHead":"63d1a45e262bc36d1074f4a56a5e4fc244264ba8","scripts":{"test":"node --test"},"_npmUser":{"name":"jfromaniello","email":"jfromaniello@gmail.com"},"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":{},"sideEffects":false,"_nodeVersion":"25.7.0","_hasShrinkwrap":false,"devDependencies":{"conventional-changelog":"^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/url-join_5.1.2_1792853905459_0.7250454230283503","host":"s3://npm-registry-packages-npm-production"},"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":1792853905544,"_cnpm_publish_time":1792853905544,"dist-tags":{"latest":"6.0.0"}}