{"name":"@cspell/strong-weak-map","version":"6.20.0","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.20.0","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"eed25d2c38001e28a529a2139a63a73192471ac3","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.20.0.tgz","fileCount":7,"integrity":"sha512-aMfemvDuZYc5H6SC9Qo1hVJtNArrRFSoLyUGAO1vjRXw/BukCWQSWuDTWGjQkm9esMW9p58PUm0YtBR6xNnuJg==","signatures":[{"sig":"MEQCIEZdeBeqZWC3D/0ZoimKGbCofrM+VWuVIhICTIJM2OKuAiAn4eDwMfEwp9RuHpAfdfi2W8J7vIEtqAQNT9+XSzVZIA==","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\nwsFzBAEBCAAGBQJj2oalACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmplMxAAiRYELFkR3rMy3pV1Ji9TVdV547k7wbDJ7oHjfTx1SP8CY6mo\r\nYeu/rjdAcelYoBdQtUb42C8CHoo1zmLDC0ccVoivkNB4V8vgiz9VWi073yIa\r\n/U6of+pcf8kZfvRfXjgagRE/LXfr/6d5RGnLqai8lJ1U0+fZQoBe7/USibO1\r\nWNxlDG2kkJZpcFqB9upQGtN3iw/suXQKSjr+DBxcM5rAwlL4a6xjrNSk56Z5\r\ndOFvEy3xzOEdMKjwY6B7lcrobXdVOLDef6C/iBEjHkEWAE77daKAO03giDUH\r\nZz86H/wOT50JmLpadqyM8oTrkBbJheFrMAHKg5u1orzzIX5aVVmH2Cf1CMjs\r\n9+/08toKoBthqTmNRF9kFLj8lsJqfjPc2SqBnRc4CUjG50aXuMqX9oxxBC+N\r\nVtdEIN3RQjC1gBYxJZZc6qdr2WPp5NEIOXgwAR95N3PFSlLNYZlbSzUGs76R\r\ni+M44K7rDejuf04khmtS8QhTK5qjXhAONP2vxC07CtZgars7XEd2aJLtAYks\r\nqCTtTIZGcfTOtUpAAkipMbnHv/FdYyPGfZbzhCKU/uz2+v+Cf7SYjS5hCgUk\r\no705JDgkqLrp51ABpfh4lD0nULSra6Cj3+n214VMCJ8KC21UecOEtwWIXryA\r\nEikTm67BhGKahpmK0A3xIjrBBPmtj2lfHcA=\r\n=Nfuf\r\n-----END PGP SIGNATURE-----\r\n","size":3626,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.20.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":"9de0bdd5b8da54daa72ccd6c328274bd796ada33","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.14.2/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.20.0_1675265701597_0.1900065261540409","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":1675265701755,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1675265701755,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}