{"id":17218450,"url":"https://github.com/perliedman/trivial-compare","last_synced_at":"2025-03-25T14:25:30.576Z","repository":{"id":57380026,"uuid":"411677467","full_name":"perliedman/trivial-compare","owner":"perliedman","description":"Simplest possible JavaScript comparison function, as a module","archived":false,"fork":false,"pushed_at":"2021-09-29T13:22:05.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T15:08:27.858Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/perliedman.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-09-29T13:05:30.000Z","updated_at":"2021-09-29T13:22:08.000Z","dependencies_parsed_at":"2022-09-05T13:50:46.983Z","dependency_job_id":null,"html_url":"https://github.com/perliedman/trivial-compare","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/perliedman%2Ftrivial-compare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Ftrivial-compare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Ftrivial-compare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perliedman%2Ftrivial-compare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perliedman","download_url":"https://codeload.github.com/perliedman/trivial-compare/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245478680,"owners_count":20622020,"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-10-15T03:46:51.320Z","updated_at":"2025-03-25T14:25:30.542Z","avatar_url":"https://github.com/perliedman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"trivial-compare\n===============\n\nThe simplest possible compare function that can be used with JavaScript's `Array.prototype.sort`\nand any data type that gives reasonable results for the `\u003c` and `\u003e` comparison operators.\n\nIn practice, this means you can use this library to sort numbers as well as strings without caring\nwhat the elements actually are.\n\nI find myself dropping this tiny utility function in more or less any app I write, so now there's\na stupid npm module to stop this madness.\n\n(As an aside, it feels weird such a function would not be part of the standard library - I sort of\nhope this is a misunderstanding on my part and this library is just totally redundant, please drop\nme a note if there's a better way to do this!)\n\n## API\n\nThere's just a single function exported by this library:\n\n`compare(a, b)`\n\n`comapare` will return `-1` if `a \u003c b`, `1` if `a \u003e b` and `0` otherwise (if they are equal, in other words).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperliedman%2Ftrivial-compare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperliedman%2Ftrivial-compare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperliedman%2Ftrivial-compare/lists"}