{"name":"@cspell/strong-weak-map","version":"6.27.0","keywords":["Map","WeakMap","Weak","Values"],"author":{"name":"Jason Dent","email":"jason@streetsidesoftware.nl"},"license":"MIT","_id":"@cspell/strong-weak-map@6.27.0","homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-strong-weak-map#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell"},"dist":{"shasum":"4065eab7b4ca45db0a08b697be7c64f59abb122a","tarball":"http://registry-npm.ywwl.com/@cspell/strong-weak-map/download/@cspell/strong-weak-map-6.27.0.tgz","fileCount":7,"integrity":"sha512-4hel0Dik7GTX8yVOjOXlumIOzYD8mWzDeyMEhEJb3qwDfsTPeeYo1EMTSgtS+oJXR6kQ09qBrF1lok44v6NOAQ==","signatures":[{"sig":"MEUCIQDWOYcdot7eUIQdpvaxx/a25uBkvcmMlveUJvcutSQZjgIgDocprlRURRpdupc8+0X6Cyx7gvtZe+R6htYVSbIEZMU=","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\nwsFzBAEBCAAGBQJj+w8pACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp6ZxAAj2kbCx5n0oyy6VhUbJdEr3cQvMxRAHQN5n0q42Ac9FT2LViw\r\nlwIDfuoejePS99sT0fo5o7UaIRIIyCiatxvaI/cD7iLRoOJ103KCnwQe3eMv\r\nvTiHqpHB1W3OU/Irx/yS9C42taNDPbBNDpHCrdgbPYajGxWUhjeY0Z/FTHEY\r\nGNuKzysoqiLph0Bq6/4zglEJ45vHQZf3QzuRtNHHLItL0yFKMmRlYIIbsKp9\r\n0AsCzc8ifMzpwKjZbnQiyxpN5q62z+CJbWRmewxk7i939txy1Issvb9Qtqsy\r\n/jk448l2VUdbNwbKYr6xoVHdMGgFpVTOeLAYqsLmGJN1qOFix6VrGs7Xson8\r\napap1RwT86qARBLTMS8DripGBM0FYj9hW92wCmb7apneIWcfipq+5JmBBOLG\r\nBf3WaiY5UTFr4fuOg2LtZLr+QiVhswrvtVY2xxk021o3KH9hIBEH4zPF3cDS\r\n0x5EdrBHKxB7ebJ5z8zzgGbSe+XZ3oVEG46zXrxO5klFELKSV4McK8AuFYZ+\r\nkn2nxkJewWBY5bE6vTCe4IDjBuL/9XgxPbwFjqcTLIJeuRNHluDAq3EQUc9r\r\npUEaqBTlZuaoEj/e50WHmGy4Jdu2PwqzQupYDd7jyhvBXHk5iziySpxwEP2Y\r\n5AQ9CN+nhjaQnLd1RfSCgdIODfIIQl1E3bQ=\r\n=jjQ6\r\n-----END PGP SIGNATURE-----\r\n","size":3629,"noattachment":false,"key":"/@cspell/strong-weak-map/-/@cspell/strong-weak-map-6.27.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":"b0e31c7ba91ba467d5fd9c66f238bb5d899f4833","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@v18.14.1+x64 (linux)","description":"A Map with weakly referenced values.","directories":{"dist":"dist"},"_nodeVersion":"18.14.1","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.27.0_1677397801211_0.27004003686394595","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":1677397801400,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1677397801400,"dist-tags":{"latest":"10.4.1","next":"10.4.0-alpha.1"}}