{"name":"@cspell/strong-weak-map","version":"10.3.1","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@10.3.1","maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"60fc17467150935aa935a5a2aec38a163ffd7bd5","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-10.3.1.tgz","fileCount":7,"integrity":"sha512-Bwe3+1GyKN1BcfdDsWW53ujWxUqn6onNAKJ6hIXaZCTAS/ZLMcoYP7fJQko/syEGerOvbcSgdCkXfahrM2dRfA==","signatures":[{"sig":"MEUCIQC8o9JU+bX7cyZ0OZK+1trYzMx9vFU6bHMnG2FatKWoEwIgLMq/1PXtrr1PSlCLK5NgHEMz3hcJZuu75Pz/5lkqz+o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIFUag3dNjsCrDLX2jN2JII4wZT0L3KWHNy6ItnFM2HH/AiB5Szr2QhI9VlKIxF7IXFIzt1U91YtoBnfplF6iyN+dnw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cspell%2fstrong-weak-map@10.3.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":10725,"size":3675,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-10.3.1.tgz"},"type":"module","module":"dist/esm/index.js","engines":{"node":">=22.18.0"},"exports":{".":{"import":"./dist/esm/index.js"}},"gitHead":"793953d1c2b4f1cab257389ff6ecb3ae2dd40230","scripts":{"test":"pnpm vitest run","build":"tsc -b . -f","clean":"shx rm -rf dist temp coverage \"*.tsbuildInfo\"","watch":"tsc -b . -w -f","vitest":"node --expose-gc ../../node_modules/vitest/vitest.mjs --pool threads","coverage":"pnpm run vitest run --coverage","build:esm":"tsc -p tsconfig.esm.json","test-watch":"pnpm vitest","clean-build":"pnpm run clean && pnpm run build"},"typings":"dist/esm/index.d.ts","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:a6ea33b9-8939-48f7-beed-e8243af58035"}},"repository":{"url":"git+https://github.com/streetsidesoftware/cspell.git","type":"git","directory":"packages/cspell-strong-weak-map"},"_npmVersion":"lerna/5.6.1/node@v24.20.0+x64 (linux)","description":"A Map with weakly referenced values.","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/strong-weak-map_10.3.1_1789312637559_0.0006914212068842573","host":"s3://npm-registry-packages-npm-production"},"readme":"# `@cspell/strong-weak-map`\n\nA Map with weakly referenced values.\n\nJavaScript [WeakMap](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) provides weak keys and strong values.\n\n`StrongWeakMap` allows for strong keys and weak values while providing the same API as [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).\n\n## Install\n\n```sh\nnpm install -S @cspell/strong-weak-map\n```\n\n## Usage\n\nTypeScript Example: Simple text file reader.\n\n```ts\nimport { StrongWeakMap } from '@cspell/strong-weak-map';\nimport { promises as fs } from 'fs';\n\nconst cache = new StrongWeakMap<string, Promise<string>>();\n\nexport function readTextFile(filename: string, encoding: BufferEncoding = 'utf8'): Promise<string> {\n  const cached = cache.get(filename);\n  if (cached) return cached;\n\n  const content = fs.readFile(filename, encoding);\n\n  cache.set(filename, content);\n\n  return content;\n}\n```\n\nThe above example will reuse the promise as long as it has not been cleaned up by the Garbage Collector.\n\n## API\n\nSee: [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)\n\n<!--- @@inject: ../../static/footer.md --->\n\n<br/>\n\n---\n\n<p align=\"center\">Brought to you by<a href=\"https://streetsidesoftware.com\" title=\"Street Side Software\"><img width=\"16\" alt=\"Street Side Software Logo\" src=\"https://i.imgur.com/CyduuVY.png\" /> Street Side Software</a></p>\n\n<!--- @@inject-end: ../../static/footer.md --->\n","publish_time":1789312637637,"_cnpm_publish_time":1789312637637,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}