tessl install tessl/npm-babel--runtime@7.28.0Babel's modular runtime helpers that provide transpilation support for modern JavaScript features
Agent Success
Agent success rate when using this tile
94%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.19x
Baseline
Agent success rate without this tile
79%
Build a utility that transforms JavaScript code and extracts specific fields from the transformation result object.
const x = () => {}; and return the code field from the result @test"" and verify the returned code is an empty string @testconst greeting = "hello"; with AST enabled and return the ast field from the result @testfunction add(a, b) { return a + b; } and verify the returned ast has a type property equal to "File" @testmetadata field from the result object @testconst z = 10; with sourceMaps enabled and return the map field from the result @test@generates
/**
* Transforms JavaScript code and returns an object containing
* specified fields from the transformation result.
*
* @param {string} code - The JavaScript code to transform
* @param {object} options - Babel transformation options (plugins, sourceMaps, etc.)
* @param {string[]} fields - Array of field names to extract from the result (e.g., ['code', 'ast', 'map'])
* @returns {object} An object containing the requested fields from the transformation result
*/
function transformAndExtract(code, options, fields) {
// IMPLEMENTATION HERE
}
module.exports = { transformAndExtract };Provides JavaScript code transformation functionality.