{"name":"bare-url","version":"2.2.0","author":{"name":"Holepunch"},"license":"Apache-2.0","_id":"bare-url@2.2.0","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"kasperisager","email":"kasperisager@hey.com"}],"homepage":"https://github.com/holepunchto/bare-url","bugs":{"url":"https://github.com/holepunchto/bare-url/issues"},"dist":{"shasum":"e5855ce2e010197952fe5f35951fa8267a9afca7","tarball":"http://registry-npm.ywwl.com/bare-url/download/bare-url-2.2.0.tgz","fileCount":27,"integrity":"sha512-mSNJA/0wTDIg0OzID851OYbBjDVh7c95TLN6w9+bgQntR0hy8mxZ0yBKWWUH7j1YCM7z2+y0B1DKSSSziFEE0g==","signatures":[{"sig":"MEQCIAk/bdhuLvmJEP9FFzJ81qS0lKTR3zscVUDQFTRrXdacAiBw3HHiY3b5UH5MXRSD4GeKPSKIzNFP9dtdhTZXNaP09w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1210534,"size":375787,"noattachment":false,"key":"/bare-url/-/bare-url-2.2.0.tgz"},"addon":true,"types":"./index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./global":{"types":"./global.d.ts","default":"./global.js"},"./package":"./package.json"},"gitHead":"0c028d078b3acc48eb1d45a3074a6fefc55a70b3","scripts":{"test":"prettier . --check && bare test.js"},"_npmUser":{"name":"kasperisager","email":"kasperisager@hey.com"},"repository":{"url":"git+https://github.com/holepunchto/bare-url.git","type":"git"},"_npmVersion":"11.3.0","description":"WHATWG URL implementation for JavaScript","directories":{},"_nodeVersion":"24.2.0","dependencies":{"bare-path":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"brittle":"^3.3.2","prettier":"^3.3.3","cmake-bare":"^1.1.6","cmake-fetch":"^1.0.0","prettier-config-standard":"^7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/bare-url_2.2.0_1754387493508_0.1711869366300771","host":"s3://npm-registry-packages-npm-production"},"readme":"# bare-url\n\nWHATWG URL implementation for JavaScript, built on <https://github.com/holepunchto/liburl>. Provides `URL` and `URLSearchParams` classes compatible with the WHATWG URL Standard.\n\n```\nnpm i bare-url\n```\n\n## Usage\n\n```js\nconst { URL, URLSearchParams } = require('bare-url')\n\nconst url = new URL('https://example.com/path?foo=bar#hash')\n\nconsole.log(url.hostname) // 'example.com'\nconsole.log(url.pathname) // '/path'\nconsole.log(url.searchParams.get('foo')) // 'bar'\n```\n\nTo register `URL` and `URLSearchParams` as globals:\n\n```js\nrequire('bare-url/global')\n```\n\n## API\n\n#### `const url = new URL(input[, base])`\n\nParse `input` as a URL. If `base` is provided, `input` is resolved relative to `base`. Throws if `input` is not a valid URL.\n\n#### `url.href`\n\nThe full serialized URL string. Setting this property reparses the URL.\n\n#### `url.protocol`\n\nThe URL scheme followed by `':'`, e.g. `'https:'`.\n\n#### `url.username`\n\nThe username portion of the URL, or an empty string.\n\n#### `url.password`\n\nThe password portion of the URL, or an empty string.\n\n#### `url.host`\n\nThe hostname and port, e.g. `'example.com:8080'`.\n\n#### `url.hostname`\n\nThe hostname without the port.\n\n#### `url.port`\n\nThe port as a string, or an empty string if not present.\n\n#### `url.pathname`\n\nThe path portion of the URL.\n\n#### `url.search`\n\nThe query string including the leading `'?'`, or an empty string.\n\n#### `url.searchParams`\n\nA `URLSearchParams` object for the query string. Mutations to the params are reflected in the URL.\n\n#### `url.hash`\n\nThe fragment including the leading `'#'`, or an empty string.\n\n#### `url.toString()`\n\nReturns the serialized URL string. Equivalent to `url.href`.\n\n#### `url.toJSON()`\n\nReturns the serialized URL string. Suitable for JSON serialization.\n\n#### `const params = new URLSearchParams([init])`\n\nCreate a new `URLSearchParams` instance. `init` may be a query string, an iterable of `[name, value]` pairs, or an object of key-value pairs.\n\n#### `params.size`\n\nThe total number of search parameters.\n\n#### `params.append(name, value)`\n\nAppend a new `name`/`value` pair.\n\n#### `params.delete(name[, value])`\n\nRemove all pairs with `name`. If `value` is provided, only pairs with both the matching `name` and `value` are removed.\n\n#### `params.get(name)`\n\nReturn the first value for `name`, or `null` if not present.\n\n#### `params.getAll(name)`\n\nReturn all values for `name` as an array.\n\n#### `params.has(name[, value])`\n\nReturn `true` if a pair with `name` exists. If `value` is provided, the pair must also match `value`.\n\n#### `params.set(name, value)`\n\nSet the value for `name`, replacing any existing pairs with that name.\n\n#### `params.toString()`\n\nReturn the serialized query string without the leading `'?'`.\n\n#### `params.toJSON()`\n\nReturn the parameters as an array of `[name, value]` pairs.\n\n#### `URL.isURL(value)`\n\nReturn `true` if `value` is a `URL` instance.\n\n#### `URLSearchParams.isURLSearchParams(value)`\n\nReturn `true` if `value` is a `URLSearchParams` instance.\n\n#### `const url = URL.parse(input[, base])`\n\nParse `input` as a URL without throwing. Returns a `URL` instance on success, or `null` on failure.\n\n#### `const valid = URL.canParse(input[, base])`\n\nReturn `true` if `input` can be parsed as a valid URL, optionally relative to `base`.\n\n#### `const pathname = URL.fileURLToPath(url)`\n\nConvert a `file:` URL to a platform-specific file path. `url` may be a `URL` instance or a string. Throws if the URL does not use the `file:` protocol or contains invalid path characters.\n\n#### `const url = URL.pathToFileURL(pathname)`\n\nConvert a platform-specific file path to a `file:` URL.\n\n#### `const href = URL.format(parts)`\n\nFormat a URL from individual `parts`:\n\n```js\nparts = {\n  protocol,\n  auth,\n  host,\n  hostname,\n  port,\n  pathname,\n  search,\n  query,\n  hash,\n  slashes\n}\n```\n\nAll properties are optional. If `host` is provided, `hostname` and `port` are ignored. If `search` is provided, `query` is ignored. Set `slashes` to `true` to include `'//'` after the protocol.\n\n## License\n\nApache-2.0\n","publish_time":1754387493732,"_cnpm_publish_time":1754387493732,"dist-tags":{"latest":"2.5.5"}}