JSPM

@orche/collect

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q31230F
  • License BSD-3-Clause

Collect async iterables into array

Package Exports

  • @orche/collect

Readme

@orche/collect

npm version npm download monthly npm download total github commit last github commit total npm license

Overview

Efficient async collection utilities for handling async iterables with powerful filtering and mapping capabilities.

Features

  • Async-first design
  • Flexible collection strategies
  • Conditional filtering
  • Mapping transformations
  • Zero dependencies
  • ESM support

Installation

# npm
$ npm install @orche/collect

# yarn
$ yarn add @orche/collect

# pnpm
$ pnpm add @orche/collect

Usage

import { asyncCollectOf, asyncCollectBy, asyncCollectTo } from '@orche/collect'

// Basic collection
const asyncIterable = async function* () {
  yield 1
  yield 2
  yield 3
}

// Collect all values
const all = await asyncCollectOf(asyncIterable())
// => [1, 2, 3]

// Collect with filtering
const even = await asyncCollectBy(asyncIterable(), x => x % 2 === 0)
// => [2]

// Collect with transformation
const doubled = await asyncCollectTo(asyncIterable(), x => x * 2)
// => [2, 4, 6]

License

BSD-3-Clause