https://github.com/iterable-iterator/slice
:hocho: Iterable slicing functions for JavaScript
https://github.com/iterable-iterator/slice
Last synced: 3 months ago
JSON representation
:hocho: Iterable slicing functions for JavaScript
- Host: GitHub
- URL: https://github.com/iterable-iterator/slice
- Owner: iterable-iterator
- License: agpl-3.0
- Created: 2021-04-28T13:21:20.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-12T02:36:56.000Z (3 months ago)
- Last Synced: 2025-04-12T03:29:43.867Z (3 months ago)
- Language: JavaScript
- Homepage: https://iterable-iterator.github.io/slice
- Size: 2.6 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
:hocho: [@iterable-iterator/slice](https://iterable-iterator.github.io/slice)
==Iterable slicing functions for JavaScript.
See [docs](https://iterable-iterator.github.io/slice/index.html).> :warning: Depending on your environment, the code may require
> `regeneratorRuntime` to be defined, for instance by importing
> [regenerator-runtime/runtime](https://www.npmjs.com/package/regenerator-runtime).```js
import {range} from '@iterable-iterator/range';
import {repeat} from '@iterable-iterator/repeat';
import {take, head, tail, trunc, drop} from '@iterable-iterator/slice'
take(range(10), 3); // 0 1 2
head(repeat("A"), 3); // A A A
tail(range(10), 3); // 7 8 9
trunc(range(10), 3); // 0 1 2 3 4 5 6
drop(range(10), 3); // 3 4 5 6 7 8 9import {count} from '@iterable-iterator/count';
import {slice} from '@iterable-iterator/slice'
slice(count(), 40, 50, 3); // 40 43 46 49import {le} from '@functional-abstraction/predicate';
import {takewhile, dropwhile} from '@iterable-iterator/slice'
takewhile(le(5), count()); // 0 1 2 3 4 5
dropwhile(le(5), count()); // 6 7 8 ...
```[](https://raw.githubusercontent.com/iterable-iterator/slice/main/LICENSE)
[](https://www.npmjs.org/package/@iterable-iterator/slice)
[](https://github.com/iterable-iterator/slice/actions/workflows/ci.yml?query=branch:main)
[](https://github.com/iterable-iterator/slice/network/dependencies)
[](https://github.com/iterable-iterator/slice/issues)
[](https://www.npmjs.org/package/@iterable-iterator/slice)[](https://codeclimate.com/github/iterable-iterator/slice/issues)
[](https://codeclimate.com/github/iterable-iterator/slice/trends/churn)
[](https://codecov.io/gh/iterable-iterator/slice)
[](https://codeclimate.com/github/iterable-iterator/slice/trends/technical_debt)
[](https://iterable-iterator.github.io/slice/source.html)
[](https://bundlephobia.com/result?p=@iterable-iterator/slice)