{"id":27001806,"url":"https://github.com/manferlo81/args-to-arr","last_synced_at":"2025-04-04T04:20:10.490Z","repository":{"id":34649025,"uuid":"182045065","full_name":"manferlo81/args-to-arr","owner":"manferlo81","description":"Converts arguments or any other array-like object into an array starting from specific index.","archived":false,"fork":false,"pushed_at":"2025-03-04T00:09:18.000Z","size":3666,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T16:08:08.166Z","etag":null,"topics":["arguments","array","array-like","convert","params","rest","slice","to-array"],"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/manferlo81.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-18T08:09:48.000Z","updated_at":"2025-02-08T09:28:28.000Z","dependencies_parsed_at":"2024-09-12T17:57:02.963Z","dependency_job_id":"4fb7927c-557d-4116-a222-083732746921","html_url":"https://github.com/manferlo81/args-to-arr","commit_stats":{"total_commits":867,"total_committers":5,"mean_commits":173.4,"dds":0.566320645905421,"last_synced_commit":"81fa2fd3229138ab46bfe7235faf942db66771b1"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manferlo81%2Fargs-to-arr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manferlo81%2Fargs-to-arr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manferlo81%2Fargs-to-arr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manferlo81%2Fargs-to-arr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manferlo81","download_url":"https://codeload.github.com/manferlo81/args-to-arr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247118646,"owners_count":20886591,"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":["arguments","array","array-like","convert","params","rest","slice","to-array"],"created_at":"2025-04-04T04:20:09.835Z","updated_at":"2025-04-04T04:20:10.479Z","avatar_url":"https://github.com/manferlo81.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# args-to-arr\n\n[![CircleCI](https://circleci.com/gh/manferlo81/args-to-arr.svg?style=svg)](https://circleci.com/gh/manferlo81/args-to-arr)\n[![npm](https://badgen.net/npm/v/args-to-arr)](https://www.npmjs.com/package/args-to-arr)\n[![codecov](https://codecov.io/gh/manferlo81/args-to-arr/branch/master/graph/badge.svg)](https://codecov.io/gh/manferlo81/args-to-arr)\n[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/args-to-arr/badge?style=rounded)](https://www.jsdelivr.com/package/npm/args-to-arr)\n[![packagephobia](https://badgen.net/packagephobia/install/args-to-arr)](https://packagephobia.now.sh/result?p=args-to-arr)\n[![bundlephobia](https://badgen.net/bundlephobia/min/args-to-arr)](https://bundlephobia.com/result?p=args-to-arr)\n[![types](https://img.shields.io/npm/types/args-to-arr.svg)](https://github.com/microsoft/typescript)\n[![Known Vulnerabilities](https://snyk.io/test/github/manferlo81/args-to-arr/badge.svg?targetFile=package.json)](https://snyk.io/test/github/manferlo81/args-to-arr?targetFile=package.json)\n[![license](https://badgen.net/github/license/manferlo81/args-to-arr)](LICENSE)\n\nConverts `arguments` or any other `array-like` object into an `array` starting from specific index.\n\n*Inspired by how Typescript handles `...rest` arguments.*\n\n## Install\n\n```bash\nnpm i args-to-arr\n```\n\n## CDN\n\n### jsDelivr\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/args-to-arr@latest/dist/umd/args-to-arr.umd.js\"\u003e\u003c/script\u003e\n```\n\n***for production***\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/args-to-arr@latest/dist/umd/args-to-arr.umd.min.js\"\u003e\u003c/script\u003e\n```\n\n*[more options...](https://www.jsdelivr.com/package/npm/args-to-arr?version=latest)*\n\n### unpkg\n\n```html\n\u003cscript src=\"https://unpkg.com/args-to-arr@latest/dist/umd/args-to-arr.umd.js\"\u003e\u003c/script\u003e\n```\n\n***for production***\n\n```html\n\u003cscript src=\"https://unpkg.com/args-to-arr@latest/dist/umd/args-to-arr.umd.min.js\"\u003e\u003c/script\u003e\n```\n\n*[more options...](https://unpkg.com/args-to-arr@latest/)*\n\n## Usage\n\n### Node.js\n\n```javascript\nconst toArray = require(\"args-to-arr\");\nconst array = toArray(arrayLike, start);\n```\n\n### Browser\n\n*After adding the* `script` *tag,* `toArray` *function will be available globally.*\n\n```javascript\nconst array = toArray(arrayLike, start);\n```\n\n## Reference\n\n***example***\n\n```javascript\nimport toArray from \"args-to-arr\";\n\nfunction anything(firstArg) {\n\n  // convert arguments to array\n  // starting from argument 1\n  // it won't include firstArg\n  const args = toArray(arguments, 1);\n\n  // do something with the array\n\n}\n```\n\n***syntax***\n\n```typescript\ntoArray\u003cT\u003e(arr: ArrayLike\u003cT\u003e, start: number = 0): T[];\n```\n\n### return\n\n*type*: `Array`\n\n*It returns a new array based on the provided parameters.*\n\n### arr\n\n*type*: `Array` | `ArrayLike`\n\n*Array or Array-like object to be converted to a new array.*\n\n### start\n\n*type*: `number`\n*default*: `0`\n\n*Index number for array convertion to start from. If not provided or it equals* `null` *or* `undefined` *it will default to* `0`*.*\n\n*Providing a negative start index will cause the function to start iterating* `X` *items from the end of the array, see the following example.*\n\n***example***\n\n```javascript\nconst array = toArray([1, 2, 3, 4], -2);\nconsole.log(array);\n```\n\n```console\n[ 3, 4 ]\n```\n\n*If the provided negative start index exceeds the size of the array, it will fill the begining of the resulting array with* `empty` *values.*\n\n***example***\n\n```javascript\nconst array = toArray([1, 2], -4);\nconsole.log(array);\n```\n\n```console\n[ \u003c2 empty items\u003e, 1, 2 ]\n```\n\n## License\n\n[MIT](LICENSE) \u0026copy; [Manuel Fernández](https://github.com/manferlo81)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanferlo81%2Fargs-to-arr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanferlo81%2Fargs-to-arr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanferlo81%2Fargs-to-arr/lists"}