{"id":22222045,"url":"https://github.com/fabiospampinato/function-once","last_synced_at":"2025-07-28T20:09:03.558Z","repository":{"id":66053418,"uuid":"442306782","full_name":"fabiospampinato/function-once","owner":"fabiospampinato","description":"Wraps a function so that it's only ever executed once.","archived":false,"fork":false,"pushed_at":"2025-01-17T00:28:25.000Z","size":10,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-02T03:48:41.700Z","etag":null,"topics":["once"],"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/fabiospampinato.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":"fabiospampinato","custom":"https://www.paypal.me/fabiospampinato"}},"created_at":"2021-12-28T00:29:41.000Z","updated_at":"2025-01-17T00:28:27.000Z","dependencies_parsed_at":"2024-12-02T23:16:43.732Z","dependency_job_id":null,"html_url":"https://github.com/fabiospampinato/function-once","commit_stats":null,"previous_names":["fabiospampinato/function-once","fabiospampinato/once"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fabiospampinato/function-once","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ffunction-once","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ffunction-once/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ffunction-once/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ffunction-once/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabiospampinato","download_url":"https://codeload.github.com/fabiospampinato/function-once/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabiospampinato%2Ffunction-once/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267387026,"owners_count":24079157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"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":["once"],"created_at":"2024-12-02T23:16:40.335Z","updated_at":"2025-07-28T20:09:03.542Z","avatar_url":"https://github.com/fabiospampinato.png","language":"JavaScript","funding_links":["https://github.com/sponsors/fabiospampinato","https://www.paypal.me/fabiospampinato"],"categories":[],"sub_categories":[],"readme":"# Function Once\n\nWraps a function so that it's only ever executed once.\n\nNote: `this` is always set to `undefined` and only functions that don't accept any arguments are supported, as using those with a function that's only ever executed once is practically just a footgun. If you need different `this` or different arguments you should probably use memoization instead.\n\n## Install\n\n```sh\nnpm install function-once\n```\n\n## Usage\n\n```ts\nimport once from 'function-once';\n\n// Let's make sure a function is at most executed only once\n\nconst rand = once (() =\u003e Math.random ());\n\nrand (); // =\u003e 0.3344627371267874\nrand (); // =\u003e 0.3344627371267874\n```\n\n## License\n\nMIT © Fabio Spampinato\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Ffunction-once","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabiospampinato%2Ffunction-once","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabiospampinato%2Ffunction-once/lists"}