Skip to main content

Variable: joinConcur()

const joinConcur: {(separator): (concurIterable) => Promise<string>; (separator, concurIterable): Promise<string>; }

Defined in: collections.d.ts:525

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

The promise rejects if the given concurIterable rejects.

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.

Call Signature

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

Parameters

separator

string

Returns

(concurIterable): Promise<string>

Parameters

concurIterable

ConcurIterable<unknown>

Returns

Promise<string>

Call Signature

(separator, concurIterable): Promise<string>

Parameters

separator

string

concurIterable

ConcurIterable<unknown>

Returns

Promise<string>

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