Skip to main content

Variable: dropConcur

const dropConcur: SubConcur

Defined in: splices.d.ts:310

Returns a concur iterable containing the values of concurIterable in iteration order except for the first count values.

If the count is greater than the number of values in concurIterable, then an empty concur iterable is returned.

Throws

if count isn't a non-negative integer.

Example

import { asConcur, dropConcur, mapConcur, pipe, reduceConcur, toArray } from 'lfi'

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

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

Since

v0.0.2