{"_id":"a-better-url","_rev":"8-541331a2e75670690807f436acbfd246","name":"a-better-url","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.1":{"name":"a-better-url","version":"0.1.1","license":"MIT","_id":"a-better-url@0.1.1","maintainers":[{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"}],"homepage":"https://github.com/JannisK89/a-better-url#readme","bugs":{"url":"https://github.com/JannisK89/a-better-url/issues"},"dist":{"shasum":"26c811d2dc08d178aab145103f2675caa55367c6","tarball":"https://registry.npmjs.org/a-better-url/-/a-better-url-0.1.1.tgz","fileCount":7,"integrity":"sha512-rjsgGZVxzETNnQz+cqR3gWM/COAhB7/HLFdJqtUH8Gos/F6jMkyJHfxY8zacxp55c4xlHo6RX/ealKZzpTv2aQ==","signatures":[{"sig":"MEUCIHXUXDFTY4g9w5Y6U37+3mMHl+qoql+YXHBmRPhtufB9AiEA9A4kRzwzRF8YeIymmCGX0jdaXTjjKRgCD2WOZV/4f5Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":98639},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"505f89625f65cbdcece4796820d40d722a9c04dd","scripts":{"build":"tsup src/index.ts --minify --format cjs,esm --dts"},"_npmUser":{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"},"repository":{"url":"git+https://github.com/JannisK89/a-better-url.git"},"_npmVersion":"9.6.6","description":"A simpler way to manage URLs in your project without the mess of string concatenation.","directories":{},"_nodeVersion":"20.2.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.1.0","eslint":"9.x","globals":"^15.8.0","bun-types":"latest","@eslint/js":"^9.7.0","@types/bun":"^1.1.6","typescript":"^5.5.3","typescript-eslint":"^7.16.0"},"_npmOperationalInternal":{"tmp":"tmp/a-better-url_0.1.1_1721219449173_0.7208980896034034","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"a-better-url","version":"0.1.2","license":"MIT","_id":"a-better-url@0.1.2","maintainers":[{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"}],"homepage":"https://github.com/JannisK89/a-better-url#readme","bugs":{"url":"https://github.com/JannisK89/a-better-url/issues"},"dist":{"shasum":"b42651f67ca1484e8f4d428c405c1ade7e3f91ce","tarball":"https://registry.npmjs.org/a-better-url/-/a-better-url-0.1.2.tgz","fileCount":3,"integrity":"sha512-c6NcJhzU2x+hoQyaloijNAjlfm+Vb4Vb9y3MydJGAcTLJaOTucYJdZTen1NGx2m4YhQFlmvLNv4tih7jQIn9bA==","signatures":[{"sig":"MEYCIQCeMR739GutIXSEQYcXTqtWS5yuSxfuRP93OG9IbdMBrQIhAJyhjXpqhaSs3hGMUBbM8cd4FmXGjBuUer3xREEaGz0l","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":92805},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"d1719ae365c736f8b6bf62f93182400592aee9af","scripts":{"build":"tsup src/index.ts --minify --format cjs,esm --dts"},"_npmUser":{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"},"repository":{"url":"git+https://github.com/JannisK89/a-better-url.git"},"_npmVersion":"9.6.6","description":"A simpler way to manage URLs in your project without the mess of string concatenation.","directories":{},"_nodeVersion":"20.2.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.1.0","eslint":"9.x","globals":"^15.8.0","bun-types":"latest","@eslint/js":"^9.7.0","@types/bun":"^1.1.6","typescript":"^5.5.3","typescript-eslint":"^7.16.0"},"_npmOperationalInternal":{"tmp":"tmp/a-better-url_0.1.2_1721383406766_0.02433969700168004","host":"s3://npm-registry-packages"}},"0.1.3":{"name":"a-better-url","version":"0.1.3","license":"MIT","_id":"a-better-url@0.1.3","maintainers":[{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"}],"homepage":"https://github.com/JannisK89/a-better-url#readme","bugs":{"url":"https://github.com/JannisK89/a-better-url/issues"},"dist":{"shasum":"3a12aff3d62eca8dd9452e277606f2e036e1b8bb","tarball":"https://registry.npmjs.org/a-better-url/-/a-better-url-0.1.3.tgz","fileCount":8,"integrity":"sha512-JqTKQFtHwDReHR8Iu9A1U7CacY8GtAQqYydLLxBzwgeAOY/56HU+84Fm9Fk9r2h20CycjYzqvr82Ai57yJTzFg==","signatures":[{"sig":"MEUCIQD1k1KfPv3WSSoyf31XqyFRTuVkIK91PegY+eLuDlmcOgIgWtIbU3l3eFd2oqn3qasQtkUk5Q/qRHYyiTnbnj9nPlc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":139379},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"4a50c3e9b8394afc48da270af0d5dcc63d4e2731","scripts":{"build":"tsup src/index.ts --minify --format cjs,esm --dts"},"_npmUser":{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"},"repository":{"url":"git+https://github.com/JannisK89/a-better-url.git"},"_npmVersion":"9.6.6","description":"A simpler way to manage URLs in your project without the mess of string concatenation.","directories":{},"_nodeVersion":"20.2.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.1.0","eslint":"9.x","globals":"^15.8.0","bun-types":"latest","@eslint/js":"^9.7.0","@types/bun":"^1.1.6","typescript":"^5.5.3","typescript-eslint":"^7.16.0"},"_npmOperationalInternal":{"tmp":"tmp/a-better-url_0.1.3_1721556729909_0.16935420623292297","host":"s3://npm-registry-packages"}},"0.1.4":{"name":"a-better-url","version":"0.1.4","license":"MIT","_id":"a-better-url@0.1.4","maintainers":[{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"}],"homepage":"https://github.com/JannisK89/a-better-url#readme","bugs":{"url":"https://github.com/JannisK89/a-better-url/issues"},"dist":{"shasum":"47a9a36877f6c17339e0af570f5d9e656f4f1719","tarball":"https://registry.npmjs.org/a-better-url/-/a-better-url-0.1.4.tgz","fileCount":7,"integrity":"sha512-2r+8MUmlghX9p1WMmyvV5L8YVq4pbDIdKrxr0O+vzz+2SCXd2vigozaothbCS5CJKsVI6jfzrgfOOgUeSVTJRw==","signatures":[{"sig":"MEYCIQCnQfQVUeFM5QRR44HFY38MZ5wVbb2ENDCYCXDEvuPTJQIhANpyHk90Rd3wv1ob1V7VDHmcAAwhaZzCvSxOYVojz04J","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":103097},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"cd0552c6504c033fa8553ef26b31fd77f56fe6e8","scripts":{"build":"tsup src/index.ts --minify --format cjs,esm --dts"},"_npmUser":{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"},"repository":{"url":"git+https://github.com/JannisK89/a-better-url.git"},"_npmVersion":"9.6.6","description":"A simpler way to manage URLs in your project without the mess of string concatenation.","directories":{},"_nodeVersion":"20.2.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.1.0","eslint":"9.x","globals":"^15.8.0","bun-types":"latest","@eslint/js":"^9.7.0","@types/bun":"^1.1.6","typescript":"^5.5.3","typescript-eslint":"^7.16.0"},"_npmOperationalInternal":{"tmp":"tmp/a-better-url_0.1.4_1721814454801_0.15382468260521698","host":"s3://npm-registry-packages"}},"0.1.5":{"name":"a-better-url","version":"0.1.5","license":"MIT","_id":"a-better-url@0.1.5","maintainers":[{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"}],"homepage":"https://github.com/JannisK89/a-better-url#readme","bugs":{"url":"https://github.com/JannisK89/a-better-url/issues"},"dist":{"shasum":"022e8013a0febeb5a6b769b68e70e7767c898b64","tarball":"https://registry.npmjs.org/a-better-url/-/a-better-url-0.1.5.tgz","fileCount":7,"integrity":"sha512-RNW4K1G5hqwe61VcFQgdKLIFUPAdmNB+bqlWs2VvRI9vO/zvrKO9m3rV9c9PIWTCxYUHwK/lzU65/iv0iieh8A==","signatures":[{"sig":"MEQCIENyrXG3Fg4L2CQ1D0Cajnc2HHUjFS6oq3u9b1I9LaMhAiBJbLVDDlMOBqynyEcNw4tZWfftH9UV5XUbyVBa8K+cPA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":103885},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"61a7005b5f3a04de222ba274ba12ae1778f2d661","scripts":{"build":"tsup src/index.ts --minify --format cjs,esm --dts"},"_npmUser":{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"},"repository":{"url":"git+https://github.com/JannisK89/a-better-url.git"},"_npmVersion":"9.6.6","description":"A simpler way to manage URLs in your project without the mess of string concatenation.","directories":{},"_nodeVersion":"20.2.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.1.0","eslint":"9.x","globals":"^15.8.0","bun-types":"latest","@eslint/js":"^9.7.0","@types/bun":"^1.1.6","typescript":"^5.5.3","typescript-eslint":"^7.16.0"},"_npmOperationalInternal":{"tmp":"tmp/a-better-url_0.1.5_1721984274584_0.37839948474242746","host":"s3://npm-registry-packages"}},"0.1.6":{"name":"a-better-url","version":"0.1.6","license":"MIT","_id":"a-better-url@0.1.6","maintainers":[{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"}],"homepage":"https://github.com/JannisK89/a-better-url#readme","bugs":{"url":"https://github.com/JannisK89/a-better-url/issues"},"dist":{"shasum":"f6caa1714978a4f9b17355e8aad3d2d4bc8e8188","tarball":"https://registry.npmjs.org/a-better-url/-/a-better-url-0.1.6.tgz","fileCount":7,"integrity":"sha512-erRdp15aW/R02TLFw6EcD0lEEh8WQ67KQum+bXbolyxEmRqHjHxJ2BeX514z6shfoToo4k8KBJraqXXG82Ld/w==","signatures":[{"sig":"MEUCIQCDJ189+a2ezoZAsT5FjLSnS9+eSFZ4MUbrTHwPtEdXGQIgN3AI2OkERXRnr/aANx4r1eb4sTiZEA4TaXC/RpOyvL8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":105815},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"457979a97291e0d2b7ad0847f1baad48dd03c0a6","scripts":{"build":"tsup src/index.ts --minify --format cjs,esm --dts"},"_npmUser":{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"},"repository":{"url":"git+https://github.com/JannisK89/a-better-url.git"},"_npmVersion":"9.6.6","description":"A simpler way to manage URLs in your project without the mess of string concatenation.","directories":{},"_nodeVersion":"20.2.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.1.0","eslint":"9.x","globals":"^15.8.0","bun-types":"latest","@eslint/js":"^9.7.0","@types/bun":"^1.1.6","typescript":"^5.5.3","typescript-eslint":"^7.16.0"},"_npmOperationalInternal":{"tmp":"tmp/a-better-url_0.1.6_1722154476375_0.876513396774532","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"a-better-url","license":"MIT","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","type":"module","version":"0.2.0","repository":{"url":"git+https://github.com/JannisK89/a-better-url.git"},"devDependencies":{"@eslint/js":"^9.7.0","@types/bun":"^1.1.6","bun-types":"latest","eslint":"9.x","globals":"^15.8.0","tsup":"^8.1.0","typescript":"^5.5.3","typescript-eslint":"^7.16.0"},"scripts":{"build":"tsup src/index.ts --minify --format cjs,esm --dts"},"gitHead":"879a55e1c75a735026bf860059afcd7c312adcd8","description":"A simpler way to manage URLs in your project without the mess of string concatenation.","bugs":{"url":"https://github.com/JannisK89/a-better-url/issues"},"homepage":"https://github.com/JannisK89/a-better-url#readme","_id":"a-better-url@0.2.0","_nodeVersion":"20.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-cjGEV98gFyTkNBeCvz6NtPvBRqBujKZjPh4NX2aHauIpXMnQzWmATfT2jxkk5TWp583ShJUK8rriiAD06HAUsA==","shasum":"6bcf0fd960be2eb017b1826a407d96d01418cc4d","tarball":"https://registry.npmjs.org/a-better-url/-/a-better-url-0.2.0.tgz","fileCount":7,"unpackedSize":108647,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE6Pn17seaMPtLwSCt4gLQG0+n8EDDmM7rZ6j6nUgs+PAiEA6iN9039YKkGk58/VSDFbjgNq4v0MAEsvbOT+8k8V0do="}]},"_npmUser":{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"},"directories":{},"maintainers":[{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/a-better-url_0.2.0_1722501133504_0.20898458033219747"},"_hasShrinkwrap":false}},"time":{"created":"2024-07-17T12:30:49.172Z","modified":"2024-08-01T08:32:13.800Z","0.1.0":"2024-07-16T12:15:49.176Z","0.1.1":"2024-07-17T12:30:49.342Z","0.1.2":"2024-07-19T10:03:26.921Z","0.1.3":"2024-07-21T10:12:10.133Z","0.1.4":"2024-07-24T09:47:35.210Z","0.1.5":"2024-07-26T08:57:54.764Z","0.1.6":"2024-07-28T08:14:36.595Z","0.2.0":"2024-08-01T08:32:13.632Z"},"bugs":{"url":"https://github.com/JannisK89/a-better-url/issues"},"license":"MIT","homepage":"https://github.com/JannisK89/a-better-url#readme","repository":{"url":"git+https://github.com/JannisK89/a-better-url.git"},"description":"A simpler way to manage URLs in your project without the mess of string concatenation.","maintainers":[{"name":"jannisk89","email":"Jannis.Karanikis1@gmail.com"}],"readme":"# aBURL - A Better URL\n\nA simpler way to manage URLs in your project without the mess of string concatenation.\n\n## Installation\n\n### Npm\n\n```bash\nnpm install a-better-url\n```\n\n### Bun\n\n```bash\nbun install a-better-url\n```\n\n## Features\n\n- Less messy URL management compared to string concatenation\n- Easily add, remove, and update URL parameters\n- 0 Dependencies\n- TypeScript Support\n\n## Usage\n\n```javascript\nimport aBURL from 'a-better-url'\n\nconst options = {\n  directories: ['api', 'v1', 'users'],\n  params: { id: 1, limit: 100, offset: 0 },\n  subDomains: ['shop'],\n}\n\nconst exampleDotCom = aBURL('example.com', {\n  ...options,\n})\n\n// Fetches from https://shop.example.com/api/v1/users?id=1&limit=100&offset=0\nconst user1 = await fetch(exampleDotCom.url())\n\nexampleDotCom.removeParams(['id'])\nexampleDotCom.updateParams({ firstName: 'John', lastName: 'Doe' })\n\n// Fetches from https://shop.example.com/api/v1/users?limit=100&offset=0&firstName=John&lastName=Doe\nconst user2 = await fetch(exampleDotCom.url())\n```\n\n## API\n\n### aBURL(host: string, options: Options): ABURL\n\nCreates a new instance of `ABURL` with the given host and options.\n\n#### Host\n\nThe base URL.\nExample: `example.com`\n\n#### Options\n\nOptions is an object that can contain the following properties:\n\n```typescript\ntype Options = {\n  directories?: string[]\n  params?: Record<string, string | number>\n  encodeParams?: boolean\n  HTTPS?: boolean\n  www?: boolean\n  port?: number\n  auth?: {\n    username: string\n    password: string\n  }\n  subDomains?: string[]\n  fragment?: string\n}\n```\n\n- `directories` - An array of strings that represent the directories in the URL. Default is `[]`.\n- `params` - An object that contains key-value pairs that represent the URL parameters. Default is `{}`.\n- `encodeParams` - A boolean that determines if the URL parameters should be encoded. Default is `true`.\n- `HTTPS` - A boolean that determines if the URL should use HTTPS. Default is `true`.\n- `www` - A boolean that determines if the URL should use `www`. Default is `false`.\n- `port` - A number that represents the port number. Default is `undefined` which means no port is added.\n- `auth` - An object that contains the username and password for basic authentication. Default is `undefined` which means no authentication is added.\n- `subDomains` - An array of strings that represent the subdomains in the URL. Default is `[]`.\n- `fragment` - A string that represents the fragment in the URL. Default is `undefined` which means no fragment is added.\n\n### ABURL\n\nObject that represents a URL.\n\n```typescript\ntype ABURL = {\n  base: string\n  url(): string\n  updateParams(params: Record<string, string | number>): void\n  toUpdatedParams(params: Record<string, string | number>): ABURL\n  removeParams(params: string[]): void\n  toRemovedParams(params: string[]): ABURL\n  getDirectories(): string[]\n  getDirectoriesFlat(): string\n  getParams(): Record<string, string | number>\n  getParamsFlat(): string\n  useHTTPS(value: boolean): void\n  useWWW(value: boolean): void\n  setPort(port: number | undefined): void\n  setAuth(value: { username: string; password: string } | undefined): void\n  setSubDomains(subDomains: string[] | undefined): void\n  setFragment(fragment: string | undefined): void\n  options: Options\n}\n```\n\n- `base` - The base URL.\n- `url()` - Returns the full URL as a string.\n- `updateParams(params: Record<string, string | number>)` - Updates the URL parameters.\n- `toUpdatedParams(params: Record<string, string | number>)` - Returns a new instance of `ABURL` with updated URL parameters.\n- `removeParams(params: string[])` - Removes the URL parameters.\n- `toRemovedParams(params: string[])` - Returns a new instance of `ABURL` with removed URL parameters.\n- `getDirectories()` - Returns an array of strings that represent the directories in the URL.\n- `getDirectoriesFlat()` - Returns a string that represents the directories in the URL.\n- `getParams()` - Returns an object that contains key-value pairs that represent the URL parameters.\n- `getParamsFlat()` - Returns a string that represents the URL parameters.\n- `useHTTPS(value: boolean)` - Sets the URL to use HTTPS or HTTP.\n- `useWWW(value: boolean)` - Sets the URL to use `www` or not.\n- `setPort(port: number | undefined)` - Sets the port number.\n- `setAuth(value: { username: string; password: string } | undefined)` - Sets the basic authentication.\n- `setSubDomains(subDomains: string[] | undefined)` - Sets the subdomains.\n- `setFragment(fragment: string | undefined)` - Sets the fragment.\n- `options` - The options object that was used to create the instance of `ABURL`.\n\n### parseURL(url: string): ABURL\n\nTakes a URL string and returns the URL as an ABURL object.\n\n#### url\n\nA string that represents a URL.\n\n##### Warning: This function does not support URLs strings with http authentication.\n\n#### Example\n\n```typescript\nconst url =\n  'https://subDomain.example.com/api/v1/testing?firstName=John&lastName=Doe&age=25'\nconst parsedURL = parseURL(url)\n```\n\n## Change Log\n\n0.2.0 - Added `parseURL` function\n","readmeFilename":"README.md"}