{"id":24567323,"url":"https://github.com/autonomoussoftware/promise-limit-one","last_synced_at":"2026-03-10T08:04:18.739Z","repository":{"id":48894467,"uuid":"172121324","full_name":"autonomoussoftware/promise-limit-one","owner":"autonomoussoftware","description":"Wrap a function so if called multiple times, only one call runs simultaneously","archived":false,"fork":false,"pushed_at":"2021-07-06T17:48:18.000Z","size":46,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T10:52:12.563Z","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/autonomoussoftware.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":"2019-02-22T19:13:41.000Z","updated_at":"2023-09-10T04:20:23.000Z","dependencies_parsed_at":"2022-09-26T20:20:31.635Z","dependency_job_id":null,"html_url":"https://github.com/autonomoussoftware/promise-limit-one","commit_stats":null,"previous_names":["autonomoussoftware/promise-not-if-busy"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fpromise-limit-one","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fpromise-limit-one/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fpromise-limit-one/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomoussoftware%2Fpromise-limit-one/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autonomoussoftware","download_url":"https://codeload.github.com/autonomoussoftware/promise-limit-one/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250243849,"owners_count":21398407,"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":"2025-01-23T13:17:47.436Z","updated_at":"2025-10-20T01:43:04.429Z","avatar_url":"https://github.com/autonomoussoftware.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# promise-limit-one\n\n[![Build Status](https://travis-ci.com/autonomoussoftware/promise-limit-one.svg?branch=master)](https://travis-ci.com/autonomoussoftware/promise-limit-one)\n\nWrap a function so if called multiple times, only one call runs simultaneously.\n\n*Note*: This package replaces `promise-not-if-busy`, which is now deprecated.\n\n## Installation\n\n```shell\nnpm install promise-limit-one\n```\n\n## Usage\n\n```js\nconst limitOne = require('promise-limit-one')\n\nconst longOperation = () =\u003e new Promise(function (resolve) {\n  console.log('Executing a long operation...')\n  setTimeout(resolve, 100)\n})\n\nconst wrapped = limitOne(longOperation)\n\nwrapped() // will print \"Executing...\"\nwrapped() // will do nothing\n\nsetTimeout(function () {\n  wrapped() // will print \"Executing...\" again\n}, 150)\n```\n\n## API\n\n### `limitOne(fn, err)`\n\nCreates a function that when called multiple times will call `fn` and wait for it to finish before calling `fn` again. \n\nIf `err` is supplied and the function is running, any new call will reject with `err`.\n\n#### Params\n\n`fn`:\nFunction that returns a promise.\n\n#### Returns\n\nA function that wraps `fn` up.\nIt will return a promise that will resolve to the result of calling `fn`.\nWhile `fn` is busy, it will resolve to the pending promise.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautonomoussoftware%2Fpromise-limit-one","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautonomoussoftware%2Fpromise-limit-one","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautonomoussoftware%2Fpromise-limit-one/lists"}