Skip to main content

Function: joinConcur()

Returns a promise that resolves to the string concatenation of the values of concurIterable, separated by separator.

Like Array.prototype.join, but for concur iterables, except it does not treat null, undefined, or [] specially.

WARNING: The iteration order of concur iterables is not deterministic, so the values will be concatenated in an arbitrary order.

Example

import { asConcur, joinConcur, mapConcur, pipe } from 'lfi'

const API_URL = `https://api.dictionaryapi.dev/api/v2/entries/en`

console.log(
await pipe(
asConcur([`sloth`, `lazy`, `sleep`]),
mapConcur(async word => {
const response = await fetch(`${API_URL}/${word}`)
return (await response.json())[0].phonetic
}),
joinConcur(`, `),
),
)
// NOTE: This order may change between runs
//=> /slɑθ/, /ˈleɪzi/, /sliːp/
Playground

Since

v0.0.2

Call Signature

joinConcur(separator): (concurIterable) => Promise<string>

Parameters

separator

string

Returns

Function

Parameters

concurIterable

ConcurIterable<unknown>

Returns

Promise<string>

Defined in

collections.d.ts:524

Call Signature

joinConcur(separator, concurIterable): Promise<string>

Parameters

separator

string

concurIterable

ConcurIterable<unknown>

Returns

Promise<string>

Defined in

collections.d.ts:527