{"id":15290764,"url":"https://github.com/tylim88/re-array-order","last_synced_at":"2026-02-24T12:05:05.322Z","repository":{"id":40421210,"uuid":"488772221","full_name":"tylim88/re-array-order","owner":"tylim88","description":"Reorder array from one index to another index with full type safety and comprehensive errors","archived":false,"fork":false,"pushed_at":"2022-11-10T16:18:13.000Z","size":665,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-29T05:45:09.481Z","etag":null,"topics":["npm-package","typescript"],"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/tylim88.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-05-04T23:31:22.000Z","updated_at":"2023-03-07T05:10:01.000Z","dependencies_parsed_at":"2022-08-09T20:00:30.721Z","dependency_job_id":null,"html_url":"https://github.com/tylim88/re-array-order","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tylim88/re-array-order","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tylim88%2Fre-array-order","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tylim88%2Fre-array-order/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tylim88%2Fre-array-order/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tylim88%2Fre-array-order/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tylim88","download_url":"https://codeload.github.com/tylim88/re-array-order/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tylim88%2Fre-array-order/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29781281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T10:45:18.109Z","status":"ssl_error","status_checked_at":"2026-02-24T10:45:09.911Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["npm-package","typescript"],"created_at":"2024-09-30T16:09:22.188Z","updated_at":"2026-02-24T12:05:05.306Z","avatar_url":"https://github.com/tylim88.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable MD010 --\u003e\n\u003c!-- markdownlint-disable MD033 --\u003e\n\u003c!-- markdownlint-disable MD041 --\u003e\n\n# Re-Array-Order\n\n\u003cdiv\u003e\n\t\t\u003ca href=\"https://www.npmjs.com/package/re-array-order\" target=\"_blank\"\u003e\n\t\t\t\t\u003cimg\n\t\t\t\t\tsrc=\"https://img.shields.io/npm/v/re-array-order\"\n\t\t\t\t\talt=\"Created by tylim88\"\n\t\t\t\t/\u003e\n\t\t\t\u003c/a\u003e\n\t\t\t\u0026nbsp;\n\t\t\t\u003ca\n\t\t\t\thref=\"https://github.com/tylim88/re-array-order/blob/main/LICENSE\"\n\t\t\t\ttarget=\"_blank\"\n\t\t\t\u003e\n\t\t\t\t\u003cimg\n\t\t\t\t\tsrc=\"https://img.shields.io/github/license/tylim88/re-array-order\"\n\t\t\t\t\talt=\"License\"\n\t\t\t\t/\u003e\n\t\t\t\u003c/a\u003e\n\t\t\t\u0026nbsp;\n\t\t\t\u003ca\n\t\t\t\thref=\"https://www.npmjs.com/package/re-array-order?activeTab=dependencies\"\n\t\t\t\ttarget=\"_blank\"\n\t\t\t\u003e\n\t\t\t\t\u003cimg\n\t\t\t\t\tsrc=\"https://img.shields.io/badge/dynamic/json?url=https://api.npmutil.com/package/re-array-order\u0026label=dependencies\u0026query=$.dependencies.count\u0026color=green\"\n\t\t\t\t\talt=\"dependency count\"\n\t\t\t\t/\u003e\n\t\t\t\u003c/a\u003e\n\t\t\t\u0026nbsp;\n\t\t\t\u003ca href=\"https://github.com/tylim88/re-array-order/actions\" target=\"_blank\"\u003e\n\t\t\t\t\u003cimg\n\t\t\t\t\tsrc=\"https://github.com/tylim88/re-array-order/workflows/Main/badge.svg\"\n\t\t\t\t\talt=\"github action\"\n\t\t\t\t/\u003e\n\t\t\t\u003c/a\u003e\n\t\t\t\u0026nbsp;\n\t\t\t\u003ca href=\"https://codecov.io/gh/tylim88/re-array-order\" target=\"_blank\"\u003e\n\t\t\t\t\u003cimg\n\t\t\t\t\tsrc=\"https://codecov.io/gh/tylim88/re-array-order/branch/main/graph/badge.svg\"\n\t\t\t\t\talt=\"code coverage\"\n\t\t\t\t/\u003e\n\t\t\t\u003c/a\u003e\n\t\t\t\u0026nbsp;\n\t\t\t\u003ca href=\"https://github.com/tylim88/re-array-order/issues\" target=\"_blank\"\u003e\n\t\t\t\t\u003cimg\n\t\t\t\t\talt=\"GitHub issues\"\n\t\t\t\t\tsrc=\"https://img.shields.io/github/issues-raw/tylim88/re-array-order\"\n\t\t\t\t\u003e\u003c/img\u003e\n\t\t\t\u003c/a\u003e\n\t\t\t\u0026nbsp;\n\t\t\t\u003ca href=\"https://snyk.io/test/github/tylim88/re-array-order\" target=\"_blank\"\u003e\n\t\t\t\t\u003cimg\n\t\t\t\t\tsrc=\"https://snyk.io/test/github/tylim88/re-array-order/badge.svg\"\n\t\t\t\t\talt=\"code coverage\"\n\t\t\t\t/\u003e\n\t\t\t\u003c/a\u003e\n\t\t\t\u0026nbsp;\n\t\t\t\u003ca\n\t\t\t\thref=\"https://lgtm.com/projects/g/tylim88/re-array-order/alerts/\"\n\t\t\t\ttarget=\"_blank\"\n\t\t\t\u003e\n\t\t\t\t\u003cimg\n\t\t\t\t\talt=\"Total alerts\"\n\t\t\t\t\tsrc=\"https://img.shields.io/lgtm/alerts/g/tylim88/re-array-order.svg?logo=lgtm\u0026logoWidth=18\"\n\t\t\t\t/\u003e\n\t\t\t\u003c/a\u003e\n\t\t\t\u0026nbsp;\n\t\t\t\u003ca\n\t\t\t\thref=\"https://lgtm.com/projects/g/tylim88/re-array-order/context:javascript\"\n\t\t\t\ttarget=\"_blank\"\n\t\t\t\u003e\n\t\t\t\t\u003cimg\n\t\t\t\t\talt=\"Language grade: JavaScript\"\n\t\t\t\t\tsrc=\"https://img.shields.io/lgtm/grade/javascript/g/tylim88/re-array-order.svg?logo=lgtm\u0026logoWidth=18\"\n\t\t\t\t/\u003e\n\t\t\t\u003c/a\u003e\n\n\u003c/div\u003e\n\u003cbr/\u003e\n\n## Installation\n\n```bash\nnpm i re-array-order\n```\n\n## Usage\n\nreturn a deeply cloned array\n\n```ts\nimport { reorder } from 're-array-order'\n\nconst arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n\nreorder(arr, { from: 0, to: 9 }) // [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]\n\nreorder(arr, { from: 7, to: 3 }) // [0, 1, 2, 7, 4, 5, 6, 3, 8, 9]\n```\n\nthrow error if `from` or `to` is invalid\n\n```ts\nimport { reorder } from 're-array-order'\n\nconst arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n\nreorder(arr, { from: 10, to: 0 }) // from out of range\nreorder(arr, { from: 0, to: 10 }) // to out of range\nreorder(arr, { from: 1, to: -1 as number }) // to smaller than 0\nreorder(arr, { from: -1 as number, to: 1 }) // from smaller than 0\nreorder(arr, { from: 1, to: 1.34 as number }) // to is not an integer\nreorder(arr, { from: 0.237 as number, to: 1 }) // from is not an integer\nreorder([], { from: 0 as number, to: 0 }) // empty array\n```\n\n## Block invalid number\n\nTypescript will stop you from using fresh negative number and fresh decimal number.\n\n`fresh` refer to value that is not attached to any variable.\n\n`number` is a valid type.\n\n```ts\nimport { reorder } from 're-array-order'\n\nconst arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n\nreorder(arr, {\n\t// @ts-expect-error\n\tfrom: -1,\n\t// @ts-expect-error\n\tto: -9,\n})\n\nreorder(arr, {\n\t// @ts-expect-error\n\tfrom: 1.4233,\n\t// @ts-expect-error\n\tto: 8.82738,\n})\n\nreorder(arr, {\n\t// @ts-expect-error\n\tfrom: -1.4233,\n\t// @ts-expect-error\n\tto: -8.82738,\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftylim88%2Fre-array-order","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftylim88%2Fre-array-order","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftylim88%2Fre-array-order/lists"}