{"id":24133445,"url":"https://github.com/projectwallace/css-time-sort","last_synced_at":"2025-09-19T04:31:18.710Z","repository":{"id":72073985,"uuid":"228087442","full_name":"projectwallace/css-time-sort","owner":"projectwallace","description":"Sort an array of CSS \u003ctime\u003e values.","archived":false,"fork":false,"pushed_at":"2024-05-05T08:26:30.000Z","size":78,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-22T14:08:14.199Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.projectwallace.com/oss","language":"JavaScript","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/projectwallace.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":"2019-12-14T20:54:38.000Z","updated_at":"2024-05-05T08:26:33.000Z","dependencies_parsed_at":"2024-05-10T01:00:25.530Z","dependency_job_id":null,"html_url":"https://github.com/projectwallace/css-time-sort","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.25,"last_synced_commit":"c86170fa5ab28884883bbf14778da0970fc1610c"},"previous_names":["bartveneman/css-time-sort"],"tags_count":3,"template":false,"template_full_name":"bartveneman/node-package-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectwallace%2Fcss-time-sort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectwallace%2Fcss-time-sort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectwallace%2Fcss-time-sort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectwallace%2Fcss-time-sort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectwallace","download_url":"https://codeload.github.com/projectwallace/css-time-sort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233550310,"owners_count":18692826,"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":"2025-01-11T23:37:55.524Z","updated_at":"2025-09-19T04:31:13.421Z","avatar_url":"https://github.com/projectwallace.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\t\u003ch1\u003ecss-time-sort\u003c/h1\u003e\n\t\u003cp\u003eSort an array of CSS \u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/time\" target=\"_blank\"\u003e\u0026lt;time\u0026gt;\u003c/a\u003e values.\u003c/p\u003e\n\u003c/div\u003e\n\n## Installation\n\n```sh\nnpm install css-time-sort\n```\n\n## Usage\n\n```js\nimport { convert, compare } from \"css-time-sort\";\n\n// Using `compare` will sort an array from short to long times:\nlet result = [\"3s\", \"2ms\"].sort(compare); // [\"2ms\", \"3s\"]\n\n// Converting time-like values converts the input to ms:\nconvert(\"1s\"); // 1000\nconvert(\"1ms\"); // 1\nconvert(\"+2ms\"); // 2\nconvert(\"var(--foo)\"); // Number.MAX_SAFE_INTEGER - 1\nconvert(\"bars\"); // Number.MAX_SAFE_INTEGER\n```\n\n## Notes\n\n- `var(--my-duration)` will be converted to `Number.MAX_SAFE_INTEGER - 1` so they will end up send-to-last when sorting an array\n- Values that can not be converted to a number properly are converted to `Number.MAX_SAFE_INTEGER` so they will end up last when sorting an array\n\n## Related projects\n\n- [css-unit-sort](https://github.com/cssstats/cssstats/tree/master/packages/css-unit-sort) - Sort css values no matter the unit, by CSSStats\n- [CSS Analyzer](https://github.com/projectwallace/css-analyzer) - A CSS analyzer that goes through your CSS to find all kinds of relevant statistics.\n- [CSS Code Quality Analyzer](https://github.com/projectwallace/css-code-quality) -\n  A Code Quality analyzer that tells you how maintainable, complex and performant your CSS is\n- [Wallace CLI](https://github.com/projectwallace/wallace-cli) - CLI tool for\n  @projectwallace/css-analyzer\n- [Color Sorter](https://github.com/projectwallace/color-sorter) - Sort CSS colors\n  by hue, saturation, lightness and opacity\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectwallace%2Fcss-time-sort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectwallace%2Fcss-time-sort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectwallace%2Fcss-time-sort/lists"}