{"name":"@cspell/strong-weak-map","version":"6.14.2","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.14.2","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"73bdb978bcf027e678ebe42e89bd0df389ffbefc","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.14.2.tgz","fileCount":7,"integrity":"sha512-OS/t4e5vfUyAiOcyuI1I9d4/EWCx7pA3L8uHNOQQHgjVP41tffMaKTirqRiNhkruIhmxa5Tk5fbQLRMEFapalg==","signatures":[{"sig":"MEQCIEJQtzXqFohHFgVcxAcRv3kJFvLZ6jlF9QAmu5BufOguAiAVE+m4vpPS8nwDgMweiKkH7d3ZVT9/3NFY5YQgsRvuXA==","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\nwsFzBAEBCAAGBQJjbgsBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo8iQ/+OcRtbJCz5fTj3Rb9acB8XcdEDk6+fi2qkP+++1kP9wFGJUVx\r\nxll5+aB5/vcIw8banhvIP0P3rT3Mj2WO32k6aJBgUcfSkbGwlc6UDU99v4+V\r\n/9JPRRUvAl5fXDxLddTCnx/4+KqeA0LxBuzDL2l87XWBG1r8HkUjnMjT4ZsY\r\nnbZ0porwBWmMaa8qBRxrnUunj8S2uyXtsSnvbUFSpOhDdgAc8JMjVXqQ9Dwo\r\nZaRsrsZzXlaKb6k2HfhZ5jZKOKdlrjvinZwj8Z1uIYX/5gU93zrQelNaeuQF\r\nYoBgYIA0VpahpxwhpFNszmnWqhduF8oI8hje/qVTgT4jj/29idisJezR20BJ\r\nvzgSVSRHomDlirqi7vuopGpn2uo+ElBCJK7Ylrc8J3wKow2XlwPqNq17UG/t\r\nTLbTbVBcFPkmfZcBrXe9m6agvvWycxfSydwk3wbY9TNahHPWR9kcN/T1P/h6\r\n0njQIgeo3RwozH/uMr0ZcwgA1kVrMPmlHpaROgx9O7aFpZl+H+MqunRs6lV6\r\n7S7sFxzm2H881jNHfea8/a8nC5c0/4pwmfbAmO5UBMa2sniCFeTeL40xs7eB\r\nYVi2zsUonSc1PLHJbIa8VIfnvltWzLb9t7CdaEwMyxy15Vv3TZ+kmF2Gd5Me\r\n5D9aKrG8lauFOkeEWcqrwehBccXkhjIAMVU=\r\n=/NMO\r\n-----END PGP SIGNATURE-----\r\n","size":3470,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.14.2.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":"ea9692380357e9e890c20f15b1200cc1c6c3a2df","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.12.0/node@v16.18.0+x64 (linux)","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,"_npmOperationalInternal":{"tmp":"tmp/strong-weak-map_6.14.2_1668156161479_0.7719472639987943","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":1668156161599,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1668156161599,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}