{"id":22200408,"url":"https://github.com/iaseth/jslice","last_synced_at":"2026-05-02T13:35:08.875Z","repository":{"id":163956449,"uuid":"638750713","full_name":"iaseth/jslice","owner":"iaseth","description":"Jslice is a small JavaScript/TypeScript library for slicing arrays using slice strings.","archived":false,"fork":false,"pushed_at":"2023-05-12T11:02:23.000Z","size":73,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-03T22:19:50.955Z","etag":null,"topics":["javascript","josn","pythonic","slice","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/iaseth.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-10T02:59:38.000Z","updated_at":"2023-05-10T06:23:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"a72af71e-ed6e-4d3f-89ee-71f7c8400edc","html_url":"https://github.com/iaseth/jslice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iaseth/jslice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fjslice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fjslice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fjslice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fjslice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iaseth","download_url":"https://codeload.github.com/iaseth/jslice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iaseth%2Fjslice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32536579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T12:25:33.646Z","status":"ssl_error","status_checked_at":"2026-05-02T12:24:51.733Z","response_time":132,"last_error":"SSL_read: 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":["javascript","josn","pythonic","slice","typescript"],"created_at":"2024-12-02T15:26:44.107Z","updated_at":"2026-05-02T13:35:08.857Z","avatar_url":"https://github.com/iaseth.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# jslice\n[`jslice`](https://www.npmjs.com/package/jslice) is a small `JavaScript/TypeScript` library for slicing arrays using `slice strings`.\nThe `slice` syntax is heavily inspired by its counterpart in `python`.\n\nI felt the need for `jslice` when I was working on [`josn`](https://github.com/iaseth/josn).\n\nI am using [`readmix`](https://github.com/iaseth/readmix) for generating this README.\nYou can view the source file [here](https://github.com/iaseth/jslice/blob/master/README.md.rx).\n\n\n## Table of contents\n* [jslice](#jslice)\n    * [Table of contents](#table-of-contents)\n    * [Installation](#installation)\n    * [What is a slice string?](#what-is-a-slice-string?)\n    * [Documentation](#documentation)\n    * [Package details](#package-details)\n    * [Dependencies](#dependencies)\n    * [Dev dependencies](#dev-dependencies)\n    * [License](#license)\n\n\n## Installation\nYou can install [`jslice`](https://www.npmjs.com/package/jslice) with the following command:\n```\nnpm i jslice\n```\nNow you can import `jslice` in your project as follows.\n```\nconst jslice = require(\"jslice\");\n```\n```\nconst { isSlice, slice } = jslice;\n```\n\n\n## What is a slice string?\nA slice string is any string of the form `start:end`,\nwhere `start` and `end` are integers, that can be used for slicing an array.\nHere, `start` is the first element that is part of the resulting slice,\n`end` is the first element that is not in the resulting slice.\n\nBoth these arguments are optional. By default, `start` is set to `0` and `end` is set to the array length.\nSo, `0:20` is just the same as `:20`.\nAnd, for an array of length 10, `4:10` is just the same as `4:`.\n\nBoth these arguments can be negative.\nA negative value is counted from the end of the array.\nSo, `-1` refers to the last element in array.\n\n\n## Documentation\n`jslice` exports just 2 functions - `isSlice(str)` and `slice(arr, str)`.\n\n| Function          | Returns   | Description                                                       |\n| ----------------- | --------- | ----------------------------------------------------------------- |\n| `isSlice(str)`    | `boolean` | Checks whether the given string is a valid slice string or not.   |\n| `slice(arr, str)` | `array`   | Returns a slice of the array `arr` according to the slice string. |\n\n\n## Package details\n| `Name`         | `Value`                            |\n| -------------- | ---------------------------------- |\n| `Name`         | `jslice`                           |\n| `Version`      | `0.11.0`                           |\n| `Author`       | `iaseth`                           |\n| `Homepage`     | `https://github.com/iaseth/jslice` |\n| `Repository`   | `iaseth/jslice`                    |\n| `License`      | `MIT`                              |\n| `Dependencies` | `0`                                |\n\n\n\n## Dependencies\nThis package has no dependencies.\n\n\n## Dev dependencies\n|     | `Package`     | `Version`   |\n| --- | ------------- | ----------- |\n| 1   | `@types/jest` | `^29.5.1`   |\n| 2   | `jest`        | `^29.5.0`   |\n\n\n\n## License\nMIT License\n\nCopyright (c) Ankur Seth.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n## Credit\n\nThis file was generated using [`readmix`](https://github.com/iaseth/readmix).\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiaseth%2Fjslice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiaseth%2Fjslice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiaseth%2Fjslice/lists"}