Function: findLastConcur()
Returns a concur iterable containing the last value of concurIterable
for
which fn
returns a value awaitable to a truthy value. Otherwise, returns an
empty concur iterable.
Example
const concurIterable = asConcur([1, 2, `sloth`, 4, `other string`])
console.log(
await pipe(
concurIterable,
findLastConcur(value => typeof value === `string`),
orConcur(() => `yawn!`),
),
)
//=> other string
console.log(
await pipe(
concurIterable,
findLastConcur(value => Array.isArray(value)),
orConcur(() => `yawn!`),
),
)
//=> yawn!
findLastConcur(fn)
findLastConcur<
Value
>(fn
): (concurIterable
) =>ConcurOptional
<Value
>
Returns a concur iterable containing the last value of concurIterable
for
which fn
returns a value awaitable to a truthy value. Otherwise, returns an
empty concur iterable.
Type Parameters
• Value
Parameters
• fn
Returns
Function
Parameters
• concurIterable: ConcurIterable
<Value
>
Returns
ConcurOptional
<Value
>
Example
const concurIterable = asConcur([1, 2, `sloth`, 4, `other string`])
console.log(
await pipe(
concurIterable,
findLastConcur(value => typeof value === `string`),
orConcur(() => `yawn!`),
),
)
//=> other string
console.log(
await pipe(
concurIterable,
findLastConcur(value => Array.isArray(value)),
orConcur(() => `yawn!`),
),
)
//=> yawn!
Defined in
findLastConcur(fn, concurIterable)
findLastConcur<
Value
>(fn
,concurIterable
):ConcurOptional
<Value
>
Returns a concur iterable containing the last value of concurIterable
for
which fn
returns a value awaitable to a truthy value. Otherwise, returns an
empty concur iterable.
Type Parameters
• Value
Parameters
• fn
• concurIterable: ConcurIterable
<Value
>
Returns
ConcurOptional
<Value
>
Example
const concurIterable = asConcur([1, 2, `sloth`, 4, `other string`])
console.log(
await pipe(
concurIterable,
findLastConcur(value => typeof value === `string`),
orConcur(() => `yawn!`),
),
)
//=> other string
console.log(
await pipe(
concurIterable,
findLastConcur(value => Array.isArray(value)),
orConcur(() => `yawn!`),
),
)
//=> yawn!