{"name":"@cspell/strong-weak-map","version":"6.24.0","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.24.0","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"4046f1dccf74d6809efb3c685fe932e7dc0ed6d6","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.24.0.tgz","fileCount":7,"integrity":"sha512-R0F/nd5scB17A8T7ScBjhBZZ0F0xRFnP6i122dQxeTVOkJM/UAsHjTWT6Wb8M1ZLO6gRESfxx0vyL8+5RGzFCg==","signatures":[{"sig":"MEYCIQDl/yWLaTVE47UmuLVRP6poC5n4s1AWo3fHOjJET6d1UQIhAOfRQ3ERPvBaNekC35p5v1iPj6pZAYm5pFjf3hXtIrQp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10566,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6mBJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmovBg/8CfCTlk4LmnJPd8WTILj+cL1rNQN8R8Yzw8GoPL463v5QTNKP\r\nMidsoVL03ws6fLUSH+XFqc4ah2ak6M440rSIoHNAsBN6857apM9Vx8lKIEjo\r\nB6j4A0KaVC4saeL0Aj/78UMe8UkXmaVjnHCYZzV7S5EXgvGaj4tZavuNQxqt\r\nvBKryxiX4GDft2maXVf0DCJFp51ZI9LsAUEoBsysXuywiEjEZMA5uARwE9LK\r\n/UJT4QmP+JXdc1GCjDnakJpypaP6yjGQ+OZJA9H5neTzIA3dS/Zn8hDNFcdu\r\nAxcwZeepukMIBM3z1O/E7z2NVODcchh8AhRdo8Pla7faiEmfPTUzYh8CnDOG\r\neq8CPDBFXxZj9z21B5yyKFlZ54KGQkZivGVXJz/Jzuuo1qGV0R0bqXT//UWm\r\nDvYTe1dNA+bKUwmHWZhv2S68Tjh8fc+JwGf4WKgpBUTik1WlOTc9uXBv//cm\r\nj4JXjFi52bh3Trtnag0rZjes8BsHqQcwfStenOnTkKzG5UDeq3r/57JEVQab\r\n2HvqdR4JpAIyHDRCnExr1b4RNtFSZpqLdvRhMxKhJu1pNjMXjy4cZiIEGkzy\r\nN+IA/Z2f89Zvv2L/Iszy7hb0kVEQ/KltTG+/UHNbf06dittXaSHTVSk5y85Q\r\nF6X/S2DHleHyyjoYCQyA2CyAR1LXBLJSM0Q=\r\n=KOij\r\n-----END PGP SIGNATURE-----\r\n","size":3626,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.24.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":"0d1e8bf9426cd0bfb814df4f61da12d8aee57ddd","scripts":{"test":"node --expose-gc ../../node_modules/jest/bin/jest.js","build":"tsc -p .","clean":"shx rm -rf 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.15.1/node@v16.19.0+x64 (linux)","description":"A Map with weakly referenced values.","directories":{"dist":"dist"},"_nodeVersion":"16.19.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,"_npmOperationalInternal":{"tmp":"tmp/strong-weak-map_6.24.0_1676304456988_0.5816013722355204","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":1676304457159,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1676304457159,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}