{"id":22010475,"url":"https://github.com/virtualstate/composite-key","last_synced_at":"2026-04-09T21:14:06.753Z","repository":{"id":57750032,"uuid":"524621807","full_name":"virtualstate/composite-key","owner":"virtualstate","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-14T09:29:10.000Z","size":259,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-04T11:56:22.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/virtualstate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-14T09:07:26.000Z","updated_at":"2023-05-21T22:42:22.000Z","dependencies_parsed_at":"2022-08-26T08:31:27.312Z","dependency_job_id":null,"html_url":"https://github.com/virtualstate/composite-key","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/virtualstate/composite-key","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtualstate%2Fcomposite-key","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtualstate%2Fcomposite-key/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtualstate%2Fcomposite-key/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtualstate%2Fcomposite-key/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/virtualstate","download_url":"https://codeload.github.com/virtualstate/composite-key/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtualstate%2Fcomposite-key/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267985324,"owners_count":24176438,"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-07-31T02:00:08.723Z","response_time":66,"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-30T02:13:13.589Z","updated_at":"2026-04-09T21:14:06.708Z","avatar_url":"https://github.com/virtualstate.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `@virtualstate/composite-key`\n\n[compositeKey \u0026 compositeSymbol](https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey) implementation\n\n[//]: # (badges)\n\n### Support\n\n ![Node.js supported](https://img.shields.io/badge/node-%3E%3D16.0.0-blue) ![Deno supported](https://img.shields.io/badge/deno-%3E%3D1.17.0-blue) ![Bun supported](https://img.shields.io/badge/bun-%3E%3D0.1.8-blue) \n\n### Test Coverage\n\n ![100%25 lines covered](https://img.shields.io/badge/lines-100%25-brightgreen) ![100%25 statements covered](https://img.shields.io/badge/statements-100%25-brightgreen) ![100%25 functions covered](https://img.shields.io/badge/functions-100%25-brightgreen) ![100%25 branches covered](https://img.shields.io/badge/branches-100%25-brightgreen)\n\n[//]: # (badges)\n\n## Usage \n\nAllows for multiple values to be \"joined\" together and used as a single key.\n\n## `compositeKey`\n\nReturns a frozen object that can be used as a reference in place of the original arguments\n\nThe object can be used as a key in a WeakMap, or Map. The object can also be used in a WeakSet.\n\n```typescript\nimport { compositeKey } from \"@virtualstate/composite-key\";\n\nconst map = new WeakMap();\n\nconst array = [1, 2, 3];\n\nmap.set(compositeKey(array, 1), \"Value\");\n\nmap.get(compositeKey(array, 1)); // \"Value\"\nmap.get(compositeKey(array, 2)); // undefined\n```\n\n## `compositeSymbol`\n\nReturns a symbol that can be used as a reference in place of the original arguments. \n\nThe symbol can be used in most places, including keys of objects, and Maps. The symbol can also be used in a Set. \n\n```typescript\nimport { compositeSymbol } from \"@virtualstate/composite-key\";\n\nconst map = new Map();\n\nconst array = [1, 2, 3];\n\nmap.set(compositeSymbol(array, 1), \"Value\");\n\nmap.get(compositeSymbol(array, 1)); // \"Value\"\nmap.get(compositeSymbol(array, 2)); // undefined\n```\n\n## `createCompositeKey`\n\nCreates an isolated version of `compositeKey`\n\n```typescript\nimport { createCompositeKey } from \"@virtualstate/composite-key\";\n\nconst compositeKey = createCompositeKey();\n\nconst array = [1, 2, 3];\ncompositeKey(array, 1); // An object\n```\n\n\n## `createCompositeSymbol`\n\nCreates an isolated version of `compositeSymbol`\n\n```typescript\nimport { createCompositeSymbol } from \"@virtualstate/composite-key\";\n\nconst compositeSymbol = createCompositeSymbol();\n\nconst array = [1, 2, 3];\ncompositeSymbol(array, 1); // A symbol\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirtualstate%2Fcomposite-key","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirtualstate%2Fcomposite-key","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirtualstate%2Fcomposite-key/lists"}