{"id":18887666,"url":"https://github.com/bramus/js-range","last_synced_at":"2025-04-14T22:34:06.483Z","repository":{"id":57100617,"uuid":"435288733","full_name":"bramus/js-range","owner":"bramus","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-17T23:01:17.000Z","size":75,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T10:54:21.682Z","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/bramus.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":"2021-12-05T21:59:20.000Z","updated_at":"2025-01-16T07:23:31.000Z","dependencies_parsed_at":"2022-08-20T23:20:32.141Z","dependency_job_id":null,"html_url":"https://github.com/bramus/js-range","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fjs-range","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fjs-range/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fjs-range/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramus%2Fjs-range/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bramus","download_url":"https://codeload.github.com/bramus/js-range/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248973324,"owners_count":21191942,"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-11-08T07:38:52.746Z","updated_at":"2025-04-14T22:34:01.471Z","avatar_url":"https://github.com/bramus.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Range\n\nCreate an array containing a range of elements _(cfr. PHP's range)_\n\n## Installation\n\n```bash\nnpm i @bramus/range\n```\n\n## Usage / Example\n\n```js\nimport { range } from '@bramus/range';\n\nconst r1 = range(0, 12);\n// ~\u003e [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n\nconst r2 = range(7, 12);\n// ~\u003e [7, 8, 9, 10, 11, 12]\n\nconst r3 = range(0, 100, 10);\n// ~\u003e [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]\n```\n\n🔗 Try it out online in the playground: [https://codepen.io/bramus/pen/dyVMPxV](https://codepen.io/bramus/pen/dyVMPxV)\n\n## API\n\nThe exposed function has an API identical to [PHP's `range`](https://php.net/range) method:\n\n```js\nrange(start, end, step = 1);\n```\n\nParameters:\n\n- `start`: First value of the sequence.\n- `end`: The sequence is ended upon reaching the `end` value.\n- `step` _(default: 1)_: If a `step` value is given, it will be used as the increment between elements in the sequence. `step` should be given as a positive number. If not specified, step will default to `1`.\n\n## Limitations\n\nUnlike PHP's `range`, this function is limited to numbers only. In case you do want to get letters, combine `range()` with `Array.map()`.\n\n## License\n\n`@bramus/range` is released under the MIT public license. See the enclosed `LICENSE` for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramus%2Fjs-range","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbramus%2Fjs-range","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramus%2Fjs-range/lists"}