{"id":19873568,"url":"https://github.com/febeling/resort","last_synced_at":"2025-05-02T10:30:31.145Z","repository":{"id":17150670,"uuid":"19917419","full_name":"febeling/Resort","owner":"febeling","description":"Simple comparators library for sorting in Objective-C","archived":false,"fork":false,"pushed_at":"2024-05-16T11:28:57.000Z","size":119,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T00:51:15.611Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/febeling.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2014-05-18T18:14:37.000Z","updated_at":"2024-05-16T11:29:01.000Z","dependencies_parsed_at":"2024-11-12T16:19:45.696Z","dependency_job_id":"dfbc6b40-e1fd-4ce9-8e4c-f2df970237b5","html_url":"https://github.com/febeling/Resort","commit_stats":{"total_commits":41,"total_committers":2,"mean_commits":20.5,"dds":"0.024390243902439046","last_synced_commit":"7836d15c28ba0038b326c93bb3608963bc8d0692"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/febeling%2FResort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/febeling%2FResort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/febeling%2FResort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/febeling%2FResort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/febeling","download_url":"https://codeload.github.com/febeling/Resort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252023109,"owners_count":21682133,"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":[],"created_at":"2024-11-12T16:19:11.596Z","updated_at":"2025-05-02T10:30:30.895Z","avatar_url":"https://github.com/febeling.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Resort\n\nResort is a small library that builds comparators from key paths,\ncombines separate comparators into compound ones, and can build\nreverse comparators.\n\n### Key Path Comparators\n\nSorting from a keyPath would be a very straightforward thing to do, if\nit weren't for the edge cases. This library deals with nil and NSNull\nvalues and offers special handling of those, like always-less and\nalways-greater comparison. It uses always-less as a pragmatic\ndefault. But if that's not what you need you can specify that `nil`\nshould always be treated as greater. Or you might want to fail fast\nand throw an exception.\n\nOrder is defined for the classes in Foundation that support it already\nvia `compare:` methods: `NSString`, `NSDate`, `NSNumber`,\n`NSIndexPath`, as well as their subclasses, e.g. `NSMutableString` and\n`NSDecimalNumber`.\n\nIn other cases, the comparator just performs the ordering on the\n`-description` of the object.\n\n### Compound Comparators\n\nComparators build from key paths are very similar to\nNSSortDescriptors, but the have the advantage to be easy to\ncombine. This is what the other half of the library is about, compound\ncomparators. Think of it as a simple, composable way to define a sort\norder with primary, secondary, and so on sort keys.\n\n## Usage\n\nTo run the example project; clone the repo, and run `pod install` from\nthe Example directory first.\n\nCreation and use of a keyPath comparator looks like this:\n\n```objc\nNSComparator comparator = [RESResort comparatorForKeyPath:@\"name\"];\nNSArray *sorted = [@[ z, a ] sortedArrayUsingComparator:comparator];\n```\n\nTwo comparators (keyPath based or otherwise) can be combined into a\ncompound comparator and used like this:\n\n```objc\nNSComparator nameComparator = [RESResort comparatorForKeyPath:@\"name\"];\nNSComparator countComparator = [RESResort comparatorForKeyPath:@\"count\"];\nNSComparator compoundComparator = [RESResort compoundComparatorWithComparatorArray:@[ nameComparator, countComparator ]];\nNSArray *sorted = [_array sortedArrayUsingComparator:compoundComparator];\n```\n\n## Requirements\n\nOnly Foundation framework. Tested on iOS 7 and OS X 10.9.\n\n## Author\n\nFlorian Ebeling, florian.ebeling@gmail.com\n\n## License\n\nResort is available under the MIT license. See the LICENSE file for\nmore info.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffebeling%2Fresort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffebeling%2Fresort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffebeling%2Fresort/lists"}