{"name":"@cspell/strong-weak-map","version":"8.13.0","keywords":["Map","WeakMap","Weak","Values"],"author":"Jason Dent <jason@streetsidesoftware.nl>","license":"MIT","_id":"@cspell/strong-weak-map@8.13.0","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"3500511e3031c7429283f74a0e93d4348d901d01","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-8.13.0.tgz","fileCount":7,"integrity":"sha512-+SvzzupsnKm6+OfK8t2KL2uY0RzTDhjTVEaEIug8IgwlHSf4waYgQ2MJ4ZJPww7OvNEcBmUAeh6Z1+cwiqMycQ==","signatures":[{"sig":"MEUCIEysGP76ZXZqvN0WoA10l/n+Ah1BEIJhCn0CxiInf9pzAiEAwHdpjzQvze2kEJ9W3jt2s8i7rOvpqBfPt8pwLKbbETQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10694,"size":3657,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-8.13.0.tgz"},"type":"module","module":"dist/esm/index.js","engines":{"node":">=18"},"exports":{".":{"import":"./dist/esm/index.js"}},"gitHead":"2fd3fb430cc96a8a50543f57d96b288219a11923","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":"jason-dent","email":"jason@streetsidesoftware.nl"},"repository":{"url":"https://github.com/streetsidesoftware/cspell.git","type":"git","directory":"packages/cspell-strong-weak-map"},"_npmVersion":"lerna/3.7.1/node@v18.20.4+x64 (linux)","description":"A Map with weakly referenced values.","directories":{},"sideEffects":false,"_nodeVersion":"18.20.4","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/strong-weak-map_8.13.0_1722339719733_0.12374614585940158","host":"s3://npm-registry-packages"},"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":1722339719868,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1722339719868,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}