{"id":20311099,"url":"https://github.com/mcmath/slice-like","last_synced_at":"2026-05-11T17:33:52.549Z","repository":{"id":57363049,"uuid":"55942333","full_name":"mcmath/slice-like","owner":"mcmath","description":"Creates an Array from a slice of an Array-like object","archived":false,"fork":false,"pushed_at":"2016-04-12T06:05:14.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-28T12:40:57.892Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/mcmath.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":"2016-04-11T04:45:23.000Z","updated_at":"2016-04-12T06:05:16.000Z","dependencies_parsed_at":"2022-09-08T12:31:20.259Z","dependency_job_id":null,"html_url":"https://github.com/mcmath/slice-like","commit_stats":null,"previous_names":["akim-mcmath/slice-like"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mcmath/slice-like","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmath%2Fslice-like","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmath%2Fslice-like/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmath%2Fslice-like/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmath%2Fslice-like/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcmath","download_url":"https://codeload.github.com/mcmath/slice-like/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmath%2Fslice-like/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32906125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-11T17:09:15.040Z","status":"ssl_error","status_checked_at":"2026-05-11T17:08:45.420Z","response_time":120,"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":[],"created_at":"2024-11-14T17:36:09.699Z","updated_at":"2026-05-11T17:33:52.533Z","avatar_url":"https://github.com/mcmath.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slice-like\n\n[![Version][version-badge]][npm]\n[![License][license-badge]][license]\n[![Build][build-badge]][travis]\n[![Coverage][coverage-badge]][coveralls]\n[![Dependencies][dependencies-badge]][gemnasium]\n\nCreates an Array from a slice of an Array-like object.\n\n## Install\n\nInstall via [npm][npm]:\n\n```sh\nnpm install --save slice-like\n```\n\n## Usage\n\n#### Convert an Array-like object to an Array\n\nPass any [Array-like][array-like] object \u0026mdash; an object with a `'length'`\nproperty and numerical indices \u0026mdash; in order to convert it to an\n[Array][array].\n\n```js\nconst sliceLike = require('slice-like');\n\nvar arrayLike = {\n  0: 'zero',\n  1: 'one',\n  length: 2\n};\n\nvar arr = sliceLike(arrayLike); // =\u003e ['zero', 'one'];\n```\n\n#### An Alternative to Rest Parameters\n\nThis module may be used in place of [rest parameters][rest-parameters] in\nenvironments where they are unsupported. Pass the [`arguments`][arguments]\nobject and the index at which the rest parameters start, as follows:\n\n```js\nfunction someFunction(firstParam, secondParam /*, ...restParams */) {\n  var restParams = sliceLike(arguments, 2);\n  // ...\n}\n```\n\n## API\n\n### `sliceLike(arrayLike, [start], [end])`\n\nSlices an [Array-like][array-like] object and returns an [Array][array]. Slicing\nbehavior is similar to the [`Array.prototype.slice()`][slice] method.\n\n#### Parameters\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eParam\u003c/th\u003e\n      \u003cth\u003eType\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n  \u003ctr\u003e\n    \u003ctd\u003earrayLike\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003eobject\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003e\n      An object with a \u003ccode\u003e'length'\u003c/code\u003e property and indexed elements,\n      e.g., the\n      \u003ca href=\"https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/arguments\"\u003e\n        arguments\n      \u003c/a\u003e object.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e[start]\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003e\n      The index at which to start the slice. The resulting Array includes the\n      start index. Defaults to the beginning of `arrayLike`.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e[end]\u003c/td\u003e\n    \u003ctd\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/td\u003e\n    \u003ctd\u003e\n      The index at which to end the slice. The resulting Array does not include\n      the end index. Defaults to the end of `arrayLike`.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n#### Returns\n\nType: `Array`\n\nThe resulting Array, sliced according to the `start` and/or `end` arguments if provided.\n\n## License\n\nCopyright \u0026copy; 2016 Akim McMath. Licensed under the [MIT License][license].\n\n[version-badge]: https://img.shields.io/npm/v/slice-like.svg?style=flat-square\n[license-badge]: https://img.shields.io/npm/l/slice-like.svg?style=flat-square\n[build-badge]: https://img.shields.io/travis/akim-mcmath/slice-like/master.svg?style=flat-square\n[coverage-badge]: https://img.shields.io/coveralls/akim-mcmath/slice-like/master.svg?style=flat-square\u0026service=github\n[dependencies-badge]: https://img.shields.io/gemnasium/akim-mcmath/slice-like.svg?style=flat-square\n\n[npm]: https://www.npmjs.com/package/slice-like\n[license]: LICENSE\n[travis]: https://travis-ci.org/akim-mcmath/slice-like\n[coveralls]: https://coveralls.io/github/akim-mcmath/slice-like?branch=master\n[gemnasium]: https://gemnasium.com/akim-mcmath/slice-like\n[slice]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/slice\n[array-like]: http://www.2ality.com/2013/05/quirk-array-like-objects.html\n[array]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array\n[rest-parameters]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/rest_parameters\n[arguments]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/arguments\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmath%2Fslice-like","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcmath%2Fslice-like","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmath%2Fslice-like/lists"}