{"id":18060636,"url":"https://github.com/0xleif/closure","last_synced_at":"2025-04-05T12:22:54.851Z","repository":{"id":63900775,"uuid":"413625547","full_name":"0xLeif/Closure","owner":"0xLeif","description":"Define and chain Closures with Inputs and Outputs","archived":false,"fork":false,"pushed_at":"2021-10-05T00:36:53.000Z","size":2,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T14:03:36.073Z","etag":null,"topics":["chain","closure","closures","functional-programming","functions","scope","state","swift","then","thenable"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/0xLeif.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":"2021-10-05T00:35:53.000Z","updated_at":"2022-05-18T22:56:56.000Z","dependencies_parsed_at":"2023-01-14T12:45:47.699Z","dependency_job_id":null,"html_url":"https://github.com/0xLeif/Closure","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FClosure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FClosure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FClosure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xLeif%2FClosure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xLeif","download_url":"https://codeload.github.com/0xLeif/Closure/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247334065,"owners_count":20922135,"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":["chain","closure","closures","functional-programming","functions","scope","state","swift","then","thenable"],"created_at":"2024-10-31T04:10:00.288Z","updated_at":"2025-04-05T12:22:54.831Z","avatar_url":"https://github.com/0xLeif.png","language":"Swift","readme":"# Closure\n\n*Define and chain Closures with Inputs and Outputs*\n\n\n## Examples\n\n**No Scoped State**\n```swift\nlet noStateCount = Closure\u003cString, String\u003e { text in\n  String(repeating: text, count: 4)\n}\n.then { string in\n  Int(string) ?? 0\n}\n\n\nXCTAssertEqual(noStateCount.method(\"5\"), 5555)\nXCTAssertEqual(noStateCount.method(\"5\"), 5555)\nXCTAssertEqual(noStateCount.method(\"5\"), 5555)\n```\n\n**Scoped State**\n```swift\nlet stateCount: Closure\u003cString, Int\u003e = Closure\u003cString, String\u003e {\n  var count = 1\n  \n  return { text in\n    defer {\n      count += 1\n    }\n    \n    return String(repeating: text, count: count)\n  }\n}\n.then { string in\n  Int(string) ?? 0\n}\n\nXCTAssertEqual(stateCount.method(\"5\"), 5)\nXCTAssertEqual(stateCount.method(\"5\"), 55)\nXCTAssertEqual(stateCount.method(\"5\"), 555)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xleif%2Fclosure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xleif%2Fclosure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xleif%2Fclosure/lists"}