{"id":16801793,"url":"https://github.com/mseal/clerx","last_synced_at":"2026-03-08T23:32:41.807Z","repository":{"id":42627730,"uuid":"394128899","full_name":"MSeal/clerx","owner":"MSeal","description":"💁⛑ Timely Suite of RxJS Operators and Observables","archived":false,"fork":false,"pushed_at":"2023-07-19T03:38:51.000Z","size":265,"stargazers_count":6,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T01:15:12.133Z","etag":null,"topics":["rate-limiter","rate-limiting","rxjs","semaphore","time"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MSeal.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":"2021-08-09T02:59:28.000Z","updated_at":"2023-12-15T01:40:24.000Z","dependencies_parsed_at":"2025-03-04T17:34:40.197Z","dependency_job_id":"b0a4671e-66fa-4f1a-95f5-075a72a3b1d8","html_url":"https://github.com/MSeal/clerx","commit_stats":null,"previous_names":["rgbkrk/clerx"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/MSeal/clerx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MSeal%2Fclerx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MSeal%2Fclerx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MSeal%2Fclerx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MSeal%2Fclerx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MSeal","download_url":"https://codeload.github.com/MSeal/clerx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MSeal%2Fclerx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30276957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T20:45:49.896Z","status":"ssl_error","status_checked_at":"2026-03-08T20:45:49.525Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["rate-limiter","rate-limiting","rxjs","semaphore","time"],"created_at":"2024-10-13T09:37:51.215Z","updated_at":"2026-03-08T23:32:41.790Z","avatar_url":"https://github.com/MSeal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clerx 💁\n\nA Timely Suite of RxJS Operators and Observables\n\n## Install\n\n```\nnpm install clerx\n```\n\n[Try out the example](https://stackblitz.com/edit/ugxk9f-c24puf?devtoolsheight=33\u0026file=index.ts)\n\n## Operators\n\nAs defined in the RxJS docs:\n\n\u003e[Operators](https://rxjs.dev/guide/operators) are the essential pieces that\n\u003e allow complex asynchronous code to be easily composed in a declarative manner.\n\u003e Operators are functions.\n\n### `rateLimiter(count, slidingWindowTime)`\n\nDefer sending events if `count` events occur within `slidingWindowTime` (milliseconds). Optionally, stop deferring if the wait time goes past `timeoutDue`. Returns an Observable.\n\n\n\n#### Examples\n\n**Only send two events within three seconds**\n\nIn this example, only 2 (`count`) events are sent during a 3 second\n(3000 ms `slidingWindowTime`) sliding window.  As displayed in the marble\ndiagram, additional events beyond 2 events in the sliding window will be\ndeferred.\n\n```\nabcdef--g---\n\n\u003e rateLimiter(2, 3000)\n\nab-cd-ef-g--\n```\n\n![rate-limiter](https://user-images.githubusercontent.com/836375/128755753-a8fc35d1-3f28-47b6-b4a3-c6b1a9115dde.png)\n\n**Only one event within five seconds**\n\nSimilarly, this example limits events to one (`count`) event in a five second\n(5000 ms `slidingWindowTime`) window. The marble diagram shows how the events are distributed over time.\n\n```\n-(abc)def\n\n\u003e rateLimiter(1, 5000)\n\n-a----b----c----d----e----f----\n```\n\n![rate-limit-five-tick](https://user-images.githubusercontent.com/836375/128755783-81846f03-3d23-4bfd-a4e8-7f4685e84cc5.png)\n\n## Observables\n\nAs defined in the RxJS docs:\n\n\u003e[Observables](https://rxjs.dev/guide/observable) are lazy Push collections of multiple values.\n\n### `postDelay(event: T, dueTime): Observable\u003cT\u003e`\n\nCreates an observable that emits the `event` then waits `dueTime` (milliseconds) before\nclosing the observable, like so:\n\n```\nevent--{ dueTime }--|\n```\n\n**Example: Delay 5 seconds after emitting an event**\n\n```\n\u003e postDelay(\"a\", 5000)\n\na----|\n```\n\n![post-delay](https://user-images.githubusercontent.com/836375/128756533-e76982b2-0e6c-417d-827f-06cb9cfe22ec.png)\n\n### `intervalBackoff(backoff: number): Observable\u003cnumber\u003e`\n\nCreates an Observable that emits sequential numbers in an exponentially increasing interval of time. `backoff` is the starting time interval, in milliseconds, and will exponentially increase with each event.\n\n**Example: Exponentially increase delay starting at a one second interval**\n\nThe marble diagram illustrates the exponentially growing duration between events.\n\n```\n\u003e intervalBackoff(1000)\n\n01-2---3-------4---------------5\n```\n\n![interval-backoff](https://user-images.githubusercontent.com/836375/128793044-e3b1506c-7a3e-451e-85a2-cd6e928adddf.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmseal%2Fclerx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmseal%2Fclerx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmseal%2Fclerx/lists"}