{"name":"@cspell/strong-weak-map","version":"6.31.0","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.31.0","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"a131f5594376c37dfe86e41398fccb13d72053d1","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.31.0.tgz","fileCount":11,"integrity":"sha512-PtgpgN93O6ZSkkIJqKb5SnLpHCYJw6WVnFu7cMZe9ivftWNCB4nw9BLikQcjgxLggVtShiZTeAJBr5fzSju2Pg==","signatures":[{"sig":"MEYCIQD8qHG5rlahT0pJiwqJY5t0xmQUjMcx7yEp9+O43dwU7AIhAJEsF122SGFVhbTl9N+WC3TzHWDrML8AgMVcydVOEoaC","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\nwsFzBAEBCAAGBQJkHcRLACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpvrQ//dKyO8eCDqLRMxKi72qTo/Ieg+gGbk7Pw1g7gpH/O/igvqidc\r\nFvlp9ch0qx6mdgEbqQquU00zMVj6oFxLm5UHUgo1LWgJmy+ezwAekpTyDbIG\r\nmxqWL79c3TOOI/++m0FZGrC2eQmXRwuKbwLOsKM3FSPuUNcZ47/I2dRi5+do\r\nuqvb1ggKFrgFEQvZ4LjLJ9PFtORQKmjSNcL/rOMeWNr+h2aPAPkrzGOwAKgP\r\nlY5yqfwolVkQdNsYcCKoB3gda1zId5/oNIOgUHzThFP585/90HwSGygHmqPi\r\neSSxC7ynOc5vhU784m8ge52Mm9tCn1ndVXFMq4Fhpi+PUntMu6VqJR4JlNen\r\n8C/tCNJALySBUZtHUdb1fC3OnrASI3csU1dhMlG2O+S1tTstATw3tRSWxjpr\r\noYw+Om+RmuO9qL00BxCCiNMgHQVUNIOi5TQp+tVkc6MwI4UjadUsbe5DAlWU\r\nYPzHQOWvVb+Mqpr3v8fN9afNnx3eiSdep19pYoB2+o9M/8sbaMYCytriRvR4\r\nHhjkHB/WPxpTyE+oxzzWeEYeCGSWOptCD8PHyDhv68B7JsRJYuI9Zh532TUe\r\ncBQAuWQU+yLT16sVAWKn2+iiWoHPq6oreFEiN1HnK1Xnmu+G+voE9fnrUJr+\r\nKizdg8mntHZAz9mUrpZigSWC46Cl1AjPn7Q=\r\n=f3U+\r\n-----END PGP SIGNATURE-----\r\n","size":4016,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.31.0.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":"1c0c3eb875bc1aab334bd56d952c0d0964468b7a","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.0_1679672394988_0.9512967364384317","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":1679672395126,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1679672395126,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}