Skip to main content

Function: cacheConcur()

cacheConcur<Value>(concurIterable): ConcurIterable<Value>

Returns a concur iterable equivalent to concurIterable that iterates over concurIterable at most once.

Type Parameters

Value

Parameters

concurIterable: ConcurIterable<Value>

Returns

ConcurIterable<Value>

Example

const concurIterable = asConcur([`sloth`, `more sloth`, `even more sloth`])
const concurIterableWithEffects = eachConcur(console.log, concurIterable)

const cachedConcurIterable = cacheConcur(concurIterableWithEffects)

console.log(await pipe(cachedConcurIterable, reduceConcur(toArray())))
//=> sloth
//=> more sloth
//=> even more sloth
//=> [ 'sloth', 'more sloth', 'even more sloth' ]

console.log(await pipe(cachedConcurIterable, reduceConcur(toArray())))
//=> [ 'sloth', 'more sloth', 'even more sloth' ]

Defined in

side-effects.d.ts:346