Babel plugin that compiles ES2015 default and rest parameters to ES5-compatible code
91
Build a tool that transpiles modern JavaScript code to ES5-compatible code for older browser environments.
Your tool should transform JavaScript source code to run in older environments. It must:
The tool should process string input and return transformed output.
@generates
/**
* Transpiles JavaScript code to ES5-compatible syntax.
*
* @param {string} code - The source code to transpile
* @param {object} options - Configuration options
* @param {string[]} options.targets - Target browser environments (e.g., ['ie 11', 'chrome 58'])
* @param {boolean} options.sourceMaps - Whether to generate source maps (default: false)
* @param {string} options.filename - Source filename for error reporting
* @returns {object} Result object with code, map, and metadata
* @throws {Error} Throws an error if transformation fails
*/
function transpile(code, options) {
// IMPLEMENTATION HERE
}
/**
* Transpiles a JavaScript file and writes output to disk.
*
* @param {string} inputPath - Path to input JavaScript file
* @param {string} outputPath - Path to output JavaScript file
* @param {object} options - Configuration options (same as transpile)
* @returns {Promise<void>}
* @throws {Error} Throws an error if file operations or transformation fail
*/
async function transpileFile(inputPath, outputPath, options) {
// IMPLEMENTATION HERE
}
module.exports = {
transpile,
transpileFile,
};Provides JavaScript compilation and transformation APIs.
Provides environment-based transformation presets.
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