{"id":16125711,"url":"https://github.com/dy/primitive-pool","last_synced_at":"2025-06-15T14:39:18.369Z","repository":{"id":57330405,"uuid":"138430419","full_name":"dy/primitive-pool","owner":"dy","description":"Get unique object for a primitive value to store primitives in WeakMap etc.","archived":false,"fork":false,"pushed_at":"2023-02-17T17:53:59.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-11T13:16:12.268Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dy.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-23T20:11:30.000Z","updated_at":"2023-03-08T04:08:15.000Z","dependencies_parsed_at":"2023-02-19T18:01:05.266Z","dependency_job_id":null,"html_url":"https://github.com/dy/primitive-pool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dy/primitive-pool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fprimitive-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fprimitive-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fprimitive-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fprimitive-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dy","download_url":"https://codeload.github.com/dy/primitive-pool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dy%2Fprimitive-pool/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259991224,"owners_count":22942587,"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","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-10-09T21:30:53.541Z","updated_at":"2025-06-15T14:39:18.326Z","avatar_url":"https://github.com/dy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# primitive-pool [![unstable](https://img.shields.io/badge/stability-unstable-green.svg)](http://github.com/badges/stability-badges) [![Build Status](https://img.shields.io/travis/dy/primitive-pool.svg)](https://travis-ci.org/dy/primitive-pool)\n\nGet object for a primitive value. Useful to make WeakMap store strings/numbers and other primitives.\n\n## Usage\n\n[![npm install primitive-pool](https://nodei.co/npm/primitive-pool.png?mini=true)](https://npmjs.org/package/primitive-pool/)\n\n\n```js\nimport p from 'primitive-pool'\n\nlet map = new WeakMap()\n\nmap.set(p('abc'), 123)\nmap.get(p('abc')) // 123\n\nmap.set(p(null), 789)\nmap.get(p(null)) // 789\n\nmap.set(p(123), 'abc')\nmap.get(p(123)) // 'abc'\n\n// non-primitives are stored as is\nlet a = {}\nmap.set(p(a), 'xyz')\nmap.get(a) // 'xyz'\n```\n\n## Alternatives\n\n* [weak-value](https://github.com/WebReflection/weak-value)\n* [not-so-weak](https://github.com/WebReflection/not-so-weak)\n* [weakish-map](https://github.com/lamansky/weakish-map)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdy%2Fprimitive-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdy%2Fprimitive-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdy%2Fprimitive-pool/lists"}