{"_id":"@adaskothebeast/http-params-processor-key-custom-delimiter","_rev":"4-f14c98bc37dbf6030f1bb3bcf60340ba","name":"@adaskothebeast/http-params-processor-key-custom-delimiter","dist-tags":{"latest":"12.0.0"},"versions":{"10.0.0":{"name":"@adaskothebeast/http-params-processor-key-custom-delimiter","version":"10.0.0","_id":"@adaskothebeast/http-params-processor-key-custom-delimiter@10.0.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"dist":{"shasum":"b4ed5fdceb5ce7dc498320207e1d565d8e665373","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-key-custom-delimiter/-/http-params-processor-key-custom-delimiter-10.0.0.tgz","fileCount":15,"integrity":"sha512-FRjFvDgSgRgBzyRDYAA2D1obGmCct0kdRkM0ddWaWZUtroAq+tavH+vHJiEqwzTKYXjuj4mF5RcnsYwEjWIj3A==","signatures":[{"sig":"MEYCIQDl99RxBmkKSAuS1ErokWUkapozHDPck1Tq/hwXQ/H+wwIhAOmH/7AoUe9vycURP91e4OxHeZNRvTSno4I1s8KSHLRD","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28776},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"1e61d6323f67038b9af916e4f3d263a73fe76497","_npmUser":{"name":"adasko","email":"adaskothebeast@gmail.com"},"_npmVersion":"11.6.2","description":"> Transform complex TypeScript objects into query parameters for Angular, Axios, Fetch, and more","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"peerDependencies":{"@adaskothebeast/http-params-processor-core":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-key-custom-delimiter_10.0.0_1768077125584_0.04938432861339748","host":"s3://npm-registry-packages-npm-production"}},"11.0.0":{"name":"@adaskothebeast/http-params-processor-key-custom-delimiter","version":"11.0.0","author":{"url":"https://github.com/adaskothebeast","name":"Adam Pluciński","email":"adaskothebeast@gmail.com"},"license":"MIT","_id":"@adaskothebeast/http-params-processor-key-custom-delimiter@11.0.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"dist":{"shasum":"c94dd05dcb7fb06cc34acebb8f73e3752b0811c1","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-key-custom-delimiter/-/http-params-processor-key-custom-delimiter-11.0.0.tgz","fileCount":8,"integrity":"sha512-042WxhomvV+gNkuX5mSMBWwhUJQGnw5KDj9Tgl9Gfz+dsSCiqmfvpNPU0fLYDAIhseY5gvLddm0MN3w/Fv+NQg==","signatures":[{"sig":"MEQCID64uNAVEv4M1vHaoveu+tDmSw43n5e0xH64l3ceANcNAiAJXD1zqg6fM94VnifzqDzaXF0bNVaN7Nx1sQErTHqkqQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@adaskothebeast%2fhttp-params-processor-key-custom-delimiter@11.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":39910},"main":"./index.cjs","type":"module","types":"./index.d.ts","module":"./index.js","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.cjs"},"./package.json":"./package.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d40917cc-bf7a-4eec-9d5d-9e73011b3627"}},"repository":{"url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git","type":"git"},"_npmVersion":"11.6.2","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-key-custom-delimiter_11.0.0_1768758177081_0.25061383137729387","host":"s3://npm-registry-packages-npm-production"}},"11.1.0":{"name":"@adaskothebeast/http-params-processor-key-custom-delimiter","version":"11.1.0","author":{"url":"https://github.com/adaskothebeast","name":"Adam Pluciński","email":"adaskothebeast@gmail.com"},"license":"MIT","_id":"@adaskothebeast/http-params-processor-key-custom-delimiter@11.1.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"dist":{"shasum":"74d4f69e1c43125f1574c4957b4b896b002fe4be","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-key-custom-delimiter/-/http-params-processor-key-custom-delimiter-11.1.0.tgz","fileCount":8,"integrity":"sha512-9/B7M9Qv8Q9yXmB5CP8VCS2wTTRQ7+6bBY823uLGMO/SL8Fxk3n0humGXexxnJZxHNSM2FXqefGJWkEfi0UcHQ==","signatures":[{"sig":"MEUCIEiETU1SZnXeh56wnwSS7Cx+yPgnDioiNAiUg4HFlrb7AiEAtcPMMU5PBZC2PHZWYZkpggZMD8R9yGlOicTfRrgHRW4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@adaskothebeast%2fhttp-params-processor-key-custom-delimiter@11.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":39910},"main":"./index.cjs","type":"module","types":"./index.d.ts","module":"./index.js","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.cjs"},"./package.json":"./package.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d40917cc-bf7a-4eec-9d5d-9e73011b3627"}},"repository":{"url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git","type":"git"},"_npmVersion":"11.6.2","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-key-custom-delimiter_11.1.0_1768758925925_0.7610859275125097","host":"s3://npm-registry-packages-npm-production"}},"12.0.0":{"name":"@adaskothebeast/http-params-processor-key-custom-delimiter","version":"12.0.0","description":"Custom delimiter key formatting strategy for HttpParamsProcessor, for bespoke backend query parameter notations.","keywords":["http","http-params","query-string","query-params","querystring","nested-objects","serializer","typescript","key-formatting","custom-delimiter","delimiter"],"license":"MIT","author":{"name":"Adam Pluciński","email":"adaskothebeast@gmail.com","url":"https://github.com/adaskothebeast"},"repository":{"type":"git","url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git"},"bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","type":"module","sideEffects":false,"main":"./index.cjs","module":"./index.js","types":"./index.d.ts","peerDependencies":{"@adaskothebeast/http-params-processor-core":"^12.0.0"},"exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.cjs"},"./package.json":"./package.json"},"gitHead":"73d31a6c26a6f2819f6c98aabb36659532e4cdd0","_id":"@adaskothebeast/http-params-processor-key-custom-delimiter@12.0.0","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-oGeMCQ6wAmNBFLxQI12LCLOBqgOUyhqlrH2C5K2rAJUZ0DAnv+cJh6F81baziOGL8BbJ2kYqcXizOdmH009BRg==","shasum":"270d4f9e80cf17e447994aca4464498671e9bd51","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-key-custom-delimiter/-/http-params-processor-key-custom-delimiter-12.0.0.tgz","fileCount":9,"unpackedSize":14922,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDwwm3fxpGmTPOzy3FBD6C0brAEbj2cHwpT8AsqrF5PXwIhALAugnR+6zQqh4eRzlZmfe5L9RR6YGwuGpToIqwtI2fb"}]},"_npmUser":{"name":"adasko","email":"adaskothebeast@gmail.com"},"directories":{},"maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/http-params-processor-key-custom-delimiter_12.0.0_1785235940490_0.649948399879761"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-10T20:32:05.496Z","modified":"2026-07-28T10:52:20.867Z","10.0.0":"2026-01-10T20:32:05.733Z","11.0.0":"2026-01-18T17:42:57.222Z","11.1.0":"2026-01-18T17:55:26.075Z","12.0.0":"2026-07-28T10:52:20.638Z"},"bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"author":{"name":"Adam Pluciński","email":"adaskothebeast@gmail.com","url":"https://github.com/adaskothebeast"},"license":"MIT","homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","repository":{"type":"git","url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git"},"maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"readme":"# ✂️ @adaskothebeast/http-params-processor-key-custom-delimiter\n\n**Bring your own delimiter to [HttpParamsProcessor](https://github.com/AdaskoTheBeAsT/HttpParamsProcessor): `user:name`, `user->name`, `api/users`, with brackets or the same delimiter for arrays.**\n\n[![npm](https://img.shields.io/npm/v/%40adaskothebeast%2Fhttp-params-processor-key-custom-delimiter?color=cb3837&logo=npm)](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-key-custom-delimiter)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n\nNo runtime dependency beyond `core` (its only peer dependency, `^12.0.0`). ESM + CJS. `sideEffects: false`.\n\n---\n\n## 📦 Install\n\n```bash\nnpm i @adaskothebeast/http-params-processor-key-custom-delimiter @adaskothebeast/http-params-processor-core\n```\n\n---\n\n## 🎯 What it does\n\nThis is a **key formatting strategy**: it decides how nested keys are spelled while `ParamsProcessor` walks your object graph. Object properties are joined with a delimiter **you** choose (default `':'`), while array elements keep bracket indices unless you ask for the delimiter there too. It exists for bespoke or legacy APIs whose notation does not match dots, brackets, Rails or flat underscores.\n\n| Input                        | `DefaultKeyFormattingStrategy` (core) | This strategy (defaults)   |\n| ---------------------------- | ------------------------------------- | -------------------------- |\n| `{ user: { name: 'John' } }` | `p.user.name`                         | `p:user:name`              |\n| `{ items: ['a', 'b'] }`      | `p.items[0]`, `p.items[1]`            | `p:items[0]`, `p:items[1]` |\n| `{ arr: [{ id: '1' }] }`     | `p.arr[0].id`                         | `p:arr[0]:id`              |\n\n---\n\n## 🧰 API\n\n### `CustomDelimiterKeyFormattingStrategy`\n\nImplements `IKeyFormattingStrategy` from `core`.\n\n| Member                                                                     | Returns  | Result                                                                           |\n| -------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------- |\n| `new CustomDelimiterKeyFormattingStrategy(objectDelimiter?, arrayFormat?)` | -        | Defaults: `':'` and `'bracket'`                                                  |\n| `formatObjectKey(parentKey, propertyKey)`                                  | `string` | `` `${parentKey}${objectDelimiter}${propertyKey}` ``                             |\n| `formatArrayKey(parentKey, index)`                                         | `string` | `` `${parentKey}[${index}]` `` or `` `${parentKey}${objectDelimiter}${index}` `` |\n\nConstructor parameters:\n\n| Parameter         | Type                       | Default     | Meaning                                                     |\n| ----------------- | -------------------------- | ----------- | ----------------------------------------------------------- |\n| `objectDelimiter` | `string`                   | `':'`       | Inserted between a parent key and a property name           |\n| `arrayFormat`     | `'bracket' \\| 'delimiter'` | `'bracket'` | `'bracket'` keeps `items[0]`, `'delimiter'` emits `items:0` |\n\n`transformComplexObject` is not implemented, so nested objects and arrays are always traversed down to primitives.\n\n---\n\n## ⚡ Usage\n\n```ts\nimport { ParamsProcessor } from '@adaskothebeast/http-params-processor-core';\nimport { CustomDelimiterKeyFormattingStrategy } from '@adaskothebeast/http-params-processor-key-custom-delimiter';\n\nconst processor = new ParamsProcessor({\n  keyFormatter: new CustomDelimiterKeyFormattingStrategy(),\n});\n\nprocessor.process('p', {\n  user: { name: 'John', profile: { email: 'john@example.com' } },\n  items: ['a', 'b'],\n});\n// [\n//   ['p:user:name', 'John'],\n//   ['p:user:profile:email', 'john@example.com'],\n//   ['p:items[0]', 'a'],\n//   ['p:items[1]', 'b'],\n// ]\n```\n\nThe same `keyFormatter` option is accepted by every adapter (`-angular`, `-angular-resource`, `-fetch`, `-axios`, `-react-tanstack-query`, `-react-swr`), because they all forward their options object to `ParamsProcessor`.\n\n---\n\n## 🎛️ Options and configuration\n\n```ts\nnew CustomDelimiterKeyFormattingStrategy(); // ':' + brackets\nnew CustomDelimiterKeyFormattingStrategy('->'); // user->name, items[0]\nnew CustomDelimiterKeyFormattingStrategy('/'); // api/users, api/users[0]\nnew CustomDelimiterKeyFormattingStrategy(':', 'delimiter'); // user:name, items:2\n```\n\n| Constructor arguments | `user` + `name` | `items` + `2`  |\n| --------------------- | --------------- | -------------- |\n| _(none)_              | `user:name`     | `items[2]`     |\n| `'->'`                | `user->name`    | `items[2]`     |\n| `'/'`                 | `api/users`     | `api/users[2]` |\n| `':', 'delimiter'`    | `user:name`     | `items:2`      |\n| `'.', 'delimiter'`    | `user.name`     | `items.2`      |\n\n`'delimiter'` mode reuses `objectDelimiter` for indices, so array elements and object properties become indistinguishable in the key - pick it only when your backend does not need to tell them apart (or when it splits on the delimiter and infers arrays from numeric segments).\n\nThe strategy is stateless, so a single instance can be shared, and `keyFormatter` can also be passed per call to override the processor default.\n\n---\n\n## 📤 Output examples\n\n```ts\nconst processor = new ParamsProcessor({\n  keyFormatter: new CustomDelimiterKeyFormattingStrategy(':', 'delimiter'),\n});\n\nprocessor.process('p', { arr: [{ id: '1', innerArr: [{ id: '1.1' }] }] });\n```\n\n```text\np:arr:0:id                = 1\np:arr:0:innerArr:0:id     = 1.1\n```\n\n```ts\nconst arrow = new ParamsProcessor({\n  keyFormatter: new CustomDelimiterKeyFormattingStrategy('->'),\n});\n\narrow.process('p', { user: { name: 'John' }, items: ['a'] });\n// [['p->user->name', 'John'], ['p->items[0]', 'a']]\n\narrow.toQueryString('p', { user: { name: 'John' } });\n// p-%3Euser-%3Ename=John\n```\n\n---\n\n## ⚠️ Edge cases\n\n- **Delimiters are percent encoded** by `toQueryString` and `toURLSearchParams`: `':'` becomes `%3A`, `'/'` becomes `%2F`, `'->'` becomes `-%3E`. `process` returns raw keys, so if the backend must literally see `:` or `/`, build the URL yourself from `process` output (both characters are legal unencoded in a query component).\n- The delimiter is inserted verbatim, with no escaping. If a property name contains the delimiter, the key becomes ambiguous - the same collision risk as [`-key-flat`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-key-flat).\n- An **empty root key** produces a leading delimiter (`process('', { user: 1 })` gives `:user`). Pass a real root name.\n- In `'bracket'` mode array keys are always `[index]`, independent of `objectDelimiter`; there is no way to get empty brackets (`items[]`) - use [`-key-rails`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-key-rails) for that.\n- `arrayFormat` accepts only `'bracket'` and `'delimiter'`; any other value is rejected by TypeScript, and at runtime anything other than `'bracket'` behaves as `'delimiter'`.\n- Numeric object property keys are formatted like properties, not indices: with defaults, `formatObjectKey('data', '0')` gives `data:0` while `formatArrayKey('data', 0)` gives `data[0]`.\n- `null`/`undefined` values, `$type` discriminators, empty objects and empty arrays are dropped by `core` before this strategy is consulted; circular references throw `Error: Circular reference detected at key: <key>`.\n\n---\n\n## 🔗 Related packages\n\n- Fixed notations: [`-key-bracket-notation`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-key-bracket-notation) (`user[name]`), [`-key-rails`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-key-rails) (`items[]`), [`-key-flat`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-key-flat) (`user_name`, one separator everywhere)\n- Single parameter: [`-key-json`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-key-json)\n- Engine: [`-core`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-core) (implement `IKeyFormattingStrategy` yourself if even this is not flexible enough)\n\nFull matrix and adapter recipes: [main README](https://github.com/AdaskoTheBeAsT/HttpParamsProcessor#readme).\n\n---\n\n## 📄 License\n\n[MIT](./LICENSE) © Adam Pluciński\n","readmeFilename":"README.md","description":"Custom delimiter key formatting strategy for HttpParamsProcessor, for bespoke backend query parameter notations.","keywords":["http","http-params","query-string","query-params","querystring","nested-objects","serializer","typescript","key-formatting","custom-delimiter","delimiter"]}