pow

powerseq

Sequence operators

Showing:

Popularity

Downloads/wk

120

GitHub Stars

91

Maintenance

Last Commit

3yrs ago

Contributors

2

Package

Dependencies

1

Size (min+gzip)

7.9KB

License

MIT

Type Definitions

Tree-Shakeable

Yes?

Categories

Readme

installation and usage

npm install powerseq

executing single operator

import { filter } from "powerseq";

for(var item of filter([1,2,3,4,5], x => x % 2 === 0)){
    console.log(item);
}

chaining many operators

import { Enumerable } from "powerseq/enumerable";  
// use 'Enumerable' class ONLY on the server side !! (use 'pipe' method on the client side )

const items = Enumerable
    .range(1,Number.MAX_VALUE)
    .filter( x => x % 2 === 0)
    .take(5)
    .reverse()
    .toarray();

console.log(items);

chaining many operators using pipe method (it allows code tree shaking)

import { pipe, range, filter, take, reverse, toarray } from "powerseq";

const items = pipe(
    range(1, Number.MAX_VALUE),
    filter(x => x % 2 === 0),
    take(5),
    reverse(),
    toarray());

console.log(items);

most of the operators can be used as a single operator (filter([1,2,3,4,5], x => x % 2 === 0)) or as a part of the operator chain pipe([1, 2, 3, 4, 5], filter(x => x % 2 === 0), ... ).But some operators have special counterparts (concatp, defaultifemptyp, includesp, sequenceequalp, zipp) when used with pipe, so we call concat([1,2,3], [4,5,6]) but we have to call pipe([1,2,3], concatp([4,5,6]), ... ) if we want to chain concat with other operators.

operators

enumerable

deferrange
emptyrepeatvalue
entriesthroww
from
generate
of
operators
asiterablefiltermaxskiplast
averagefindmaxbyskipwhile
bufferfindindexminsome
castflatmapminbysum
concatforeachoftypetake
countgroupbyorderbytakelast
defaultifemptygroupjoinorderbydescendingtakewhile
distinctignoreelementsreducethenby
distinctuntilchangedincludesrepeatthenbydescending
doointersectreversetoarray
elementatisemptyscantomap
everyjoinsequenceequaltoobject
exceptlastsingleunion
expandmapskipzip

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100