{"id":21407428,"url":"https://github.com/palashmon/array-reverser","last_synced_at":"2025-07-14T00:33:51.552Z","repository":{"id":231448455,"uuid":"781430596","full_name":"palashmon/array-reverser","owner":"palashmon","description":"Seamlessly reverse arrays or segments with ease","archived":false,"fork":false,"pushed_at":"2024-11-15T20:23:51.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-15T21:25:16.459Z","etag":null,"topics":["array","invert","javascript","partial","portion","reversal","reverse","segment","slice","typescript","utility"],"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/palashmon.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":"2024-04-03T11:18:33.000Z","updated_at":"2024-11-15T20:23:54.000Z","dependencies_parsed_at":"2024-06-23T23:27:21.625Z","dependency_job_id":"361ec03f-ac54-4adc-801c-ee26ef8f34d2","html_url":"https://github.com/palashmon/array-reverser","commit_stats":null,"previous_names":["palashmon/array-reverser"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palashmon%2Farray-reverser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palashmon%2Farray-reverser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palashmon%2Farray-reverser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palashmon%2Farray-reverser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palashmon","download_url":"https://codeload.github.com/palashmon/array-reverser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225934431,"owners_count":17547737,"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","invert","javascript","partial","portion","reversal","reverse","segment","slice","typescript","utility"],"created_at":"2024-11-22T16:52:18.409Z","updated_at":"2024-11-22T16:52:19.089Z","avatar_url":"https://github.com/palashmon.png","language":"TypeScript","readme":"# array-reverser ![CI](https://github.com/palashmon/array-reverser/actions/workflows/main.yml/badge.svg)\n\n\u003e Seamlessly reverse arrays or segments with ease\n\n`array-reverser` is a lightweight, easy-to-use npm package designed to reverse arrays or specific portions of arrays with precision and efficiency. Whether you need to invert the entire array or just a segment, `array-reverser` handles it effortlessly.\n\n## Features\n\n- **Flexible:** Reverse entire arrays or specify start and end indices for partial reversal.\n- **Type-Safe:** Written in TypeScript, providing type safety for TypeScript projects.\n- **Error Handling:** Robust error handling for invalid inputs and parameters.\n- **Immutability:** Ensures immutability by returning a new array instance, preserving the original array.\n- **Easy to Use:** Simple, intuitive API that integrates seamlessly into any project.\n\n## Install\n\n```sh\nnpm install array-reverser\n```\n\nOr with yarn:\n\n```sh\nyarn add array-reverser\n```\n\n## Usage\n\nImport `array-reverser` into your project:\n\n```typescript\nimport arrayReverser from \"array-reverser\";\n```\n\nReverse an entire array:\n\n```typescript\nconst array = [1, 2, 3, 4, 5];\nconst reversedArray = arrayReverser(array);\nconsole.log(reversedArray);\n//=\u003e [5, 4, 3, 2, 1]\n```\n\nReverse a segment of an array:\n\n```typescript\nconst array = [1, 2, 3, 4, 5];\nconst reversedArray = arrayReverser(array, 1, 4);\nconsole.log(reversedArray);\n//=\u003e [1, 4, 3, 2, 5]\n```\n\nReturn a new array instance and preserve the original array:\n\n```typescript\nconst array = [1, 2, 3, 4, 5];\nconst reversedArray = arrayReverser(array);\n\nreversedArray[0] = 10; // Mutate the reversed array\nconsole.log(array[0]); //=\u003e 1\n```\n\n## API\n\n### arrayReverser(array, start?, end?)\n\n#### array\n\nType: `Array`\u003cbr\u003e\nThe array to reverse.\n\n#### start\n\nType: `number`\u003cbr\u003e\nDefault: `0`\n\nThe index at which to start reversing the array. If not provided, the array will be reversed from the beginning. This index is inclusive and will be included in the reversed array.\n\n#### end\n\nType: `number`\u003cbr\u003e\nDefault: `array.length`\n\nThe index at which to stop reversing the array. This index is exclusive and will not be included in the reversed array. If not provided, defaults to `arr.length`, and the element at the `end` index is included in the reversal and the array will be reversed from the `start` index to the end of the array.\n\n## License\n\nMIT © [Palash Mondal](https://github.com/palashmon)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalashmon%2Farray-reverser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalashmon%2Farray-reverser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalashmon%2Farray-reverser/lists"}