{"name":"@cspell/strong-weak-map","version":"6.17.0","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.17.0","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"841ef99a4e0fdf9aacce36281829b87616b01478","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.17.0.tgz","fileCount":7,"integrity":"sha512-fRghm6eoUEH7Uz57t0SEKJNm4lqODF2/DRiLd2ek7QkzUHKrCetre/5UrvdE78GIUyl0+8GLx9iFwo/XFa6dDA==","signatures":[{"sig":"MEYCIQCv2GP4LwJgtR62kFKsnF3lzhpCj2eh2yDUZ6liR9uZCQIhAKtJHuQAm0ZkQPS1HT7IKFdv/G4a0Uzo/tSl/7nYGE/J","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\nwsFzBAEBCAAGBQJjjhL6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqhhA/+L0eoI/BF56cIPx5LSQi8uZX4jt0OQE52MY3uqYqt2oVilfev\r\nVXo+43a9ItKytUrSxscGITxvmfq2DeNiN57PIDYmfb7+RRW4mUXHePDPooLA\r\nJqyfaX6JsEuWjEzbNpDS6kwrAu4S4IgfsB77oyqx6zusDAVHZaRw3UyhPZWF\r\nealk9+uaW4H9fd2kEJn0wuLP/VWdbAn4e2W+NVmRJj7ZJ0O7D/2xkR1Js7Tu\r\nSkCQCdmjVsD7pnvKmWuYfk0BpoewDoJFSZOHUiYlztF2Nf2fgrXzPUVzrZ6R\r\nXnDOK9LEgDx6Zoox/7jL/M3v1TXDo0A2PvjLJ5xXQCVz3Um1a4jgCMRhVC3q\r\nXdOAzyMq6zaWSnbP4E0haBKhHi5HBIu3pg0dPBa0JTBwvd9OwX2xKutm2wGk\r\noL0dwDn6Glz4biebb3asE5U2lRhyb8XBwzbfBT6CmqGFcMPydLcKhBNFih4W\r\nm/J6xGtNifYMaoudtL6lvomZUtWtNNpLe768HFIT8ID8r1vWMwm/E08wUDVR\r\neYrAKSh1nvKVRlD9glnxAO4NgMWiTzlwjuUCCYisTp85REmLghWmrOiWp1qY\r\nNfyfp5wOVMNW2J0B4zLEW+ZCyJU2FGuLzYUlAhPOs+hCHSYO1vS9A06HRpHf\r\nHjEne07+k+SEkOvxMdYz6xAaaS13ahbNcT4=\r\n=M2l7\r\n-----END PGP SIGNATURE-----\r\n","size":3472,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.17.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":"a9917563690588777a16e844eaa9c112f44b2d21","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.17.0_1670255354741_0.6557134630897554","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":1670255354873,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1670255354873,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}