{"id":15836987,"url":"https://github.com/afeiship/reorder-list","last_synced_at":"2025-04-01T16:33:47.971Z","repository":{"id":96088349,"uuid":"98637919","full_name":"afeiship/reorder-list","owner":"afeiship","description":"Reorder items by ids.","archived":false,"fork":false,"pushed_at":"2024-07-10T12:45:13.000Z","size":133,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-07T10:45:28.560Z","etag":null,"topics":["array","items","list","order","reorder","sync"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/afeiship.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2017-07-28T10:16:06.000Z","updated_at":"2024-07-20T06:29:37.000Z","dependencies_parsed_at":"2024-07-10T15:11:35.870Z","dependency_job_id":null,"html_url":"https://github.com/afeiship/reorder-list","commit_stats":null,"previous_names":["afeiship/reorder-list"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Freorder-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Freorder-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Freorder-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Freorder-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afeiship","download_url":"https://codeload.github.com/afeiship/reorder-list/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246670908,"owners_count":20815058,"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":["array","items","list","order","reorder","sync"],"created_at":"2024-10-05T15:20:24.625Z","updated_at":"2025-04-01T16:33:47.947Z","avatar_url":"https://github.com/afeiship.png","language":"TypeScript","readme":"# reorder-list\n\u003e Reorder items by ids.\n\n[![version][version-image]][version-url]\n[![license][license-image]][license-url]\n[![size][size-image]][size-url]\n[![download][download-image]][download-url]\n\n## installation\n```shell\nnpm install @jswork/reorder-list\n```\n\n## usage\n```js\nimport reorderList from '@jswork/reorder-list';\n\nconst steps = [\n  { id: 301, title: '安装包', step: 1 },\n  { id: 302, title: '添加 jsw-presets 工具', step: 2 },\n  { id: 303, title: '更新 astrojs', step: 3 },\n  { id: 304, title: '添加 image-zoom 插件', step: 4 },\n  { id: 305, title: '处理一个报错', step: 5 }\n];\n\nconst ids = [305, 302, 301, 303, 304]; // by id\nconst indexes = [4, 1, 0, 2, 3]; // by index\n\nconst result1 = reorderList(steps, ids, { field: 'id' });\nconst result2 = reorderList(steps, indexes);\nconsole.log(result1);\nconsole.log(result2);\n\n/*\n  const result = [\n    { id: 305, title: '处理一个报错', step: 5 },\n    { id: 302, title: '添加 jsw-presets 工具', step: 2 },\n    { id: 301, title: '安装包', step: 1 },\n    { id: 303, title: '更新 astrojs', step: 3 },\n    { id: 304, title: '添加 image-zoom 插件', step: 4 },\n  ]\n*/\n```\n\n## license\nCode released under [the MIT license](https://github.com/afeiship/reorder-list/blob/master/LICENSE.txt).\n\n[version-image]: https://img.shields.io/npm/v/@jswork/reorder-list\n[version-url]: https://npmjs.org/package/@jswork/reorder-list\n\n[license-image]: https://img.shields.io/npm/l/@jswork/reorder-list\n[license-url]: https://github.com/afeiship/reorder-list/blob/master/LICENSE.txt\n\n[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/reorder-list\n[size-url]: https://github.com/afeiship/reorder-list/blob/master/dist/index.min.js\n\n[download-image]: https://img.shields.io/npm/dm/@jswork/reorder-list\n[download-url]: https://www.npmjs.com/package/@jswork/reorder-list\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Freorder-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafeiship%2Freorder-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Freorder-list/lists"}