{"id":15361538,"url":"https://github.com/jonathanong/fn-key-cache","last_synced_at":"2026-07-17T12:03:08.040Z","repository":{"id":57239464,"uuid":"81713242","full_name":"jonathanong/fn-key-cache","owner":"jonathanong","description":null,"archived":false,"fork":false,"pushed_at":"2020-03-15T16:32:14.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-27T13:46:50.090Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jonathanong.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}},"created_at":"2017-02-12T08:37:08.000Z","updated_at":"2023-03-04T06:17:58.000Z","dependencies_parsed_at":"2022-08-30T00:11:19.963Z","dependency_job_id":null,"html_url":"https://github.com/jonathanong/fn-key-cache","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jonathanong/fn-key-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanong%2Ffn-key-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanong%2Ffn-key-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanong%2Ffn-key-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanong%2Ffn-key-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanong","download_url":"https://codeload.github.com/jonathanong/fn-key-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanong%2Ffn-key-cache/sbom","scorecard":{"id":530399,"data":{"date":"2025-08-11","repo":{"name":"github.com/jonathanong/fn-key-cache","commit":"ddfc79413a1fcc1e376357b5e7bdb15500d8f978"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/4 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":"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":"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":"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":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"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":"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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T05:33:18.504Z","repository_id":57239464,"created_at":"2025-08-20T05:33:18.504Z","updated_at":"2025-08-20T05:33:18.504Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35580669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-17T02:00:06.162Z","response_time":116,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-01T12:55:33.786Z","updated_at":"2026-07-17T12:03:07.961Z","avatar_url":"https://github.com/jonathanong.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# fn-key-cache\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![Dependency Status][david-image]][david-url]\n[![Greenkeeper badge](https://badges.greenkeeper.io/jonathanong/fn-key-cache.svg)](https://greenkeeper.io/)\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\nLittle utility to cache functions based on keys.\nUseful for creating handlers in React:\n\n```js\nimport React, { Component } from 'react'\n\nimport KeyCache from 'fn-key-cache'\n\nexport default class Thing extends Component {\n  state = {\n    tab: 1\n  }\n\n  onClickButton = KeyCache(tab =\u003e e =\u003e {\n    e.preventDefault()\n\n    this.setState({\n      tab\n    })\n  })\n\n  render () {\n    const { tab } = this.state\n\n    return (\n      \u003cdiv className='container'\u003e\n        \u003cbutton type='button' className={tab === 1 ? 'active' : ''} onClick={this.onClickButton(1)}\u003e1\u003c/button\u003e\n        \u003cbutton type='button' className={tab === 2 ? 'active' : ''} onClick={this.onClickButton(2)}\u003e2\u003c/button\u003e\n        \u003cbutton type='button' className={tab === 3 ? 'active' : ''} onClick={this.onClickButton(3)}\u003e3\u003c/button\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n```\n\nWithout this utility, new functions would be created on every `render()`.\nThis is better than doing something like `onClick={e =\u003e this.setState({ tab: 1 })}`,\nbut not better than just creating a new component.\n\n[npm-image]: https://img.shields.io/npm/v/fn-key-cache.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/fn-key-cache\n[travis-image]: https://img.shields.io/travis/jonathanong/fn-key-cache/master.svg?style=flat-square\n[travis-url]: https://travis-ci.org/jonathanong/fn-key-cache\n[codecov-image]: https://img.shields.io/codecov/c/github/jonathanong/fn-key-cache/master.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/jonathanong/fn-key-cache\n[david-image]: http://img.shields.io/david/jonathanong/fn-key-cache.svg?style=flat-square\n[david-url]: https://david-dm.org/jonathanong/fn-key-cache\n[license-image]: http://img.shields.io/npm/l/fn-key-cache.svg?style=flat-square\n[license-url]: LICENSE\n[downloads-image]: http://img.shields.io/npm/dm/fn-key-cache.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/fn-key-cache\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanong%2Ffn-key-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanong%2Ffn-key-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanong%2Ffn-key-cache/lists"}