Skip to main content

Variable: dropAsync

const dropAsync: SubAsync

Defined in: splices.d.ts:275

Returns an async iterable containing the values of asyncIterable in iteration order except for the first count values.

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

Throws

if count isn't a non-negative integer.

Example

import { asAsync, dropAsync, mapAsync, pipe, reduceAsync, toArray } from 'lfi'

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

console.log(
await pipe(
asAsync([`active`, `awake`, `sloth`, `lazy`, `sleep`]),
mapAsync(async word => {
const response = await fetch(`${API_URL}/${word}`)
return (await response.json())[0].phonetic
}),
dropAsync(2),
reduceAsync(toArray()),
),
)
//=> [ '/slɑθ/', '/ˈleɪzi/', '/sliːp/' ]
Playground

Since

v0.0.1