{"name":"@cspell/strong-weak-map","version":"6.18.1","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.18.1","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"7ea94fd479573239582361114a49a7ac3cf88977","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.18.1.tgz","fileCount":7,"integrity":"sha512-etyMLISiDzgFf1BSGpUBD62cHp9NrCyrOi+iT7WrJ+My0l6IPRIhANuAVp2JcsXxe28en4X3Bp/egd46Q5Rpkg==","signatures":[{"sig":"MEYCIQDz8RvqAsmZ/joDMtugCbZ/CZzsY/nqPlg9Y/EKY7hUdAIhAL+8yqIvqexvumHGgu/xCkh2ZDJ0YFcdZROXSTSpfCOc","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\nwsFzBAEBCAAGBQJjrZCrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpXVw//WGy2P+p7Va6+T0bU+PNjrxl74thJT9TY5oAzQGoDtbPyjJq3\r\nD63zVjdDyxxueo/CJbkjqvMNWkD3QmtKXoiGBhpqBrNbkaupH/J63gkilVnU\r\nYGjBpJRtXSz0u8GQ/mxLDI8TsF4Ax8fo+fx4v7PRtH0EwFTK4VV8MO/6e1mZ\r\nOrJmpwkfn9+L7IbQls2vfVPH1K7DzLaogY6teDRbjBAZzmslneu+6sZ1HRve\r\nrQuhho94vnz/XD1jOnzrTCFNMd48S1YxpFhxWOJdOloEVFojPf6zs59xGe8k\r\nd4vvC8d7HSsQA5qRr7/ZJkxhENsIPSLfrALgYUaMjrF3pStqxZ1rGd+orf/J\r\nlXLtM79DPLTtjFLqc0e61CRbW7p9lIJRxRZOgex9mWvwOGInLBy3m/oeVrA8\r\nLLzOMl3sJ1KEowbV0Rldu5M3m2YjrfMaVsprhtNPgIhq6Dg1MgTUdEyuGkFx\r\n0WP2dSc09Ry9vv4zxD1is9MRhgja+dON15KfRDY8AkUvse2WeWUrWqegzWYC\r\nObkYmZXkbnFkCjqWXWl3GkdqnK/TqaJDCA7fsB4ve2aZEfDwrdkp8KhXGsVe\r\nySx5BzrJgW/wyoxsX7ZZwu2M7XsZ5VE0rx79OnuHZHLQRaIs8jYIM/V84d+B\r\nZcJ9o+qEcsJ1QOUNAFRKvb+eXp3mqQh+loI=\r\n=C/0g\r\n-----END PGP SIGNATURE-----\r\n","size":3470,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.18.1.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":"2570a9bb03e68864d30ed8024786b3b2eeddab2b","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.1_1672319147601_0.11136575248418401","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":1672319147761,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1672319147761,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}