{"id":15759510,"url":"https://github.com/azu/lru-map-like","last_synced_at":"2026-02-15T23:01:28.597Z","repository":{"id":66143463,"uuid":"69721312","full_name":"azu/lru-map-like","owner":"azu","description":"LRU cache top on Map-like. Support object key.","archived":false,"fork":false,"pushed_at":"2017-04-22T15:56:45.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T01:25:09.266Z","etag":null,"topics":["cache","javascript","library","lru","map","object"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"azu"}},"created_at":"2016-10-01T05:31:25.000Z","updated_at":"2020-06-03T13:26:52.000Z","dependencies_parsed_at":"2023-03-22T08:53:47.898Z","dependency_job_id":null,"html_url":"https://github.com/azu/lru-map-like","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":0.05882352941176472,"last_synced_commit":"e16506147a108d28b25a2728d6fe5715bf9122c5"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/azu/lru-map-like","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Flru-map-like","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Flru-map-like/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Flru-map-like/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Flru-map-like/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azu","download_url":"https://codeload.github.com/azu/lru-map-like/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Flru-map-like/sbom","scorecard":{"id":221485,"data":{"date":"2025-08-11","repo":{"name":"github.com/azu/lru-map-like","commit":"e16506147a108d28b25a2728d6fe5715bf9122c5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/17 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":9,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/azu/.github/SECURITY.md:1","Info: Found linked content: github.com/azu/.github/SECURITY.md:1","Warn: One or no descriptive hints of disclosure, vulnerability, and/or timelines in security policy","Info: Found text in security policy: github.com/azu/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}}]},"last_synced_at":"2025-08-17T02:37:35.495Z","repository_id":66143463,"created_at":"2025-08-17T02:37:35.496Z","updated_at":"2025-08-17T02:37:35.496Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29491998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T19:29:10.908Z","status":"ssl_error","status_checked_at":"2026-02-15T19:29:10.419Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","javascript","library","lru","map","object"],"created_at":"2024-10-04T10:20:45.932Z","updated_at":"2026-02-15T23:01:28.581Z","avatar_url":"https://github.com/azu.png","language":"JavaScript","funding_links":["https://github.com/sponsors/azu"],"categories":[],"sub_categories":[],"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 \u003chttps://github.com/rse/cache-lru\u003e\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\u003cAny\u003e`\n\nget keys of all items in order\n\nReturns: **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;Any\u003e**\n\n#### `values(): Array\u003cAny\u003e`\n\nget values of all items in order\n\nReturns: **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;Any\u003e**\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 \u0026\u0026 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 \u003chttps://github.com/rse/cache-lru\u003e\n\n\u003e Copyright (c) 2015-2016 Ralf S. Engelschall (\u003chttp://engelschall.com/\u003e)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Flru-map-like","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazu%2Flru-map-like","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Flru-map-like/lists"}