{"id":16126180,"url":"https://github.com/mattdesl/array-range","last_synced_at":"2025-08-18T03:37:53.006Z","repository":{"id":23051428,"uuid":"26404606","full_name":"mattdesl/array-range","owner":"mattdesl","description":"creates a new array with given range","archived":false,"fork":false,"pushed_at":"2022-01-04T03:52:42.000Z","size":124,"stargazers_count":25,"open_issues_count":4,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-09T01:38:58.946Z","etag":null,"topics":[],"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/mattdesl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-09T18:23:49.000Z","updated_at":"2022-04-18T19:31:30.000Z","dependencies_parsed_at":"2022-07-08T02:46:53.200Z","dependency_job_id":null,"html_url":"https://github.com/mattdesl/array-range","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mattdesl/array-range","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdesl%2Farray-range","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdesl%2Farray-range/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdesl%2Farray-range/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdesl%2Farray-range/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattdesl","download_url":"https://codeload.github.com/mattdesl/array-range/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattdesl%2Farray-range/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270940594,"owners_count":24671676,"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-18T02:00:08.743Z","response_time":89,"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":[],"created_at":"2024-10-09T21:36:13.434Z","updated_at":"2025-08-18T03:37:52.977Z","avatar_url":"https://github.com/mattdesl.png","language":"JavaScript","readme":"# array-range\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\nTiny module to create a new dense array with the specified range. \n\n```js\nvar range = require('array-range')\nrange(3)       // -\u003e [ 0, 1, 2 ]\nrange(1, 4)    // -\u003e [ 1, 2, 3 ]\n```\n\nMainly useful for functional programming. ES6 examples:  \n\n```js\nvar array = require('array-range')\n\narray(5).map( x =\u003e x*x )\n// -\u003e [ 0, 1, 4, 9, 16 ]\n\narray(2, 10).filter( x =\u003e x%2===0 )\n// -\u003e [ 2, 4, 6, 8 ]\n```\n\nIt can also be useful for creating a fixed size dense array. Cleaner than `apply` and does not create an intermediate array:  \n\n```js\narray(5)\n\n//vs.\n\nArray.apply(null, new Array(5))\n```\n\n## Usage\n\n[![NPM](https://nodei.co/npm/array-range.png)](https://nodei.co/npm/array-range/)\n\n#### `array(start, end)`\n\nCreates a new dense array with a length of `end-start` elements. `start` is inclusive, `end` is exclusive. Negative values also work, e.g. `range(-10, 10)`\n\n#### `array(len)`\n\nCreates a new dense array with `len` number of elements, from zero to `len-1`. \n\nIf `len` is unspecified, it defaults to zero (empty array). \n\n## License\n\nMIT, see [LICENSE.md](http://github.com/mattdesl/array-range/blob/master/LICENSE.md) for details.\n","funding_links":[],"categories":["模块","Modules"],"sub_categories":["数组","Array"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattdesl%2Farray-range","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattdesl%2Farray-range","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattdesl%2Farray-range/lists"}