
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@tsigel/async-map
Advanced tools
A lightweight utility for parallel async mapping with controlled concurrency.
npm install @tsigel/async-map
# or
yarn add @tsigel/async-map
# or
pnpm add @tsigel/async-map
import asyncMap from '@tsigel/async-map';
// Basic usage
const results = await asyncMap(
3, // number of concurrent operations
async (item, index) => {
// Do some async work with each item
const result = await someAsyncOperation(item);
return result;
},
myArray // array to process
);
// Curried usage
const processItems = asyncMap(
5,
async (item, index) => {
return await someAsyncOperation(item);
}
);
// Later in your code:
const results = await processItems(myArray);
asyncMap<T, U>(threads: number, callback: (data: T, index: number) => U | Promise<U>, list?: T[]): Promise<U[]> | ((list: T[]) => Promise<U[]>)Returns a Promise that resolves to an array of results or a curried function if the list argument is omitted.
import asyncMap from '@tsigel/async-map';
const fetchUserData = async (userId) => {
const response = await fetch(`https://api.example.com/users/${userId}`);
return response.json();
};
// Fetch data for multiple users with max 3 concurrent requests
const userIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const userData = await asyncMap(3, fetchUserData, userIds);
import asyncMap from '@tsigel/async-map';
import fs from 'fs/promises';
const files = ['file1.txt', 'file2.txt', 'file3.txt', 'file4.txt'];
const processedContents = await asyncMap(2, async (filename, index) => {
const content = await fs.readFile(filename, 'utf-8');
return content.toUpperCase();
}, files);
import asyncMap from '@tsigel/async-map';
try {
const results = await asyncMap(3, async (item) => {
// This might throw an error
const result = await riskyOperation(item);
return result;
}, items);
console.log('All operations completed successfully:', results);
} catch (error) {
console.error('An error occurred during processing:', error);
}
MIT
FAQs
Unknown package
We found that @tsigel/async-map demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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 Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.