npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aitertools

v0.6.0

Published

Well-tested utility functions dealing with async iterables

Downloads

325

Readme

aitertools

Published on JSR Published on npm LGPL 3.0 GitHub Actions Codecov

This library provides a well-tested collection of small utility functions dealing with async iterables. You can think of it as .NET LINQ or Python aitertools for Deno & Node.js.

Functions

For the complete list of functions, see the complete API reference.

  • concat(...sources): Concatenate multiple async iterables into one.
  • take(source, count): Take the first count items from the source.
  • drop(source, count): Drop the first count items from the source.
  • takeWhile(source, predicate): Take items from the source while the predicate returns true.
  • dropWhile(source, predicate): Drop items from the source while the predicate returns true.
  • takeEnd(source, count): Take the last count items from the source.
  • dropEnd(source, count): Drop the last count items from the source.
  • map(mapper, ...sources): Apply the mapper to each item in the sources.
  • filter(predicate, ...sources): Filter items in the sources by the predicate.
  • reduce(reducer, source, initial?): Reduce the source to a single value by the reducer, optionally with the initial value.
  • tee(source, number): Effectively duplicate the source into number of async iterables.
  • groupBy(source, keySelector): Group items in the source by the keySelector.
  • unique(source, keySelector?): Eliminate duplicate items in the source, optionally by the keySelector.
  • range(start?, stop, step?): Generate a sequence of numbers from start to stop by step.
  • count(start?, step?): Generate a sequence of numbers from start by step infinitely.
  • cycle(source): Cycle the source infinitely.
  • repeat(value, times?): Repeat the value for times times, or infinitely if times is not specified.
  • fromIterable(source): Convert an iterable to an async iterable.
  • toArray(source): Convert an async iterable to an array.
  • toSet(source): Convert an async iterable to a Set.
  • toMap(source, keySelector, valueSelector?): Convert an async iterable to a Map.
  • assertStreams(actual, expected, msg?): Asset that an async iterable actual is equal to an array expected.
  • assertStreamStartsWith(actual, expected, msg?): Asset that an async iterable actual (which is possibly infinite) starts with an array expected.

Usage

In Deno:

$ deno add @hongminhee/aitertools
import * as aitertools from "@hongminhee/aitertools";

In Node.js:

$ npm add aitertools
import * as aitertools from "aitertools";

Changelog

See CHANGES.md file. Note that unreleased versions are also available on JSR for Deno:

deno add @hongminhee/[email protected]+9aa783c

… and on npm with dev tag for Node.js:

$ npm add aitertools@dev