Babel plugin that compiles ES2015 default and rest parameters to ES5-compatible code
91
A library that provides utilities for working with asynchronous JavaScript operations.
Create a utility function that maps an array through an async transformation.
[1, 2, 3] and an async mapper function that doubles each value, it returns [2, 4, 6] @testCreate a utility that collects values from an async generator.
[1, 2, 3, 4, 5] @testCreate a class that manages and executes async operations.
@generates
/**
* Maps an array of values through an async transformation function.
*
* @param {Array} items - Array of items to process
* @param {Function} mapper - Async function to transform each item
* @returns {Promise<Array>} Promise resolving to array of transformed items
*/
async function asyncMap(items, mapper) {
// IMPLEMENTATION HERE
}
/**
* Collects all values from an async generator into an array.
*
* @param {AsyncGenerator} generator - Async generator to collect from
* @returns {Promise<Array>} Promise resolving to collected values
*/
async function collectAsync(generator) {
// IMPLEMENTATION HERE
}
/**
* Class that manages a queue of async operations.
*/
class AsyncQueue {
constructor() {
// IMPLEMENTATION HERE
}
/**
* Adds an async operation to the queue.
*
* @param {Function} operation - Async function to execute
* @returns {Promise} Promise that resolves when operation completes
*/
async enqueue(operation) {
// IMPLEMENTATION HERE
}
/**
* Waits for all queued operations to complete.
*
* @returns {Promise<Array>} Promise resolving to array of results
*/
async waitAll() {
// IMPLEMENTATION HERE
}
}
module.exports = {
asyncMap,
collectAsync,
AsyncQueue,
};The library should be configured to use external runtime helpers to avoid code duplication when these utilities are used across multiple modules in a larger project. The build output should be optimized for production use with minimal helper code inlined.
Provides runtime helper externalization and optimization for transformed code.
Provides the runtime helper library referenced by transformed code.
Install with Tessl CLI
npx tessl i tessl/npm-babel--plugin-transform-parametersdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10