{"id":20023217,"url":"https://github.com/carson-katri/require","last_synced_at":"2025-07-30T14:08:28.265Z","repository":{"id":102305200,"uuid":"273979296","full_name":"carson-katri/require","owner":"carson-katri","description":"Never write a long guard statement again","archived":false,"fork":false,"pushed_at":"2020-07-31T22:38:50.000Z","size":7,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T15:05:52.493Z","etag":null,"topics":["guard","helper-functions","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/carson-katri.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":"2020-06-21T20:32:37.000Z","updated_at":"2022-10-16T15:42:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"cef7ebb4-d095-4c3c-9571-ecc742010c97","html_url":"https://github.com/carson-katri/require","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/carson-katri%2Frequire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carson-katri%2Frequire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carson-katri%2Frequire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carson-katri%2Frequire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carson-katri","download_url":"https://codeload.github.com/carson-katri/require/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252423323,"owners_count":21745570,"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":["guard","helper-functions","swift"],"created_at":"2024-11-13T08:45:32.299Z","updated_at":"2025-05-05T01:31:45.173Z","avatar_url":"https://github.com/carson-katri.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Require\n\nYou ever notice that you're building super long `guard` statements, or have tons of guards in a row?\n```swift\nguard let id = player.id, let name = player.name, let status = player.status else {\n    throw \"Player might be missing fields id, name, and/or status\"\n}\n```\nInstead of that, just `require` those fields:\n```swift\nlet (id, name, status) = try require(from: player, \\.id, \\.name, \\.status)\n```\nThe `require` function creates those guards for you 🎉\n\nYou can pass up to 10 KeyPaths.\n\n## Installation\n* Add the Swift package\n\n*or*\n\n* Copy [Require.swift](Sources/Require/Require.swift) to your project.\n\n## Contributing\nThe source is generated with GYB (`brew install nshipster/formulae/gyb`), and formatted with [SwiftFormat](https://github.com/nicklockwood/SwiftFormat):\n```sh\ngyb Sources/Require/Require.swift.gyb -o Sources/Require/Require.swift --line-directive '' \u0026\u0026\nmint run nicklockwood/SwiftFormat Sources/Require/Require.swift \\\n    --wrapparameters after-first  \\\n    --wrapparameters after-first  \\\n    --wrapcollections after-first \\\n    --enable spaceInsideGenerics,spaceAroundGenerics,spaceInsideParens,spaceAroundParens,consecutiveSpaces,consecutiveBlankLines\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarson-katri%2Frequire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarson-katri%2Frequire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarson-katri%2Frequire/lists"}