
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@basementuniverse/async
Advanced tools
Async versions of common list functions.
npm install @basementuniverse/async
See docs for more information.
import { asyncForEach } from '@basementuniverse/async';
await asyncForEach<string>(
[
'one',
'two',
'three',
],
async (value: string) => {
await fetch(`localhost:8080/${value}`);
}
);
import { asyncMap } from '@basementuniverse/async';
const results = await asyncMap<string, number>(
[
'123',
'456',
'789',
],
async (value: string) => {
// asynchronous stuff here...
return Number(value);
}
);
/*
results: [123, 456, 789]
Note that the order of results might be different.
*/
import { asyncFilter } from '@basementuniverse/async';
const results = await asyncFilter<string>(
[
'allowed1',
'notAllowed2',
'allowed3',
'notAllowed4',
],
async (value: string) => {
// asynchronous stuff here...
return value.startsWith('allowed');
}
);
/*
results: ['allowed1', 'allowed2']
Note that the order of results might be different.
*/
import { asyncReduce } from '@basementuniverse/async';
const result = await asyncReduce<string, number>(
[
'1',
'2',
'3',
],
async (previous: number, current: string) => {
// asynchronous stuff here...
return previous + Number(current);
},
0
);
/*
result: 6
*/
import { asyncFind } from '@basementuniverse/async';
const result = await asyncFind<string>(
[
'one',
'two',
'three',
],
async (value: string) => {
// asynchronous stuff here...
return value === 'two';
}
);
/*
result: 'two'
*/
import { asyncFindIndex } from '@basementuniverse/async';
const result = await asyncFindIndex<string>(
[
'one',
'two',
'three',
],
async (value: string) => {
// asynchronous stuff here...
return value === 'two';
}
);
/*
result: 1
*/
FAQs
Async versions of common list functions
We found that @basementuniverse/async demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.