{"id":17446013,"url":"https://github.com/jamen/pull-regenerate","last_synced_at":"2025-08-23T12:37:47.607Z","repository":{"id":96785176,"uuid":"130499652","full_name":"jamen/pull-regenerate","owner":"jamen","description":"A source that masks other sources over its lifetime.","archived":false,"fork":false,"pushed_at":"2018-04-21T18:06:08.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-02T11:24:18.982Z","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/jamen.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}},"created_at":"2018-04-21T18:05:56.000Z","updated_at":"2021-12-19T15:28:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4dc2651-4b97-48cb-a485-9f9b0ad566f2","html_url":"https://github.com/jamen/pull-regenerate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jamen/pull-regenerate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-regenerate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-regenerate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-regenerate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-regenerate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamen","download_url":"https://codeload.github.com/jamen/pull-regenerate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-regenerate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271747028,"owners_count":24813606,"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-08-23T02:00:09.327Z","response_time":69,"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-17T18:20:26.049Z","updated_at":"2025-08-23T12:37:47.587Z","avatar_url":"https://github.com/jamen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# pull-regenerate\n\n\u003e A source that masks other sources over its lifetime.\n\n## Install\n\n```sh\nnpm i pull-regenerate\n``` \n\n## Usage\n\n### `regenerate(initial, swap)`\n\nCreate a [`pull-stream` source][1] that masks other sources over its lifetime. Instead of aborting when the initial stream aborts, it uses a new source returned from `swap(nth, abort)`, where `nth` is the amount of times it has swapped and `abort` is a function that lets you actually abort.\n\nThe stream also has `abort()` and `set(stream)` methods attached.\n\n```js\nlet source = regenerate(\n    values([ 1, 2, 3 ]),\n    (nth, abort) =\u003e {\n        if (nth \u003e 10) return abort()\n        return values([ i + 1, i + 2, i + 3 ])\n    }\n)\n\nif (something) {\n    source.set(\n        values([0, 1, 2, 3])\n    )\n} else if (otherthing) {\n    source.abort()\n}\n\npull(\n    source,\n    collect((err, data) =\u003e {\n        console.log(data)\n    })\n)\n```\n\n[1]: https://github.com/pull-stream/pull-stream/blob/master/docs/spec.md#source-streams\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fpull-regenerate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamen%2Fpull-regenerate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fpull-regenerate/lists"}