{"id":16625520,"url":"https://github.com/aleclarson/slice-object","last_synced_at":"2025-08-13T15:31:36.380Z","repository":{"id":57363029,"uuid":"141187813","full_name":"aleclarson/slice-object","owner":"aleclarson","description":"Slice an object into a new array ⚡️","archived":false,"fork":false,"pushed_at":"2018-12-05T16:57:58.000Z","size":5,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-19T12:54:22.164Z","etag":null,"topics":["arguments","arrays","slice"],"latest_commit_sha":null,"homepage":"","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/aleclarson.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}},"created_at":"2018-07-16T19:59:28.000Z","updated_at":"2018-07-16T23:56:16.000Z","dependencies_parsed_at":"2022-09-08T12:31:09.180Z","dependency_job_id":null,"html_url":"https://github.com/aleclarson/slice-object","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/aleclarson/slice-object","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fslice-object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fslice-object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fslice-object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fslice-object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aleclarson","download_url":"https://codeload.github.com/aleclarson/slice-object/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleclarson%2Fslice-object/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270264573,"owners_count":24554794,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["arguments","arrays","slice"],"created_at":"2024-10-12T04:05:59.650Z","updated_at":"2025-08-13T15:31:35.985Z","avatar_url":"https://github.com/aleclarson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slice-object v1.2.0\n\nFastest way to slice an object into a new array.\n\nAlmost identical to `[].slice`, yet faster in all cases. The only difference: holes are filled in, which means sparse arrays are never returned. You can even use this function to convert a sparse array into a packed array!\n\n```typescript\nslice(obj: Object, start: number = 0, end: number = obj.length) : Array\n```\n\n### Usage\n\n```js\nconst slice = require('slice-object');\n\n// Works with any object that has a `length` property.\nconst obj = {\n  0: 0,\n  1: 1,\n  2: 2,\n  length: 3,\n};\nslice(obj);       // =\u003e [0, 1, 2]\nslice(obj, 1);    // =\u003e [1, 2]\nslice(obj, 1, 2); // =\u003e [1]\n\n// Perfect for `Arguments` objects.\nfunction args() { return arguments }\nslice(args(1, 2, 3, 4), 2); // =\u003e [3, 4]\n\n// Slicing arrays is faster, too!\nslice([1, 2, 3], 1); // =\u003e [2, 3]\n\n// When the start index is \u003e= the length, an empty array is returned.\nslice(args(1, 2), 2); // =\u003e []\n\n// When the start index is \u003e= the end index, an empty array is returned.\nslice(args(1, 2), 1, 1); // =\u003e []\n\n// Negative indexes are supported.\nslice(args(1, 2, 3), -2, -1); // =\u003e [2]\n\n// Create a packed array from a sparse array.\nconst arr = [];\narr[1] = 1;\narr.hasOwnProperty(0);        // =\u003e false\nslice(arr).hasOwnProperty(0); // =\u003e true\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleclarson%2Fslice-object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleclarson%2Fslice-object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleclarson%2Fslice-object/lists"}