@iterable-iterator/slice

1.0.2 • Public • Published

🔪 @iterable-iterator/slice

Iterable slicing functions for JavaScript. See docs.

⚠️ Depending on your environment, the code may require regeneratorRuntime to be defined, for instance by importing regenerator-runtime/runtime.

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 9

import {count} from '@iterable-iterator/count';
import {slice} from '@iterable-iterator/slice'
slice(count(), 40, 50, 3); // 40 43 46 49

import {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 Version Tests Dependencies Dev dependencies GitHub issues Downloads

Code issues Code maintainability Code coverage (cov) Code technical debt Documentation Package size

Package Sidebar

Install

npm i @iterable-iterator/slice

Weekly Downloads

208

Version

1.0.2

License

AGPL-3.0

Unpacked Size

494 kB

Total Files

14

Last publish

Collaborators

  • raskat
  • aureooms