{"_id":"lru-map-like","_rev":"7-29375212cbf875701c267d375e2a4663","name":"lru-map-like","description":"LRU cache top on Map-like. Support non-string key.","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.1":{"directories":{"test":"test"},"author":{"name":"azu"},"license":"MIT","files":["bin/","lib/","src/"],"name":"lru-map-like","version":"1.0.1","description":"LRU cache top on Map-like. Support non-string key.","main":"lib/lru-map-like.js","scripts":{"test":"npm run test:mocha && npm run test:chriso","test:mocha":"mocha test/","test:chriso":"vows test/chriso-lru.js --spec","build":"NODE_ENV=production babel src --out-dir lib --source-maps","watch":"babel src --out-dir lib --watch --source-maps","prepublish":"npm run --if-present build","lint":"eslint src/ test/","lint:fix":"eslint --fix src/ test/","update:docs":"documentation build --access public --theme ./node_modules/documentation-markdown-api-theme/lib/index -f html -o out.md src/lru-map-like.js && cat out.md | add-text-to-markdown README.md --section \"API\" --write && rm out.md"},"keywords":["lru","cache","map","object"],"repository":{"type":"git","url":"git+https://github.com/azu/lru-map-like.git"},"bugs":{"url":"https://github.com/azu/lru-map-like/issues"},"homepage":"https://github.com/azu/lru-map-like","devDependencies":{"add-text-to-markdown":"^1.0.2","babel-cli":"^6.16.0","babel-preset-es2015":"^6.16.0","babel-preset-jsdoc-to-assert":"^4.0.0","babel-preset-power-assert":"^1.0.0","babel-register":"^6.16.3","chai":"^3.5.0","documentation":"^4.0.0-beta10","documentation-markdown-api-theme":"^1.0.2","eslint":"^3.7.0","mocha":"^3.1.0","power-assert":"^1.4.1","vows":"^0.8.1"},"dependencies":{"map-like":"^1.0.3"},"gitHead":"f515f471e1b8f332b26433c3f2405f146ddf7875","_id":"lru-map-like@1.0.1","_shasum":"33b0e755bce3f8a6c935011b44d6bf31cede8aa3","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.5.0","_npmUser":{"name":"azu","email":"azuciao@gmail.com"},"dist":{"shasum":"33b0e755bce3f8a6c935011b44d6bf31cede8aa3","tarball":"https://registry.npmjs.org/lru-map-like/-/lru-map-like-1.0.1.tgz","integrity":"sha512-LqLfprsJBC/YCqySCYQ3XsjWzhdQBKKGutqUVNA24/uKBDeIORO0+32Vb6RcYflipLOPLPRt0y8gyReUrCzVzQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwcd+ofJ8JoRzfmCw27Jcb392PfXYctgemL9qg9h8a/AIgRMK6nfDwxlXWBhDJmidIjG5lrhVug4mmMmzK5D55zoU="}]},"maintainers":[{"name":"azu","email":"azuciao@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/lru-map-like-1.0.1.tgz_1475300550725_0.6956985401920974"}},"1.1.0":{"directories":{"test":"test"},"author":{"name":"azu"},"license":"MIT","files":["bin/","lib/","src/"],"name":"lru-map-like","version":"1.1.0","description":"LRU cache top on Map-like. Support non-string key.","main":"lib/lru-map-like.js","scripts":{"test":"npm run test:mocha && npm run test:chriso","test:mocha":"mocha test/","test:chriso":"vows test/chriso-lru.js --spec","build":"NODE_ENV=production babel src --out-dir lib --copy-files --source-maps","watch":"babel src --out-dir lib --watch --source-maps","prepublish":"npm run --if-present build","lint":"eslint src/ test/","lint:fix":"eslint --fix src/ test/","update:docs":"documentation build --access public --theme ./node_modules/documentation-markdown-api-theme/lib/index -f html -o out.md src/lru-map-like.js && cat out.md | add-text-to-markdown README.md --section \"API\" --write && rm out.md"},"keywords":["lru","cache","map","object"],"repository":{"type":"git","url":"git+https://github.com/azu/lru-map-like.git"},"bugs":{"url":"https://github.com/azu/lru-map-like/issues"},"homepage":"https://github.com/azu/lru-map-like","devDependencies":{"add-text-to-markdown":"^1.0.2","babel-cli":"^6.16.0","babel-preset-es2015":"^6.16.0","babel-preset-jsdoc-to-assert":"^4.0.0","babel-preset-power-assert":"^1.0.0","babel-register":"^6.16.3","chai":"^3.5.0","documentation":"^4.0.0-beta10","documentation-markdown-api-theme":"^1.0.2","eslint":"^3.7.0","mocha":"^3.1.0","power-assert":"^1.4.1","vows":"^0.8.1"},"dependencies":{"map-like":"^1.0.3"},"gitHead":"7b188dafdce5421982e3f5c2fc429349eb7a2159","_id":"lru-map-like@1.1.0","_shasum":"5ac550787963ea9c80ea6964e8f4366f1f1e93d0","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.2.0","_npmUser":{"name":"azu","email":"azuciao@gmail.com"},"dist":{"shasum":"5ac550787963ea9c80ea6964e8f4366f1f1e93d0","tarball":"https://registry.npmjs.org/lru-map-like/-/lru-map-like-1.1.0.tgz","integrity":"sha512-+pQc06waYgi20p9NUSwUUasxCEG7byHk2P9VEcacsZGfTGSypZfLBUv6ieX9fXE9Rw2SVRG9cP0mTe/y+hNzaQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCvVYWUYX5UzUlWh+mQxcqAFmMWBUtSD/VV8aAR0uUvnAIgTanLaypF4SngrRzYyE03FngwqmRYh1aOfAOoHPg/PwE="}]},"maintainers":[{"name":"azu","email":"azuciao@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/lru-map-like-1.1.0.tgz_1487403175733_0.6448022588156164"}},"1.1.1":{"directories":{"test":"test"},"author":{"name":"azu"},"license":"MIT","files":["bin/","lib/","src/"],"name":"lru-map-like","version":"1.1.1","description":"LRU cache top on Map-like. Support non-string key.","main":"lib/lru-map-like.js","types":"lib/lru-map-like.d.js","scripts":{"test":"npm run test:mocha && npm run test:chriso","test:mocha":"mocha test/","test:chriso":"vows test/chriso-lru.js --spec","build":"NODE_ENV=production babel src --out-dir lib --copy-files --source-maps","watch":"babel src --out-dir lib --watch --source-maps","prepublish":"npm run --if-present build","lint":"eslint src/ test/","lint:fix":"eslint --fix src/ test/","update:docs":"documentation build --access public --theme ./node_modules/documentation-markdown-api-theme/lib/index -f html -o out.md src/lru-map-like.js && cat out.md | add-text-to-markdown README.md --section \"API\" --write && rm out.md"},"keywords":["lru","cache","map","object"],"repository":{"type":"git","url":"git+https://github.com/azu/lru-map-like.git"},"bugs":{"url":"https://github.com/azu/lru-map-like/issues"},"homepage":"https://github.com/azu/lru-map-like","devDependencies":{"add-text-to-markdown":"^1.0.2","babel-cli":"^6.16.0","babel-preset-es2015":"^6.16.0","babel-preset-jsdoc-to-assert":"^4.0.0","babel-preset-power-assert":"^1.0.0","babel-register":"^6.16.3","chai":"^3.5.0","documentation":"^4.0.0-beta10","documentation-markdown-api-theme":"^1.0.2","eslint":"^3.7.0","mocha":"^3.1.0","power-assert":"^1.4.1","vows":"^0.8.1"},"dependencies":{"map-like":"^1.0.3"},"gitHead":"e2fed230ab6cda58e179b560534e3ceec716d161","_id":"lru-map-like@1.1.1","_shasum":"d1205f014c889b2d6d45249e9b0e2cbbabca3f86","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.2.0","_npmUser":{"name":"azu","email":"azuciao@gmail.com"},"dist":{"shasum":"d1205f014c889b2d6d45249e9b0e2cbbabca3f86","tarball":"https://registry.npmjs.org/lru-map-like/-/lru-map-like-1.1.1.tgz","integrity":"sha512-zo/RmUgZ/KsYh26Eci9gajvI4F+YJH/XTRt9miKNag8jBC3S3FEin2LyZr/12TmH5egQYGKv7g0v1NuafyE/dg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDzHl6OpMmaoI4HtdoUNTqHtjvHE4AYMGBiTRyM9zN/ZwIhAJHT8jClhIFnu4VwOBsk9TcgHfbB+C+hzLJHBhSD4Pey"}]},"maintainers":[{"name":"azu","email":"azuciao@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/lru-map-like-1.1.1.tgz_1487403371280_0.7427339034620672"}},"1.1.2":{"directories":{"test":"test"},"author":{"name":"azu"},"license":"MIT","files":["bin/","lib/","src/"],"name":"lru-map-like","version":"1.1.2","description":"LRU cache top on Map-like. Support non-string key.","main":"lib/lru-map-like.js","types":"lib/lru-map-like.d.ts","scripts":{"test":"npm run test:mocha && npm run test:chriso","test:mocha":"mocha test/","test:chriso":"vows test/chriso-lru.js --spec","build":"NODE_ENV=production babel src --out-dir lib --copy-files --source-maps","watch":"babel src --out-dir lib --watch --source-maps","prepublish":"npm run --if-present build","lint":"eslint src/ test/","lint:fix":"eslint --fix src/ test/","update:docs":"documentation build --access public --theme ./node_modules/documentation-markdown-api-theme/lib/index -f html -o out.md src/lru-map-like.js && cat out.md | add-text-to-markdown README.md --section \"API\" --write && rm out.md"},"keywords":["lru","cache","map","object"],"repository":{"type":"git","url":"git+https://github.com/azu/lru-map-like.git"},"bugs":{"url":"https://github.com/azu/lru-map-like/issues"},"homepage":"https://github.com/azu/lru-map-like","devDependencies":{"add-text-to-markdown":"^1.0.2","babel-cli":"^6.16.0","babel-preset-es2015":"^6.16.0","babel-preset-jsdoc-to-assert":"^4.0.0","babel-preset-power-assert":"^1.0.0","babel-register":"^6.16.3","chai":"^3.5.0","documentation":"^4.0.0-beta10","documentation-markdown-api-theme":"^1.0.2","eslint":"^3.7.0","mocha":"^3.1.0","power-assert":"^1.4.1","vows":"^0.8.1"},"dependencies":{"map-like":"^1.0.3"},"gitHead":"03c1c9c4d45ba018873582cc344eba4d936e56a9","_id":"lru-map-like@1.1.2","_shasum":"80fa80c512cbfdd2c2d8c5506d82c28439faa666","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.2.0","_npmUser":{"name":"azu","email":"azuciao@gmail.com"},"dist":{"shasum":"80fa80c512cbfdd2c2d8c5506d82c28439faa666","tarball":"https://registry.npmjs.org/lru-map-like/-/lru-map-like-1.1.2.tgz","integrity":"sha512-/8IGKhAXXUx/Jfa6NK+X3ydzVzMxxth5CwkPq/7kjHv36HYB90vVyx0gvbnC4W8qsBpXbv8UN49hdkXGCKi4iw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBmDzhNnZ2Jz3gxxZdTIXHkh2ZUc9BqRTg1drK0euD05AiEAy6lvNnMtU7EDEre+nDE4kDJttWIaoK3e5JT4rHzZF9U="}]},"maintainers":[{"name":"azu","email":"azuciao@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/lru-map-like-1.1.2.tgz_1487403543625_0.5748000277671963"}},"2.0.0":{"directories":{"test":"test"},"author":{"name":"azu"},"license":"MIT","files":["bin/","lib/","src/"],"name":"lru-map-like","version":"2.0.0","description":"LRU cache top on Map-like. Support non-string key.","main":"lib/lru-map-like.js","types":"lib/lru-map-like.d.ts","scripts":{"test":"npm run test:mocha && npm run test:chriso","test:mocha":"mocha test/","test:chriso":"vows test/chriso-lru.js --spec","build":"NODE_ENV=production babel src --out-dir lib --copy-files --source-maps","watch":"babel src --out-dir lib --watch --source-maps","prepublish":"npm run --if-present build","lint":"eslint src/ test/","lint:fix":"eslint --fix src/ test/","update:docs":"documentation build --access public --theme ./node_modules/documentation-markdown-api-theme/lib/index -f html -o out.md src/lru-map-like.js && cat out.md | add-text-to-markdown README.md --section \"API\" --write && rm out.md"},"keywords":["lru","cache","map","object"],"repository":{"type":"git","url":"git+https://github.com/azu/lru-map-like.git"},"bugs":{"url":"https://github.com/azu/lru-map-like/issues"},"homepage":"https://github.com/azu/lru-map-like","devDependencies":{"add-text-to-markdown":"^1.0.2","babel-cli":"^6.16.0","babel-preset-es2015":"^6.16.0","babel-preset-jsdoc-to-assert":"^4.0.0","babel-preset-power-assert":"^1.0.0","babel-register":"^6.16.3","chai":"^3.5.0","documentation":"^4.0.0-beta10","documentation-markdown-api-theme":"^1.0.2","eslint":"^3.7.0","mocha":"^3.1.0","power-assert":"^1.4.1","vows":"^0.8.1"},"dependencies":{"map-like":"^1.0.3"},"gitHead":"fda376a7f1d9eb3a38872fdb07c09ecf49933e0f","_id":"lru-map-like@2.0.0","_shasum":"8b4f61e440aeaca49cbb248d62fc0decc61150e7","_from":".","_npmVersion":"4.3.0","_nodeVersion":"7.2.0","_npmUser":{"name":"azu","email":"azuciao@gmail.com"},"dist":{"shasum":"8b4f61e440aeaca49cbb248d62fc0decc61150e7","tarball":"https://registry.npmjs.org/lru-map-like/-/lru-map-like-2.0.0.tgz","integrity":"sha512-4qkRBMLcgzk+/b7FHK2wZSDRdDJYFQ3vZasly9DLEBrUgyGTW5gdte00FvoNPj1CE1O1zsvtEIpBcUOabINKJw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDJumhqSJnF0vpPj4WBbuLH/6bt5+He9Jq4mgjByq5WLgIgfE1yojobH3PsLx+w7aYZn3Jn1FpiVonqlU9spgZG4mI="}]},"maintainers":[{"name":"azu","email":"azuciao@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/lru-map-like-2.0.0.tgz_1492875332708_0.8210256001912057"}}},"readme":"# lru-map-like\n\nLRU cache top on Map-like. Support non-string key.\n\n## Features\n\n- Based on [Map-like](https://github.com/azu/map-like)\n    - It means that allow to use object as key\n- Tiny size: 2kb\n\n```\nenv  bundle   minify   gzip\n--   13.8 kB  6.32 kB  2.34 kB\n```\n\n## Motivation\n\nI have used [isaacs/node-lru-cache](https://github.com/isaacs/node-lru-cache \"isaacs/node-lru-cache\"), but this library is large for me.\n\n```\nenv  bundle   minify   gzip\n--   43.9 kB  27.5 kB  10.1 kB\n```\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n    npm install lru-map-like\n\n## Usage\n\n```js\nconst {LRUMapLike} = require(\"lru-map-like\");\nconst cache = new LRUMapLike(3);\ncache.set(0, \"a\");\ncache.set(1, \"b\");\ncache.set(2, \"c\");\nassert.deepEqual(cache.values(), [\"a\", \"b\", \"c\"]);\n// over limit(3)\ncache.set(-1, \"ADDED\");\nassert.deepEqual(cache.values(), [\"b\", \"c\", \"ADDED\"]);\n```\n\n### non-string key supported\n\nObject as key are fully supported.\nIt is [map-like](https://github.com/azu/map-like \"map-like\") feature.\n\n```js\nconst LRUMapLike = require(\"lru-map-like\");\nconst cache = new LRUMapLike();\nconst keyObject = {};\nconst valueObject = {};\ncache.set(keyObject, valueObject);\nassert.strictEqual(cache.get(keyObject), valueObject);\nassert.notStrictEqual(cache.get({}), valueObject);\n```\n\n## API\n\n### `LRUMapLike`\n\nLRU cache implementation\nBased on <https://github.com/rse/cache-lru>\n\n#### `limit`\n\nset the cache limit\n\nReturns: **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**\n\n#### `limit`\n\nset the cache limit\n\n**Parameters**\n\n-   `max`: **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**\n\n#### `onDispose(cb: Function): LRUMapLike`\n\nconfigure function to be called before item is disposed\n\n**Parameters**\n\n-   `cb`: **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**\n\nReturns: **LRUMapLike**\n\n#### `size`\n\nget size of items\n\nReturns: **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**\n\n#### `keys(): Array<Any>`\n\nget keys of all items in order\n\nReturns: **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;Any>**\n\n#### `values(): Array<Any>`\n\nget values of all items in order\n\nReturns: **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;Any>**\n\n#### `forEach(cb: function (value, key), ctx: Any): Any`\n\niterate over all items in order\n\n**Parameters**\n\n-   `cb`: **function (value, key)**\n-   `ctx`: **Any**\n\nReturns: **Any**\n\n#### `has(key: Any): boolean`\n\ncheck whether item exists under key\n\n**Parameters**\n\n-   `key`: **Any**\n\nReturns: **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**\n\n#### `peek(key: Any): Any`\n\nget value under key without promoting item\n\n**Parameters**\n\n-   `key`: **Any**\n\nReturns: **Any**\n\n#### `get(key: Any): (Any | undefined)`\n\nget value under key\n\n**Parameters**\n\n-   `key`: **Any**\n\nReturns: **(Any | [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined))**\n\n#### `set(key: Any, val: Any): LRUMapLike`\n\nset key as value\n\n**Parameters**\n\n-   `key`: **Any** - string, object etc..\n-   `val`: **Any**\n\nReturns: **LRUMapLike**\n\n#### `delete(key: Any): LRUMapLike`\n\ndelete item under key\n\n**Parameters**\n\n-   `key`: **Any**\n\nReturns: **LRUMapLike**\n\n#### `clear(): LRUMapLike`\n\ndelete all items\n\nReturns: **LRUMapLike**\n\n## Changelog\n\nSee [Releases page](https://github.com/azu/lru-map-like/releases).\n\n## Running tests\n\nInstall devDependencies and Run `npm test`:\n\n    npm i -d && npm test\n\n## Contributing\n\nPull requests and stars are always welcome.\n\nFor bugs and feature requests, [please create an issue](https://github.com/azu/lru-map-like/issues).\n\n1.  Fork it!\n2.  Create your feature branch: `git checkout -b my-new-feature`\n3.  Commit your changes: `git commit -am 'Add some feature'`\n4.  Push to the branch: `git push origin my-new-feature`\n5.  Submit a pull request :D\n\n## Author\n\n-   [github/azu](https://github.com/azu)\n-   [twitter/azu_re](https://twitter.com/azu_re)\n\n## License\n\nMIT © azu\n\nThis library based on <https://github.com/rse/cache-lru>\n\n> Copyright (c) 2015-2016 Ralf S. Engelschall (<http://engelschall.com/>)\n","maintainers":[{"name":"azu","email":"azuciao@gmail.com"}],"time":{"modified":"2022-06-19T14:30:17.790Z","created":"2016-10-01T05:42:33.212Z","1.0.1":"2016-10-01T05:42:33.212Z","1.1.0":"2017-02-18T07:32:55.949Z","1.1.1":"2017-02-18T07:36:11.498Z","1.1.2":"2017-02-18T07:39:05.442Z","2.0.0":"2017-04-22T15:35:34.406Z"},"homepage":"https://github.com/azu/lru-map-like","keywords":["lru","cache","map","object"],"repository":{"type":"git","url":"git+https://github.com/azu/lru-map-like.git"},"author":{"name":"azu"},"bugs":{"url":"https://github.com/azu/lru-map-like/issues"},"license":"MIT","readmeFilename":"README.md"}