0.0.5 • Published 6 months ago

genpipe v0.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

genpipe

Tiny data processing library for TypeScript based on composable async generators.

Installation

Copy the file

The library is just one file - genpipe.ts. Copy it to your project and use it.

Install with npm

npm install genpipe

Usage

Basic example

import { Pipeline, toGen, F, delay } from 'genpipe'

const x = new Pipeline(toGen([20, 5, 2, 1]))
    .tf(F.map((i) => i * 2))
    .toAsync()
    .tf(F.mapConcurrent(10, async (i) => {
        const timeout = 1000 * Math.max(0.5, Math.random())
        console.log(`starting timeout async function ${i}`)
        await delay(timeout)
        console.log(`finished timeout async function ${i}`)
        return i
    }))
    .eval()

console.log(await x)
0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago