Skip to main content

Variable: excludeAsync()

const excludeAsync: {(excluded): <Value>(asyncIterable) => AsyncIterable<Value>; <Value>(excluded, asyncIterable): AsyncIterable<Value>; }

Defined in: filters.d.ts:361

Returns an async iterable containing the values of asyncIterable in iteration order excluding the values of excluded.

Call Signature

(excluded): <Value>(asyncIterable) => AsyncIterable<Value>

Parameters

excluded

Iterable<unknown>

Returns

<Value>(asyncIterable): AsyncIterable<Value>

Type Parameters

Value

Value

Parameters

asyncIterable

AsyncIterable<Value>

Returns

AsyncIterable<Value>

Call Signature

<Value>(excluded, asyncIterable): AsyncIterable<Value>

Type Parameters

Value

Value

Parameters

excluded

Iterable<unknown>

asyncIterable

AsyncIterable<Value>

Returns

AsyncIterable<Value>

Example

import { asAsync, excludeAsync, 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)
}),
excludeAsync([`adjective`, `verb`]),
reduceAsync(toArray()),
),
)
//=> [ 'noun', 'noun' ]
Playground

Since

v2.0.0