{"id":14982051,"url":"https://github.com/gulpjs/async-once","last_synced_at":"2025-10-19T11:31:12.407Z","repository":{"id":27990688,"uuid":"31484734","full_name":"gulpjs/async-once","owner":"gulpjs","description":"Guarantee a node-style async function is only executed once.","archived":false,"fork":false,"pushed_at":"2023-09-03T23:42:56.000Z","size":16,"stargazers_count":8,"open_issues_count":0,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T15:14:38.318Z","etag":null,"topics":[],"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/gulpjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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},"funding":{"github":["gulpjs","phated","yocontra"],"tidelift":"npm/gulp","open_collective":"gulpjs"}},"created_at":"2015-03-01T02:46:33.000Z","updated_at":"2023-11-05T01:44:14.000Z","dependencies_parsed_at":"2022-09-06T04:11:40.517Z","dependency_job_id":"66d4680c-a2e4-4284-830a-947dc591163b","html_url":"https://github.com/gulpjs/async-once","commit_stats":{"total_commits":14,"total_committers":6,"mean_commits":"2.3333333333333335","dds":0.4285714285714286,"last_synced_commit":"462f9a558fe232f2c6c2dcadc744fd1a43059fa0"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Fasync-once","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Fasync-once/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Fasync-once/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gulpjs%2Fasync-once/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gulpjs","download_url":"https://codeload.github.com/gulpjs/async-once/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236572139,"owners_count":19170765,"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","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-09-24T14:04:42.095Z","updated_at":"2025-10-19T11:31:12.093Z","avatar_url":"https://github.com/gulpjs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/gulpjs","https://github.com/sponsors/phated","https://github.com/sponsors/yocontra","https://tidelift.com/funding/github/npm/gulp","https://opencollective.com/gulpjs"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://gulpjs.com\"\u003e\n    \u003cimg height=\"257\" width=\"114\" src=\"https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# async-once\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]\n\nGuarantee a node-style async function is only executed once.\n\n## Usage\n\n```js\nvar once = require('async-once');\n\nvar count = 0;\n\nvar myAsyncFunc = once(function (cb) {\n  count++;\n  cb(null, count);\n});\n\nmyAsyncFunc(function (err, result) {\n  assert(result === 1);\n});\n\nmyAsyncFunc(function (err, result) {\n  assert(result === 1);\n});\n\nassert(count === 1);\n```\n\n## API\n\n### `once(fn)`\n\nTakes a node-style async function (`fn`) to ensure it's only called once. The function should accept a callback as its last parameter which is called with `cb(err, result)`. Returns a function that can be called any number of times but will only execute once. Arguments passed to the returned function will be passed to the `fn`.\n\n## License\n\nMIT\n\n\u003c!-- prettier-ignore-start --\u003e\n[downloads-image]: https://img.shields.io/npm/dm/async-once.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/async-once\n[npm-image]: https://img.shields.io/npm/v/async-once.svg?style=flat-square\n\n[ci-url]: https://github.com/gulpjs/async-once/actions?query=workflow:dev\n[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/async-once/dev.yml?branch=master\u0026style=flat-square\n\n[coveralls-url]: https://coveralls.io/r/gulpjs/async-once\n[coveralls-image]: https://img.shields.io/coveralls/gulpjs/async-once/master.svg?style=flat-square\n\u003c!-- prettier-ignore-end --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgulpjs%2Fasync-once","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgulpjs%2Fasync-once","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgulpjs%2Fasync-once/lists"}