Skip to content

Repository files navigation

Hyperjump Pact

Hyperjump Pact is a utility library that provides higher order functions for working with iterators and async iterators.

Installation

Designed for node.js (ES Modules, TypeScript) and browsers.

npm install @hyperjump/pact --save

Usage

import{pipe,range,map,filter,reduce}from"@hyperjump/pact";constresult=pipe(range(1,10),filter((n)=>n%2===0),map((n)=>n*2),reduce((sum,n)=>sum+n,0));console.log(result);
import{pipe,asyncMap,asyncFilter,asyncReduce}from"@hyperjump/pact";// You can alternatively import the async functions without the prefix// import { pipe, map, filter, reduce } from "@hyperjump/pact/async";constasyncSequence=asyncfunction*(){yield1;yield2;yield3;yield4;yield5;};forawait(constvalueofasyncSequence()){console.log(value);}constresult=awaitpipe(asyncSequence(),asyncFilter((n)=>n%2===0),asyncMap((n)=>n*2),asyncReduce((sum,n)=>sum+n,0));console.log(result);

API

https://pact.hyperjump.io

Contributing

Tests

Run the tests

npm test

Run the tests with a continuous test runner

npm test -- --watch

About

Higher order functions for iterators/generators and async iterators/generators

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages