{"name":"@cspell/strong-weak-map","publishConfig":{"access":"public"},"version":"8.9.1","description":"A Map with weakly referenced values.","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","license":"MIT","type":"module","sideEffects":false,"module":"dist/esm/index.js","exports":{".":{"import":"./dist/esm/index.js"}},"typings":"dist/esm/index.d.ts","scripts":{"build":"tsc -b . -f","build:esm":"tsc -p tsconfig.esm.json","watch":"tsc -b . -w -f","clean":"shx rm -rf dist temp coverage \"*.tsbuildInfo\"","clean-build":"pnpm run clean && pnpm run build","coverage":"pnpm run vitest run --coverage","test-watch":"pnpm vitest","test":"pnpm vitest run","vitest":"node --expose-gc ../../node_modules/vitest/vitest.mjs"},"repository":{"type":"git","url":"git+https://github.com/streetsidesoftware/cspell.git","directory":"packages/cspell-strong-weak-map"},"bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"engines":{"node":">=18"},"gitHead":"f532c77cca4bfae380293c586f02f377354c850b","_id":"@cspell/strong-weak-map@8.9.1","_nodeVersion":"18.20.3","_npmVersion":"lerna/3.5.1/node@v18.20.3+x64 (linux)","dist":{"integrity":"sha512-onD/UPJW7rBQrRDqYNvPUAoWoBp1G2g+mijAD7EkuseyAKTKlKz624rXpHUOTqI814owmhFMNSf2QyYy8gFM6Q==","shasum":"a29ecf62570e65c465714957fc8281c7c6958822","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-8.9.1.tgz","fileCount":7,"unpackedSize":10678,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBLAWgvAvwOoVl5kdfOuQihqe4naL4zlv54OfEtSXrMcAiEA7EH+AsfeQDD0EEpniuj/VwXtsCNocQsUjQgZJTfXEb8="}],"size":3645,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-8.9.1.tgz"},"_npmUser":{"name":"jason-dent","email":"jason@streetsidesoftware.nl"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strong-weak-map_8.9.1_1718892090698_0.8363842449287986"},"_hasShrinkwrap":false,"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":1718892090829,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1718892090829,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}