{"name":"@cspell/strong-weak-map","version":"6.14.0","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.14.0","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"5cadb807398e9de2870559f2021600ba4433cc1d","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.14.0.tgz","fileCount":7,"integrity":"sha512-SHBY4d5U2bDfEheXkguzV82vcAGmzU2j0YS+/5j3Ymzsw4EXRy5z18YATxrVCG7vyWZssm0sTZNCqypqG5J74A==","signatures":[{"sig":"MEUCIQCeUjQcmqTFEXd/cPMYjm7t0+inzyskOFLK+mOIqwVXugIgYCoYxu+JW3K0A3qM9kao5oB2tZ7e43pY2yamL3c0K48=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10195,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjaNI+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp7Bg/+P+N0rE/p4NovLfRZeu6D7XuopRHzZK3JIRVJ///TCIy43tDh\r\nA0efPkCO/RUl89dyVJ2/prHAQi0UkPDZmvuhP1w/mjwU0ouKQMvW5MwR249t\r\nzAFmTT79s52pat/zjXf0d9ATzYY69akUw822+nbMv7FCH9kDq5WH8jsazKx1\r\nUouCiWAls5pCYUrmFqBhXWkjIOcfCm+gCdud1SJdTZ3CBEycyubDuLzxdzWj\r\nLmVRuE69guW9mWCA7MZFwI+k98jSUC9WRXF0Y3TDuLTO9WrkRtc/CBHb46AD\r\n1q9OzgOsUlwEatfX+VSNUKMSG4Ti7dbtntfEN7LknZuBhAMj0wTRaz5v0IEl\r\njwKHATm133Z6dp1mVKEF7H1zR4SFBMm5p3LNS2cTg7cxLK+99bAlEuTIz4yr\r\nk0C6gPypY1fySqcQPAFqmTfueyyauQxKe+8Kvj5qTnESI8iQ++Rhos1M56jc\r\nKkwJwRc3WPPuEA5nGkAo7sBgtqSCZfRmNX3rU06nwbj/T820kz6jAS5wMlrF\r\necg8TZGpqKyEr8PQzMz6GDYqm+VN24v8acth59cd+FElFHirjPDwbspg8hTy\r\nwp6qbrlq1oy3+2XG9B1nBBZqLHgO+IXW8PYuUWga+7xfb39jIkVwrthX0s7y\r\nWWIq3ek7JccAXo+IKv82+JtaueyZlngym8g=\r\n=S3gJ\r\n-----END PGP SIGNATURE-----\r\n","size":3403,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.14.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":"be745ac551111872810b1accde78394c23a002a5","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":"8.19.2","description":"A Map with weakly referenced values.","directories":{"dist":"dist"},"_nodeVersion":"16.18.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,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/strong-weak-map_6.14.0_1667813950815_0.4965933016332251","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":1667813950954,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1667813950954,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}