0.0.1 • Published 7 months ago
@orche/collect v0.0.1
@orche/collect
//: <> (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
0.0.1
7 months ago