{"id":20625065,"url":"https://github.com/jasonsturges/sort-contiguous","last_synced_at":"2026-04-22T10:33:58.014Z","repository":{"id":57366227,"uuid":"339829885","full_name":"jasonsturges/sort-contiguous","owner":"jasonsturges","description":"Contiguous list sorting, similar to macOS Finder sort","archived":false,"fork":false,"pushed_at":"2022-03-27T05:43:42.000Z","size":145,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T04:55:29.772Z","etag":null,"topics":["array","array-sorting","contiguous","function-sort","npm","sort","sort-comparer"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasonsturges.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}},"created_at":"2021-02-17T19:14:25.000Z","updated_at":"2022-03-25T05:58:35.000Z","dependencies_parsed_at":"2022-08-23T20:10:37.243Z","dependency_job_id":null,"html_url":"https://github.com/jasonsturges/sort-contiguous","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jasonsturges/sort-contiguous","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Fsort-contiguous","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Fsort-contiguous/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Fsort-contiguous/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Fsort-contiguous/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonsturges","download_url":"https://codeload.github.com/jasonsturges/sort-contiguous/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Fsort-contiguous/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32132552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T08:34:57.708Z","status":"ssl_error","status_checked_at":"2026-04-22T08:34:55.583Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["array","array-sorting","contiguous","function-sort","npm","sort","sort-comparer"],"created_at":"2024-11-16T13:08:01.992Z","updated_at":"2026-04-22T10:33:57.998Z","avatar_url":"https://github.com/jasonsturges.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sort Contiguous\n\nContiguous list sorting, similar to macOS Finder sort.\n\nFor example, an array of: `[\"N1\", \"N10\", \"N100\", \"N2\"]`\n\n...would sort using the numerical suffix values, resulting in:\n\n    0: \"N1\"\n    1: \"N2\"\n    2: \"N10\"\n    3: \"N100\"\n\n\n# Getting Started\n\nTo install, execute:\n\n    npm i sort-contiguous\n\nThen, import into a project as:\n\n```js\nimport {\n  contiguousPrefixComparer,\n  contiguousSuffixComparer,\n  sortContiguousPrefix,\n  sortContiguousSuffix\n} from 'sort-contiguous'\n```\n\n\n# Usage\n\nThis package includes both sort comparer and utility functions for array sorting.\n\n## Using a Sort Comparer\n\nUse the comparer functions directly in your array `sort()` operations:\n\n### Suffix Comparer\n\nCompare numerical values at the end of a list using the contiguous suffix comparer:\n\n```js\nimport { contiguousSuffixComparer } from 'sort-contiguous';\n\nconst list = [\n  \"File 1\",\n  \"File 10\",\n  \"File 100\",\n  \"File 2\"\n];\n\nlet sorted = list.sort(contiguousSuffixComparer);\nconsole.log(sorted);\n```\n\nOutputs:\n\n    0: \"File 1\"\n    1: \"File 2\"\n    2: \"File 10\"\n    3: \"File 100\"\n\n### Prefix Comparer\n\nCompare numerical values at the beginning of a list using the contiguous prefix comparer:\n\n```js\nimport { contiguousPrefixComparer } from 'sort-contiguous';\n\nconst list = [\n  \"1 File\",\n  \"10 File\",\n  \"100 File\",\n  \"2 File\"\n];\n\nlet sorted = list.sort(contiguousPrefixComparer);\nconsole.log(sorted);\n```\n\nOutputs:\n\n    0: \"1 File\"\n    1: \"2 File\"\n    2: \"10 File\"\n    3: \"100 File\"\n\n\n## Using as a Function\n\nSort your array by calling either the prefix or suffix sort functions, and passing your array as a parameter.\n\n### Suffix Sort\n\nCompare numerical values at the end of a list by calling `sortContiguousSuffix()` to return the sorted array:\n\n```js\nimport { sortContiguousSuffix } from 'sort-contiguous';\n\nconst list = [\n  \"File 1\",\n  \"File 10\",\n  \"File 100\",\n  \"File 2\"\n];\n\nlet sorted = sortContiguousSuffix(list);\nconsole.log(sorted);\n```\n\nOutputs:\n\n    0: \"File 1\"\n    1: \"File 2\"\n    2: \"File 10\"\n    3: \"File 100\"\n\n### Prefix Sort\n\nCompare numerical values at the beginning of a list by calling `sortContiguousPrefix()` to return the sorted array:\n\n```js\nimport { sortContiguousPrefix } from 'sort-contiguous';\n\nconst list = [\n  \"1 File\",\n  \"10 File\",\n  \"100 File\",\n  \"2 File\"\n];\n\nlet sorted = sortContiguousPrefix(list);\nconsole.log(sorted);\n```\n\nOutputs:\n\n    0: \"1 File\"\n    1: \"2 File\"\n    2: \"10 File\"\n    3: \"100 File\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonsturges%2Fsort-contiguous","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonsturges%2Fsort-contiguous","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonsturges%2Fsort-contiguous/lists"}