{"id":15561259,"url":"https://github.com/noahkamara/compoundpredicate","last_synced_at":"2025-09-05T00:33:42.600Z","repository":{"id":226466736,"uuid":"768343872","full_name":"NoahKamara/CompoundPredicate","owner":"NoahKamara","description":"A library for combining swift predicates","archived":false,"fork":false,"pushed_at":"2024-10-24T21:57:26.000Z","size":626,"stargazers_count":64,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-11T09:48:57.090Z","etag":null,"topics":["swift","swiftdata"],"latest_commit_sha":null,"homepage":"https://noahkamara.github.io/CompoundPredicate/documentation/compoundpredicate/","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/NoahKamara.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-06T23:00:18.000Z","updated_at":"2025-08-08T06:16:28.000Z","dependencies_parsed_at":"2025-09-05T00:32:36.281Z","dependency_job_id":null,"html_url":"https://github.com/NoahKamara/CompoundPredicate","commit_stats":null,"previous_names":["noahkamara/compoundpredicate"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/NoahKamara/CompoundPredicate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoahKamara%2FCompoundPredicate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoahKamara%2FCompoundPredicate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoahKamara%2FCompoundPredicate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoahKamara%2FCompoundPredicate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NoahKamara","download_url":"https://codeload.github.com/NoahKamara/CompoundPredicate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NoahKamara%2FCompoundPredicate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273694941,"owners_count":25151480,"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-09-04T02:00:08.968Z","response_time":61,"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":["swift","swiftdata"],"created_at":"2024-10-02T16:06:49.551Z","updated_at":"2025-09-05T00:33:42.552Z","avatar_url":"https://github.com/NoahKamara.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build \u0026 Test](https://github.com/NoahKamara/CompoundPredicate/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/NoahKamara/CompoundPredicate/actions/workflows/build-and-test.yml)\n\n## For Developers targeting macOS 14.4 / iOS 17.4 or later:\n\nThis [PR](https://github.com/apple/swift-foundation/pull/343) For Swift Foundation adds compound functionality to Predicates like so:\nIf you are targeting only those versions and above you should use this instead:\n\n```swift\nlet notTooShort = #Predicate\u003cBook\u003e { $0.pages \u003e 50 }\nlet notTooLong = #Predicate\u003cBook\u003e { $0.pages \u003c= 350 }\nlet titleFilter = #Predicate\u003cBook\u003e { $0.title.contains(\"Swift\") }\n\nlet filter = #Predicate\u003cBook\u003e {\n    (notTooShort.evaluate($0) \u0026\u0026 notTooLong.evaluate($0)) || titleFilter.evaluate($0)\n}\n```\n\n\n# CompoundPredicate\n\nCompoundPredicate aims to improve the Predicate system to enable combining multiple predicates after constructing them:\n\n```swift\nlet notTooShort = #Predicate\u003cBook\u003e {\n    $0.pages \u003e 50\n}\n\nlet notTooLong = #Predicate\u003cBook\u003e {\n    $0.pages \u003c= 350\n}\n\nlet lengthFilter = [notTooShort, notTooShort].conjunction()\n\n// Match Books that are just the right length\nlet titleFilter = #Predicate\u003cBook\u003e {\n    $0.title.contains(\"Swift\")\n}\n\n// Match Books that contain \"Swift\" in the title or\n// are just the right length\nlet filter = [lengthFilter, titleFilter].disjunction()\n```\n\n## Documentation\nThe documentation is available [here](https://noahkamara.github.io/CompoundPredicate/documentation/compoundpredicate/) and as Docc archive you can view using Xcode\n\n## Feedback\nPlease feel free to create an [Issue](https://github.com/NoahKamara/CompoundPredicate/issues), or even better contribute actively by creating a [pull request](https://github.com/NoahKamara/CompoundPredicate/pulls)\n\n## Implementation Progress\n- [x] Arithmetic (+, -, *, /, %)\n    - [x] `+`, `-`, `*` `PredicateExpressions.Arithmetic`\n    - [x] `/`  `PredicateExpressions.FloatDivision`\n    - [x] `/`  `PredicateExpressions.IntDivision`\n    - [x] `%`  `PredicateExpressions.IntRemainder`\n\n- [x] Unary minus `-` `PredicateExpressions.UnaryMinus`\n\n- [x] Range (..., ..\u003c)\n    - [x] `...` `PredicateExpressions.ClosedRange`\n    - [x] `..\u003c` `PredicateExpressions.Range`\n    - [x] `x..\u003cz).contains(y)` `PredicateExpressions.RangeExpressionContains`\n\n- [x] Comparison (\u003c, \u003c=, \u003e, \u003e=, ==, !=)\n    - [x] `\u003c`, `\u003c=`, `\u003e`, `\u003e=` `PredicateExpressions.Comparison`\n    - [x] `==` `PredicateExpressions.Equal`\n    - [x] `!=` `PredicateExpressions.NotEqual`\n\n- [x] Conditionals \u0026 Ternary (?:) `PredicateExpressions.Conditional`\n\n- [x] Boolean logic (\u0026\u0026, ||, !)\n    - [x] `\u0026\u0026` `PredicateExpressions.Conjunction`\n    - [x] `||` `PredicateExpressions.Disjunction`\n    - [x] `!`  `PredicateExpressions.Negation`\n\n- [x] Swift optionals (?, ??, !, flatMap(_:), if-let expressions)\n    - [x] `?`, `flatMap(_:)` `PredicateExpressions.OptionalFlatMap`\n    - [x] `??`, `if-let` `PredicateExpressions.NilCoalesce`\n\n- [x] Types (as, as?, as!, is)\n    - [x] `as?` `PredicateExpressions.ConditionalCast`\n    - [x] `as`, `as!` `PredicateExpressions.ForceCast`\n\n- [x] Sequence operations (allSatisfy(), filter(), contains(), contains(where:), starts(with:), max(), min())\n    - [x] `allSatisfy()` `PredicateExpressions.SequenceAllSatisfy`\n    - [x] `filter()`  `PredicateExpressions.Filter` [completion:: 2024-03-10]\n    - [x] `contains()`  `PredicateExpressions.SequenceContains` [completion:: 2024-03-10]\n    - [x] `contains(where:)` `PredicateExpressions.SequenceContainsWhere`\n    - [x] `starts(with:)` `PredicateExpressions.SequenceStartsWith`\n    - [x] `min()`  `PredicateExpressions.SequenceMinimum` [completion:: 2024-03-10]\n    - [x] `max()` `PredicateExpressions.SequenceMaximum`\n\n- [x] Subscript and member access ([], .)\n    - [x] `[0,1][0]` `PredicateExpressions.CollectionIndexSubscript`\n    - [x] `[\"a\": \"b\"][\"a\"]` `PredicateExpressions.DictionaryKeySubscript`\n    - [x] `[\"a\": \"b\"][\"a\", defaultValue: \"b\"]` `PredicateExpressions.DictionaryKeyDefaultValueSubscript`\n    - [x] `obj.someKey` `PredicateExpressions.KeyPath`\n\n- [x] String comparisons\n    - [x] `contains(_:)`  `PredicateExpressions.CollectionContainsCollection`\n    - [x] `localizedStandardContains(_:)`  `PredicateExpressions.StringLocalizedStandardContains`\n    - [x] `caseInsensitiveCompare(_:)` `PredicateExpressions.StringCaseInsensitiveCompare`\n    - [x] `localizedCompare(_:)` `PredicateExpressions.StringLocalizedCompare`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoahkamara%2Fcompoundpredicate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoahkamara%2Fcompoundpredicate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoahkamara%2Fcompoundpredicate/lists"}