{"id":17472560,"url":"https://github.com/shinnn/array-divide","last_synced_at":"2025-07-11T22:10:59.650Z","repository":{"id":57183933,"uuid":"29750362","full_name":"shinnn/array-divide","owner":"shinnn","description":"Divide an array into multiple arrays each of whom have the same number of items","archived":false,"fork":false,"pushed_at":"2018-12-06T19:17:00.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-28T11:08:53.876Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npm.runkit.com/array-divide","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/shinnn.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":"2015-01-23T19:56:11.000Z","updated_at":"2018-12-06T19:17:02.000Z","dependencies_parsed_at":"2022-08-23T01:21:05.626Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/array-divide","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/shinnn/array-divide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Farray-divide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Farray-divide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Farray-divide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Farray-divide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/array-divide/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Farray-divide/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264905192,"owners_count":23681360,"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":[],"created_at":"2024-10-18T17:26:55.807Z","updated_at":"2025-07-11T22:10:59.625Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# array-divide\n\n[![npm version](https://img.shields.io/npm/v/array-divide.svg)](https://www.npmjs.com/package/array-divide)\n[![Build Status](https://travis-ci.com/shinnn/array-divide.svg?branch=master)](https://travis-ci.com/shinnn/array-divide)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/array-divide.svg)](https://coveralls.io/github/shinnn/array-divide)\n\nDivide an `Array` into multiple `Array`s each of whom have the same number of items\n\n```javascript\narrayDivide(['a', 'b', 'c', 'd'], 2); //=\u003e [['a', 'b'], ['c', 'd']]\narrayDivide(['a', 'b', 'c', 'd'], 3); //=\u003e [['a', 'b', 'c'], ['d']]\n```\n\n## Installation\n\n[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).\n\n```\nnpm install array-divide\n```\n\n## API\n\n```javascript\nimport arrayDivide from 'array-divide';\n```\n\n### arrayDivide(*array*, *count*)\n\n*array*: `Array`  \n*count*: `number` (the maximum number of items)  \nReturn: `Array` (a new array and doesn't break the original one)\n\n```javascript\narrayDivide(['a', 'b', 'c', 'd'], 100); //=\u003e [['a', 'b', 'c', 'd']]\narrayDivide([], 100); //=\u003e []\n\narrayDivide(['a', 'b', 'c'], 0); // throw an error (count must be \u003e= 1)\narrayDivide(new Set(), 1); // throw an error (doesn't support array-like object)\n```\n\n## License\n\nCopyright (c) 2015 - 2018 [Shinnosuke Watanabe](https://github.com/shinnn)\n\nLicensed under [the MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Farray-divide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Farray-divide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Farray-divide/lists"}