{"name":"@cspell/strong-weak-map","version":"6.22.0","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.22.0","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"53e498a320cd10a3dcee99e2f92c1ce5475a9999","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.22.0.tgz","fileCount":7,"integrity":"sha512-Krfq5P+s9R1qH3hvhMC40SsU49v6/qGvvPP1kGwToAHEDDGVyRA9xgz/RswDThgEzpzwMuOGzjZlQ3P3luHnug==","signatures":[{"sig":"MEUCIGCQz5gra0+p8PaUenbebnryOP2UKi1Plt9QAhcVEQjUAiEA5dnMOMxEpmRb7eXW0irzwURFp4dUQ8eO7z6qyRaPoV4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10566,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj37fhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrnAQ//dYoFGNkqWiY9TZylfDSDby3FHB6uZ/UpPKgsOqz0d87bYRoi\r\nmUEEFhSk6d75mMgoRwvWh24PtHNLYzCD3nD6/9bm3PTubAzxnylDFbGwiTlS\r\nLKmdM6XQzPsNb1BB0h/REAuyuy+iKTZGP+i5p290XJzPMAayOm8JuYCWQ9W9\r\nHh1MCkOMr27/ZMJ5vbfY949DxQfprV8Ns9LQXQlcgoC3P5ROt52Z7fVPB4aR\r\navb3NpIH9nTb05oIojE/rYPC1gwz8RdWuC+35rM0xts7i91D7eC9iKKBLTDh\r\n0gchBidDMVkj8nALh8eK2Ywcdyn9WQiWWn6T914arytreq36nzcA9/OhcM8j\r\nB/ZNglnLKOI8AL+m8x2lpj136jb+fqXnlmjw5hNwL0rrlYyLr7fDInmlzCjI\r\nUwS0nB8lQqVMnD8RkwkiAgH5UFsmXD1mPLWXeMNxdMYnSLKrT3YhJ01vUwrj\r\nUAvFcRFmTDdntFgWyM4venhQ/uWf/q2EF8VpTw+u47rN2bPTPp4EMk9ct9OP\r\n8rSMT56eZYtphDg0lLK3aSZ8n3rxWBLpjIQnq3JwKf54oKtEKIkItPGxsqRl\r\nV4gibPAx9Pr4umIL4L0aDHZrX0VOk0zTlHI4SIHcGmvj1qnWXNw72rb/eyyP\r\nQ86qf1npcajIxr3Q80DpwPWNdbabQsFDs10=\r\n=s51s\r\n-----END PGP SIGNATURE-----\r\n","size":3627,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.22.0.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":"a133874ed7590cbe140f5067cfa80db84b644a5d","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.15.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.22.0_1675605985421_0.41100247774177867","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":1675605985602,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1675605985602,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}