const pEvery = require('p-every');const getContinent = require('get-continent'); // not a real moduleconst places = [ getCapital('Norway').then(info => info.name), 'Bangkok, Thailand', 'Berlin, Germany', 'Tokyo, Japan'];const testFunction = async place => { const continent = await getContinent(place); return continent === 'europe';}(async ()
API
pEvery(input, testFunction, [options])
Returns a Promise that is fulfilled when all promises in input and ones returned from testFunction are fulfilled, or rejects if any of the promises reject. The fulfilled value is a boolean that is true if all Promises passed the test and false otherwise.
input
Type: Iterable<Promise|any>
Iterated over concurrently in the testFunction function.
testFunction(element, index)
Type: Function
Predicate function, expected to return a Promise<boolean> or boolean.
options
Type: Object
concurrency
Type: number
Default: Infinity
Minimum: 1
Number of concurrently pending promises returned by testFunction.