0.0.1 • Published 7 months ago

@orche/collect v0.0.1

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
7 months ago

@orche/collect

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

//: <> (Shields)

//: <> (Links)

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

0.0.1

7 months ago