Variable: dropWhileAsync
const
dropWhileAsync:SubWhileAsync
Defined in: splices.d.ts:61
Returns an async iterable containing the values of asyncIterable
in
iteration order starting with the first value for which fn
returns a value
awaitable to a falsy value.
Example
import { asAsync, dropWhileAsync, flatMapAsync, map, pipe, reduceAsync, toArray } from 'lfi'
const API_URL = `https://api.dictionaryapi.dev/api/v2/entries/en`
console.log(
await pipe(
asAsync([`sloth`, `lazy`, `sleep`]),
flatMapAsync(async word => {
const response = await fetch(`${API_URL}/${word}`)
const [{ meanings }] = await response.json()
return map(meaning => meaning.partOfSpeech, meanings)
}),
dropWhileAsync(partOfSpeech => partOfSpeech.length === 4),
reduceAsync(toArray()),
),
)
//=> [ 'adjective', 'verb' ]
Since
v0.0.1