Skip to content

PieterScheffers/genflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GenFlow

Library to easily map, filter and reduce on a Generator.

Install

composer require pisc/genflow

Usage

<?php

namespace MyNamespace;

use function Pisc\GenFlow\gen;

function myGenerator()
{
    yield 1;
    yield 2;
    yield 3;
}

gen(myGenerator())
    ->map(fn ($item) => $item * 2)
    ->filter(fn ($item) => $item < 5)
    ->toArray(); // [2, 4]

About

PHP Generator Flow utility

Resources

License

Stars

Watchers

Forks

Packages

No packages published