{"name":"@cspell/strong-weak-map","version":"6.19.2","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.19.2","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"227e693b65e1b15d24cbb3a559ffb48c21f1de79","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.19.2.tgz","fileCount":7,"integrity":"sha512-0P2f1JNGw+lEyqz0jxj1ob+772HgbQEIrXXuWF9vQXKdYx0kVzkSNVAUGZjqWiO+ieGFJVr0pqHA+wGcIx1VAQ==","signatures":[{"sig":"MEYCIQDSKs462+xW/ZX5Z8HLUEaKofn8t7HVQih9Qbb578CfXwIhAPVpdn6wKbnBj5VWOtI3qnM0w1BR8jE3chfvkz0/KeNr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10231,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxx2VACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqfqA//ZBIPC+v9+M9df3JM6kajNa/idxaaqEbNP5hiywlPR5HA5h3L\r\n8Jzy21a7RKOFVoicmCaDaPjyZpcaJ6SGv43YXZ66zdY4Y9J/GI+tjEM+MFpJ\r\nC+iNBvB1w9aiVAqtClX2frHA1XjxEVdqBvozWdfavbMWMnv2sjdCpdA8INnT\r\nbjmeveAMhVX71OhlUkcxMlMdzJHblzGK9w0EGqsBtplVxI9yHFhUzZK1BVGq\r\nLMth74Rd2g+RL3OFLLYY1q3vDgi7/q/z/xEQvZBdAGFKTv2Baogy7M0jfScu\r\njv+LLMbWkBlbhdYIMCVvhhQm4bC+SHfeRen1EjqzSgYjYrOtdqq2YAuIyrsD\r\nIDSBF0p94NoqUg0C/k3Mv6DrofpIykxfM/n2RLKD8XpqBA7wlaGD8LSsNM3K\r\nMNwJact2iiIpkHWLQQ/MVaOLFvK6JfO1qXmm3w7vv6uXK6skdS6LlgfwCnPy\r\npPsmVqSSJtthwmg23nY3m5LorcGVQbsy9asII3fFs1i68VkNpqDRWNBL317v\r\nEreeIEOql8MsfrEqcKH8MpSKtp1DzoRUhOtQkeeOFNUo7NQQq/Ts1R10Rr++\r\nS5big/VjBf3eUsA1y5KNe/g7Yho9GdUdmx0pWPLhyosE+iLDHKRRny1rz5tY\r\n18E4H+MuSYcnHeNM8vLuJwAfk+GFCHRJGbY=\r\n=L4zG\r\n-----END PGP SIGNATURE-----\r\n","size":3473,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.19.2.tgz"},"main":"dist/index.js","engines":{"node":">=14.6"},"exports":{".":{"require":"./dist/index.js"},"./index":"./dist/index.js","./index.js":"./dist/index.js","./index.d.ts":"./dist/index.d.ts"},"gitHead":"0413716934fdfde59971d24773e7df83623bb529","scripts":{"test":"node --expose-gc ../../node_modules/jest/bin/jest.js","build":"tsc -p .","clean":"shx rm -rf dist coverage .tsbuildinfo","watch":"tsc -p . -w","coverage":"node --expose-gc ../../node_modules/jest/bin/jest.js --coverage","test-watch":"node --expose-gc ../../node_modules/jest/bin/jest.js --watch","clean-build":"pnpm run clean && pnpm run build"},"typings":"dist/index.d.ts","_npmUser":{"name":"jason-dent","email":"jason@streetsidesoftware.nl"},"repository":{"url":"git+https://github.com/streetsidesoftware/cspell.git","type":"git"},"_npmVersion":"lerna/1.13.0/node@v16.19.0+x64 (linux)","description":"A Map with weakly referenced values.","directories":{"dist":"dist"},"_nodeVersion":"16.19.0","publishConfig":{"access":"public"},"typesVersions":{"*":{"*":["dist/*","dist/*/index.d.ts"],"index.d.ts":["dist/index.d.ts"],"dist/index.d.ts":["dist/index.d.ts"]}},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/strong-weak-map_6.19.2_1673993621251_0.30157217798065816","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":1673993621419,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1673993621419,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}