Skip to content

Transformations⚓︎

TLDR list of Transformations
Transformation Brief Description
empty Returns an empty Iterable
filter Returns a new iterable
flatMap
from
fromRange Returns an Iterable of numbers (positive and/or negative) progressing from start up to, but not including, end.
map
memoize
materialize Triggers the operations chain and store it in a new Iterable. It returns an ILinqIterable to allow to create a brand new operations chain. Helpful to boost performance.
repeat Returns an Iterable which will repeats the given value n times.
tap
tapChain
tapChainCreation

empty⚓︎

1
2
3
4
5
6
import * as IterableLinq from 'iterable-linq-utility'

IterableLinq
    .empty()
    .collectToArray();
// []
1
2
3
4
import { Functions } from 'iterable-linq-utility';

Array.from(Functions.empty());
// []

filter⚓︎

1
2
3
4
5
6
7
import * as IterableLinq from 'iterable-linq-utility'

IterableLinq
    .from([1,2,3,4])
    .filter( v => v % 2 === 0)
    .collectToArray();
// [2,4]
1
2
3
4
import { Functions } from 'iterable-linq-utility';

Array.from(Functions.filter([1,2,3,4], v => v % 2 === 0));
// [2,4]

flatMap⚓︎

from⚓︎

fromRange⚓︎

map⚓︎

1
2
3
4
5
6
7
import * as IterableLinq from 'iterable-linq-utility'

IterableLinq
    .from([1,2,3,4])
    .map( v => v * 10 )
    .collectToArray();
// [10,20,30,40]
1
2
3
4
import { Functions } from 'iterable-linq-utility';

Array.from(Functions.map([1,2,3,4], v => v * 10));
// [10,20,30,40]

memoize⚓︎

materialize⚓︎

1
2
3
4
5
6
7
import * as IterableLinq from 'iterable-linq-utility'

IterableLinq
    .from([1,2,3,4])
    .materilize()
    .collectToArray();
// [1,2,3,4]
1
2
3
4
import { Functions } from 'iterable-linq-utility';

Array.from(Functions.materialize([1,2,3,4]));
// [1,2,3,4]

repeat⚓︎

1
2
3
4
5
6
import * as IterableLinq from 'iterable-linq-utility'

IterableLinq
    .repeat(5,3)
    .collectToArray();
// [5,5,5]
1
2
3
4
import { Functions } from 'iterable-linq-utility';

Array.from(Functions.repeat(5, 3));
// [5,5,5]

tap⚓︎

tapChain⚓︎

tapChainCreation⚓︎


Last update: March 22, 2023
Created: March 22, 2023