{"id":20894256,"url":"https://github.com/naverpaydev/nurl","last_synced_at":"2025-11-17T13:05:04.850Z","repository":{"id":259191589,"uuid":"835097366","full_name":"NaverPayDev/nurl","owner":"NaverPayDev","description":"Powerful URL manipulation library","archived":false,"fork":false,"pushed_at":"2025-11-17T08:04:41.000Z","size":374,"stargazers_count":13,"open_issues_count":4,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-11-17T08:23:34.270Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NaverPayDev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-29T06:45:17.000Z","updated_at":"2025-11-17T08:04:24.000Z","dependencies_parsed_at":"2024-11-08T07:21:11.502Z","dependency_job_id":"c925701a-307d-44bd-a639-0e2eb692081c","html_url":"https://github.com/NaverPayDev/nurl","commit_stats":null,"previous_names":["naverpaydev/nurl","naverpaydev2025/nurl"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/NaverPayDev/nurl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaverPayDev%2Fnurl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaverPayDev%2Fnurl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaverPayDev%2Fnurl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaverPayDev%2Fnurl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NaverPayDev","download_url":"https://codeload.github.com/NaverPayDev/nurl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaverPayDev%2Fnurl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284885670,"owners_count":27079126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-17T02:00:06.431Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T10:18:41.115Z","updated_at":"2025-11-17T13:05:04.805Z","avatar_url":"https://github.com/NaverPayDev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e@naverpay/nurl\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@naverpay/nurl\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@naverpay/nurl.svg?style=flat\" alt=\"npm version\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://bundlephobia.com/result?p=@naverpay/nurl\"\u003e\n    \u003cimg src=\"https://badgen.net/bundlephobia/minzip/@naverpay/nurl\" alt=\"minzipped size\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nNURL is a powerful URL manipulation library that extends the standard URL class. It provides dynamic segment processing and flexible URL creation capabilities.\n\n## Features\n\n- Extends and implements the URL class\n- Supports various URL creation methods (string, URL object, custom options object)\n- Provides a factory function NURL.create() for creating instances without the new keyword\n- Dynamic segment processing functionality\n- Setters behave differently from the standard URL\n- Provides decoded hostname for IDN (Internationalized Domain Names) support\n\n## Usage\n\n### Basic Usage\n\n```javascript\nimport { NURL } from 'nurl'\n\n// Create URL from string\nconst url1 = new NURL('https://example.com/users/123?name=John')\n\n// Create URL from existing URL object\nconst standardUrl = new URL('https://example.com')\nconst url2 = new NURL(standardUrl)\n\n// Create URL from custom options object\nconst url3 = new NURL({\n  baseUrl: 'https://example.com',\n  pathname: '/users/:id',\n  query: { id: '123', name: 'John' }\n})\n\n// Create empty URL\nconst url4 = new NURL()\n\n// Using the factory function\nconst url5 = NURL.create('https://example.com')\n\n// The factory function also works with options object\nconst url6 = NURL.create({\n  baseUrl: 'https://example.com',\n  pathname: '/users/:id',\n  query: { id: '123', name: 'John' }\n})\n```\n\n### Dynamic Segment Processing\n\nNURL processes dynamic segments in the pathname and replaces them with values from the query object. If a dynamic segment doesn't have a corresponding query value, it remains unchanged in the pathname without any encoding:\n\n```javascript\nconst url = new NURL({\n  baseUrl: 'https://api.example.com',\n  pathname: '/users/:a/posts/[b]/[c]',\n  query: {\n    a: '123',\n    b: '456',\n    format: 'json'\n  }\n})\n\nconsole.log(url.href)\n// Output: https://api.example.com/users/123/posts/456/[c]?format=json\n```\n\n### IDN Support\n\nNURL automatically handles Internationalized Domain Names:\n\n```javascript\nconst url = new NURL('https://한글.도메인')\nconsole.log(url.hostname) // xn--bj0bj06e.xn--hq1bm8jm9l\nconsole.log(url.decodedHostname) // 한글.도메인 (in human-readable format)\n```\n\n## API\n\n### `constructor(input?: string | URL | URLOptions)`\n\n- `input`: Can be one of the following:\n  - `string`: Standard URL string\n  - `URL`: Standard URL object\n  - `URLOptions`: Custom options object that extends `Partial\u003cURL\u003e` and includes:\n    - `baseUrl?: string`: Optional base URL string\n    - `query?: Record\u003cstring, string\u003e`: Optional object for query parameters\n    - Can include any property from the standard URL object (e.g., `pathname`, `protocol`, etc.)\n\n### Dynamic Segments\n\n- Supports `:paramName` or `[paramName]` format in the pathname.\n- If a corresponding key exists in the query object or URLOptions, the dynamic segment is replaced with its value.\n- If a corresponding key does not exist, the dynamic segment remains unchanged in the pathname without throwing an error.\n\n### Properties\n\nNURL inherits all properties from the standard URL class:\n\n- `href`, `origin`, `protocol`, `username`, `password`, `host`, `hostname`, `port`, `pathname`, `search`, `searchParams`, `hash`\n\n### Methods\n\n- `toString()`: Returns the URL as a string\n- `toJSON()`: Returns the URL as a JSON representation\n\n## Important Notes\n\n1. NURL's setter methods behave differently from the standard URL. They are designed to consider dynamic segment and query parameter replacement functionality.\n2. When created with no arguments, all properties are initialized as empty strings.\n3. When using `URLOptions`, if a query value corresponding to a dynamic segment is missing, the dynamic segment remains unchanged in the pathname.\n4. Dynamic segments only support the `:paramName` or `[paramName]` format.\n\n## Differences from Standard URL\n\n1. **Constructor Flexibility**: NURL can create a URL from a string, URL object, or custom options object.\n2. **Empty URL Creation**: NURL can create an empty URL when called with no arguments.\n3. **Dynamic Segments**: NURL supports dynamic segments in the pathname.\n4. **Setter Behavior**: NURL's setter methods behave differently from the standard URL, considering dynamic segment processing and query parameter replacement.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaverpaydev%2Fnurl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaverpaydev%2Fnurl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaverpaydev%2Fnurl/lists"}