Skip to main content

Function: excludeAsync()

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

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

Call Signature

excludeAsync(excluded): <Value>(asyncIterable) => AsyncIterable<Value, any, any>

Parameters

excluded

Iterable<unknown, any, any>

Returns

Function

Type Parameters

Value

Parameters

asyncIterable

AsyncIterable<Value, any, any>

Returns

AsyncIterable<Value, any, any>

Defined in

filters.d.ts:362

Call Signature

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

Type Parameters

Value

Parameters

excluded

Iterable<unknown, any, any>

asyncIterable

AsyncIterable<Value, any, any>

Returns

AsyncIterable<Value, any, any>

Defined in

filters.d.ts:365