Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iterable-iterator/slice
:hocho: Iterable slicing functions for JavaScript
https://github.com/iterable-iterator/slice
Last synced: about 2 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 (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-24T00:05:25.000Z (2 months ago)
- Last Synced: 2024-10-24T13:51:57.633Z (2 months ago)
- Language: JavaScript
- Homepage: https://iterable-iterator.github.io/slice
- Size: 1.89 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 ...
```[![License](https://img.shields.io/github/license/iterable-iterator/slice.svg)](https://raw.githubusercontent.com/iterable-iterator/slice/main/LICENSE)
[![Version](https://img.shields.io/npm/v/@iterable-iterator/slice.svg)](https://www.npmjs.org/package/@iterable-iterator/slice)
[![Tests](https://img.shields.io/github/actions/workflow/status/iterable-iterator/slice/ci.yml?branch=main&event=push&label=tests)](https://github.com/iterable-iterator/slice/actions/workflows/ci.yml?query=branch:main)
[![Dependencies](https://img.shields.io/librariesio/github/iterable-iterator/slice.svg)](https://github.com/iterable-iterator/slice/network/dependencies)
[![GitHub issues](https://img.shields.io/github/issues/iterable-iterator/slice.svg)](https://github.com/iterable-iterator/slice/issues)
[![Downloads](https://img.shields.io/npm/dm/@iterable-iterator/slice.svg)](https://www.npmjs.org/package/@iterable-iterator/slice)[![Code issues](https://img.shields.io/codeclimate/issues/iterable-iterator/slice.svg)](https://codeclimate.com/github/iterable-iterator/slice/issues)
[![Code maintainability](https://img.shields.io/codeclimate/maintainability/iterable-iterator/slice.svg)](https://codeclimate.com/github/iterable-iterator/slice/trends/churn)
[![Code coverage (cov)](https://img.shields.io/codecov/c/gh/iterable-iterator/slice/main.svg)](https://codecov.io/gh/iterable-iterator/slice)
[![Code technical debt](https://img.shields.io/codeclimate/tech-debt/iterable-iterator/slice.svg)](https://codeclimate.com/github/iterable-iterator/slice/trends/technical_debt)
[![Documentation](https://iterable-iterator.github.io/slice/badge.svg)](https://iterable-iterator.github.io/slice/source.html)
[![Package size](https://img.shields.io/bundlephobia/minzip/@iterable-iterator/slice)](https://bundlephobia.com/result?p=@iterable-iterator/slice)