0.4.0 • Published 1 month ago

iterpal v0.4.0

Weekly downloads
1
License
MIT
Repository
github
Last release
1 month ago

Iterpal

Iterable tools for JavaScript.

Installation

Iterpal is available from the npm registry:

npm install iterpal

With Deno:

import { filter, map } from "https://evanhahn.com/tape/iterpal/0.3.0/mod.ts";

Documentation

API documentation

Use cases

  • Get helpful utilities not in the standard library.

    last is a simple one, but there are many others:

    import { last } from "iterpal";
    last("iterpal!");
    // => "!"
  • Use collection utilities like map and filter with any iterable.

    That includes arrays, strings, sets, maps, typed arrays, buffers, streams, (async) generators, or anything implementing the interface.

    import { filter } from "iterpal";
    const letterOs = filter("foo", (c) => c === "o");
  • Take advantage of lazy iteration.

    Many of Iterpal's functions return lazily, which can help you maintain a functional style while still enjoying performance benefits.

    import { map, take } from "iterpal";
    
    // The second operation is faster because
    // it iterates over fewer values.
    lotsOfNumbers.map(square).slice(10);
    lotsOfNumbers.slice(10).map(square);
    
    // These two operations are basically equivalent.
    take(map(lotsOfNumbers, square), 10);
    map(take(lotsOfNumbers, 10), square);
0.4.0

1 month ago

0.3.0

2 months ago

0.2.0

5 years ago

0.1.0

5 years ago