Skip to main content

Function: uniqueByConcur()

Returns a concur iterable containing the values of concurIterable, except values for which fn returns a value awaitable to the same value are deduplicated.

When values are deduplicated, the value earlier in iteration order wins.

Example

console.log(
await pipe(
asConcur([`sloth`, `sleep`, `fast`, `slow`, `mean`]),
uniqueByConcur(word => word.length),
reduceConcur(toArray()),
),
)
//=> [ 'sloth', 'fast' ]

uniqueByConcur(fn)

uniqueByConcur<Value>(fn): (concurIterable) => ConcurIterable<Value>

Returns a concur iterable containing the values of concurIterable, except values for which fn returns a value awaitable to the same value are deduplicated.

When values are deduplicated, the value earlier in iteration order wins.

Type Parameters

Value

Parameters

fn

Returns

Function

Parameters

concurIterable: ConcurIterable<Value>

Returns

ConcurIterable<Value>

Example

console.log(
await pipe(
asConcur([`sloth`, `sleep`, `fast`, `slow`, `mean`]),
uniqueByConcur(word => word.length),
reduceConcur(toArray()),
),
)
//=> [ 'sloth', 'fast' ]

Defined in

filters.d.ts:390

uniqueByConcur(fn, concurIterable)

uniqueByConcur<Value>(fn, concurIterable): ConcurIterable<Value>

Returns a concur iterable containing the values of concurIterable, except values for which fn returns a value awaitable to the same value are deduplicated.

When values are deduplicated, the value earlier in iteration order wins.

Type Parameters

Value

Parameters

fn

concurIterable: ConcurIterable<Value>

Returns

ConcurIterable<Value>

Example

console.log(
await pipe(
asConcur([`sloth`, `sleep`, `fast`, `slow`, `mean`]),
uniqueByConcur(word => word.length),
reduceConcur(toArray()),
),
)
//=> [ 'sloth', 'fast' ]

Defined in

filters.d.ts:393