Skip to main content

Variable: noneConcur

const noneConcur: PredicateConcur

Defined in: predicates.d.ts:360

Returns a promise that resolves to true if fn returns a falsy value or a promise that resolves to a falsy value for all values of concurIterable. Otherwise returns a promise that resolves to false.

Example

import { noneConcur, asConcur, pipe } from 'lfi'

const API_URL = `https://api.dictionaryapi.dev/api/v2/entries/en`
const getPartsOfSpeech = async word => {
const response = await fetch(`${API_URL}/${word}`)
const [{ meanings }] = await response.json()
return meanings.map(meaning => meaning.partOfSpeech)
}

console.log(
await pipe(
asConcur([`sloth`, `lazy`, `sleep`]),
noneConcur(async word => (await getPartsOfSpeech(word)).includes(`noun`)),
),
)
//=> true

console.log(
await pipe(
asConcur([`sloth`, `lazy`, `sleep`]),
noneConcur(async word => (await getPartsOfSpeech(word)).includes(`adverb`)),
),
)
//=> false
Playground

Since

v0.0.2