{"name":"@cspell/strong-weak-map","version":"6.16.0","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.16.0","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"0923b111dbc396385a274abde546fe88ca01ef63","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.16.0.tgz","fileCount":7,"integrity":"sha512-2vA+r/yQ+oLY9tnZIXJwhKjCDeosWBrfgb1ea1eJ2LpXb3AS8IRP60wnqYbK9FNqqdPZIt98/LYJ/EZN23SmLQ==","signatures":[{"sig":"MEQCIHsXRrEfVqQfRVvibHYQxmSDAu1WQp5Q/As+NE+jcRRqAiARKeaxXyFFewFkZs/wsJBWuk95d4iyx7viR4lrp+j5Ag==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10227,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjif/RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmroLA//eUdAC67dlKfAdVo7JnV18BI3EQ8x/3AOo4AM3Iii20ga9JJ4\r\nBfMRgJaqDsGPsnzkLczryn8C37+rd+ogJ3fk7c0KjT7VZK0Eij3wLzkAb7r4\r\nVE9fe97K9yJct6SKaXPaRYsyOx4F+kFRpWMiBN33nN6zif25v/pTcwYqCo2T\r\nUQLWe2JHQJik2fzuWpe+hC2rlgMf8kxp05c+Hk0XLBy7RMRry5H3A8kcqnhm\r\nDs906cJXkOPQRDbq31x7pSw37RbkuE0QtEN8V48DniHdnctTNLD2wBQKiZgZ\r\noRCexa5ZkZHjctRjZaPVfzZ9rYSW3ywz9PpgXhmrXLsRTlem7y4dReCcqR8O\r\n6muK8p4Ezfd82hmMEFYhWHgj4+MXkuhU7smSnMUS3i5wwRlOGNJgyOardlz8\r\nirztSo7Fu7BkXKiRtRfXj1N3LeC+Q1ciuRlVGBN5G0id9wNqYXaopsEXSM+5\r\nrujgM1dlOT6E42/nNGHDk4IrMGsoQjZOtgOZGKVL2cXyhSSgIQtrccDqgPnX\r\na/O4Nj9Ijje+sJSeNP9IbXygxWXjM/2cGQN2wvZB5tatVqQ99fM/9liSrvm1\r\nAFNhXBEwNg+ZDSQdQx4Jf8hh4n4Ts0TewGHkyaT2Le2VX4kP8QNxAxbY07kQ\r\nppDTFt2u6VUkalPKnGm3g6uCNEksGSd6Jrw=\r\n=HEIa\r\n-----END PGP SIGNATURE-----\r\n","size":3470,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.16.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":"57280b1b76f781a9bd5de03c3cee06a8826313df","scripts":{"test":"node --expose-gc ../../node_modules/jest/bin/jest.js","build":"tsc -p .","clean":"rimraf 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.18.1+x64 (linux)","description":"A Map with weakly referenced values.","directories":{"dist":"dist"},"_nodeVersion":"16.18.1","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.16.0_1669988305267_0.12085963236858466","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":1669988305400,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1669988305400,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}