Home > @infiniteobjects/core-library-web > Async > MapSkipSymbol
Return this value from a mapper function to skip including the value in the returned array.
Signature:
static MapSkipSymbol: symbol;
import { Async } from '@infiniteobjects/core-library';
import got from 'got';
const sites = [
getWebsiteFromUsername('sindresorhus'), //=> Promise
'https://avajs.dev',
'https://example.invalid',
'https://github.com'
];
const mapper = async site => {
try {
const {requestUrl} = await got.head(site);
return requestUrl;
} catch {
return Async.MapSkipSymbol;
}
};
const result = await Async.map(sites, mapper, {concurrency: 2});
console.log(result);
//=> ['https://sindresorhus.com/', 'https://avajs.dev/', 'https://github.com/']