{"id":21223210,"url":"https://github.com/renddslow/tta","last_synced_at":"2025-03-15T01:29:55.138Z","repository":{"id":42922808,"uuid":"245018321","full_name":"Renddslow/tta","owner":"Renddslow","description":"Re-run a function until it passes a condition.","archived":false,"fork":false,"pushed_at":"2022-03-26T06:48:11.000Z","size":429,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T02:40:33.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/tta","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Renddslow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-04T22:35:48.000Z","updated_at":"2020-03-04T22:57:46.000Z","dependencies_parsed_at":"2022-08-23T20:31:00.925Z","dependency_job_id":null,"html_url":"https://github.com/Renddslow/tta","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Renddslow%2Ftta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Renddslow%2Ftta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Renddslow%2Ftta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Renddslow%2Ftta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Renddslow","download_url":"https://codeload.github.com/Renddslow/tta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243670950,"owners_count":20328555,"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-11-20T22:50:37.655Z","updated_at":"2025-03-15T01:29:55.116Z","avatar_url":"https://github.com/Renddslow.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tta\n\n\u003e If at first you don\u0026#39;t succeed, try try again.\n\nRun a function continually until it returns `true`.\n\n## Install\n\n```\n$ yarn add tta\n```\n\n## Usage\n\n```js\nimport tta from 'tta';\n\nimport fileExists from './fileExists';\nimport writeFile from './writeFile';\n\ntta(async () =\u003e !(await fileExists('.lock.json')), { wait: '3s' }).then(() =\u003e {\n  writeFile('some-file.txt', '🦄');\n});\n```\n\n## API\n\n### tta(condition, options)\n\n#### condition\n\nType: `object`\n\n| Param    | Default | Description                                                                                                                                                                 |\n| -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| wait     | `500ms` | The amount of time to wait between each check on the condition.                                                                                                             |\n| maxDepth | `25`    | By default tta will only repeat the conditional function call 25 times before bailing out and returning a rejected promise. You can increase this number if you're so bold. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenddslow%2Ftta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenddslow%2Ftta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenddslow%2Ftta/lists"}