{"name":"@cspell/strong-weak-map","version":"6.31.1","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.31.1","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"370faeae5ecb0c9a55344a34cd70f1690c62de01","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.31.1.tgz","fileCount":11,"integrity":"sha512-z8AuWvUuSnugFKJOA9Ke0aiFuehcqLFqia9bk8XaQNEWr44ahPVn3sEWnAncTxPbpWuUw5UajoJa0egRAE1CCg==","signatures":[{"sig":"MEUCIQDakSs8zEg8gurd/BVJ7LzFiQvSytFmf1lIiP63rP8RmwIgeVcdprLoQ1XZ6CL/Z1vaStgtdC9FUAJaSYZ5YU79FXw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17415,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkHdT0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpy0xAAn7T3M5FUKRMYhB1nI9wbDmCD9DNuk/pQelPY/47NsPKxE9ts\r\ny7C/vUq6uuI6tf4EWGmED9l7apkPHRuXltj9fiF+oGhOt1GJDSIN71GA1SQO\r\nUxBbC1wJs5yNmBwSol/iijnUxj3UYbDPSW0xSE+But61iZgm1+3n/rQsUyGx\r\nw3cf8g0TRL26MIZy6vqmtqEYYZckbflWQdsTkahp0imHgXYUDz2AeJQCEpXi\r\nfVJzHIwq40y+cO0E0UyIlMxPnu7IpOj4uxaEalo2nEZvBiQU2QB/atThRGtJ\r\nFp+BrkagGJK4vMHEQDC48RRG+cr/xshyD12puJduzQfEdlhcFKJS5c5kK/+F\r\niKGwglpJJQyi8yAnejP+EtEdqOOMmrOsW2cROpSAvi9xnlqIQAKhQZzbmrhw\r\nnMx9cdzn84shy+vdH5RR4XGTIVJaqJtpsxsKyCUXSUCupykOkI5A6EhjxOau\r\nJx2U+Qzn66JXyHNPPcqq4LLj5TQ0g5xgZsOI2nhiBAA8xqncl+wezP8eSy9A\r\nXUTMe0MaH01TEsoKv8cC+6UMRdzLccbnPH0lnc5u3XYpQiWykzqHWMZnBaza\r\nuu1FC04UiwShrHo0mASfE7rLVzIBp19AcEEHCel4qRLRdF3FfAkrZ2bp/JDR\r\ntwKIwfkYoJHq0vIxQ+MMHazSpg2bXoBa2eU=\r\n=hbvC\r\n-----END PGP SIGNATURE-----\r\n","size":4017,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.31.1.tgz"},"main":"dist/cjs/index.js","type":"commonjs","module":"dist/esm/index.mjs","engines":{"node":">=14.6"},"exports":{".":{"import":"./dist/esm/index.mjs","require":"./dist/cjs/index.js"}},"gitHead":"43c3652e27588f6643cf78fd764f12f497f89fbf","scripts":{"test":"pnpm vitest run","build":"tsc -b . && ts2mjs dist/esm","clean":"shx rm -rf dist coverage .tsbuildinfo","watch":"tsc -b . -w","vitest":"node --expose-gc ../../node_modules/vitest/vitest.mjs","coverage":"pnpm coverage:vitest && pnpm coverage:fix","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","test-watch":"pnpm vitest","clean-build":"pnpm run clean && pnpm run build","coverage:fix":"nyc report --temp-dir \"$(pwd)/coverage\" --reporter lcov --report-dir \"$(pwd)/coverage\" --cwd ../..","coverage:vitest":"pnpm vitest run --coverage"},"typings":"dist/cjs/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.17.0/node@v18.15.0+x64 (linux)","description":"A Map with weakly referenced values.","directories":{},"_nodeVersion":"18.15.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/strong-weak-map_6.31.1_1679676660386_0.46986753068001863","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":1679676660566,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1679676660566,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}