{"id":15765562,"url":"https://github.com/azu/v8-stable-sort-case-study","last_synced_at":"2026-05-03T04:33:02.955Z","repository":{"id":66143772,"uuid":"163149165","full_name":"azu/v8-stable-sort-case-study","owner":"azu","description":"Stable sort case study.","archived":false,"fork":false,"pushed_at":"2018-12-26T07:30:49.000Z","size":2,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-05T12:42:39.570Z","etag":null,"topics":["nodejs","v8"],"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/azu.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"azu"}},"created_at":"2018-12-26T07:14:45.000Z","updated_at":"2018-12-26T08:49:53.000Z","dependencies_parsed_at":"2023-02-21T16:45:13.457Z","dependency_job_id":null,"html_url":"https://github.com/azu/v8-stable-sort-case-study","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fv8-stable-sort-case-study","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fv8-stable-sort-case-study/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fv8-stable-sort-case-study/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fv8-stable-sort-case-study/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azu","download_url":"https://codeload.github.com/azu/v8-stable-sort-case-study/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246457936,"owners_count":20780673,"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":["nodejs","v8"],"created_at":"2024-10-04T12:42:45.696Z","updated_at":"2026-05-03T04:33:02.888Z","avatar_url":"https://github.com/azu.png","language":"JavaScript","funding_links":["https://github.com/sponsors/azu"],"categories":[],"sub_categories":[],"readme":"# Stable sort case study\n\nNode.js 11(V8 7.0) use stable sort.\n\n- [Node v11.0.0 (Current) | Node.js](https://nodejs.org/en/blog/release/v11.0.0/)\n- [Getting things sorted in V8 · V8](https://v8.dev/blog/array-sort)\n\nIt means that `Array#sort` cause different result in some case.\n\n## Example\n\nWe want to arrange the array in descending order. \n\nIf you want to tests, do following commands. \n\n- Get Node.js 10 result: `npm run node10`\n- Get Node.js 11 result: `npm run node11`\n\n```js\nconst array = [\n    {\n        id: \"a\",\n        index: 0\n    },\n    {\n        id: \"b\",\n        index: 1\n    },\n    {\n        id: \"c\",\n        index: 1\n    },\n    {\n        id: \"d\",\n        index: 3\n    },\n    {\n        id: \"e\",\n        index: 2\n    }\n];\n\nconst sortedArray = array.sort((a, b) =\u003e {\n    if (a.index \u003c= b.index) {\n        return 1\n    } else {\n        return -1;\n    }\n});\n// Node.js@10: [ 'd', 'e', 'c', 'b', 'a' ]\n// Node.js@11: [ 'd', 'e', 'b', 'c', 'a' ]\nconsole.log(sortedArray.map(item =\u003e item.id));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fv8-stable-sort-case-study","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazu%2Fv8-stable-sort-case-study","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fv8-stable-sort-case-study/lists"}