{"name":"@cspell/strong-weak-map","version":"6.18.0","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.18.0","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"f10e992d3f56e43cc4c396afb5597f6250cdfa0d","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.18.0.tgz","fileCount":7,"integrity":"sha512-sHTUWzc1rL3v38HFKyD4vUdK7NotNsbnHaR6nWXvPgDOF1LxgNf4M4YcX9taiMghln/5GR1MnrjXjm3ZsRwfbg==","signatures":[{"sig":"MEUCICyD6EpI3DvzCA7s+6QCJD5fuep/0kWnBkFO9b8mAOfLAiEAz1bQV83TqrN1wCDKjYPsg1xooMlUlrBq3tWdLi+IVKg=","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\nwsFzBAEBCAAGBQJjotLfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpEIQ/+N9uH7Qg2lYnzlM0n5eunctrAv1TORtUq6sM+YpDDgofRsluD\r\ncQf64bsDMgNC8JDxsbHMsq5q0zkEYj+DrDIiVb/vKCHRGP37pBwPAIBrz7FR\r\nEHW3Pg5gXrvyklYkl9tAT+AGa6lee56KECZOUlIon6NV3K1rAkIkM2MUnBkB\r\nJln2wyVCFjIy9YdIBxvHSnPBMM1uVGgYcpk681LZYjd/v3hHbjTVv5SQfpte\r\ncYBl/1v05xS3RsC3hYl/lLLfDJVjwtxcieNM6pVStgjLnrC2AL7h5nu/ux9S\r\nTbjMNNryVMk7rZzS3liS6BhR1YesTOeRU+DgfRt6kFY/e8eFBvN6sK+5lvNz\r\nOatmioytU59rwoqPbBFr2qCWQyORWdt6gDp39vwcR30NCkk2iGfhnoiRWOH7\r\nOJOgO3dyjUz5JUxVZ3KAGEe1jgw3dUNEUgarCT6vQiJU+e1vDMZE16/wlVIP\r\ngW92z84r7sPTG3rmgRebYPH4YjprsNaqBSdp4kr6NOtWhh16jSEQZW8WGO1W\r\ncmliqwgKv0+ArBvEYwI5DMP+QB6qlwRp8deRK7LxkLxTElgcjy0P7i9/1L0X\r\nEQpXfzxkaACuLTCXSwOOZ8RMHLRcb8Boe5nCx9S367SKQEPa+Z7hztBGicxp\r\nPuEL3RzkTxSTgBprs//qbKeDfAx+/EPqhmI=\r\n=s7CB\r\n-----END PGP SIGNATURE-----\r\n","size":3470,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.18.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":"6785657a445643ec1c9a17152e3c3733eb0e2a74","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.18.0_1671615199673_0.2677962080075489","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":1671615199791,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1671615199791,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}