Babel plugin that transforms ECMAScript object rest and spread syntax into ES5-compatible code.
85
Quality
Pending
Does it follow best practices?
Impact
85%
1.06xAverage score across 10 eval scenarios
Pending
The risk profile of this skill
A utility that programmatically constructs JavaScript function declarations as Abstract Syntax Trees (AST).
Build a complete function declaration AST node with a given name, parameters, and body statements.
Check if created nodes are of the correct AST node type.
Create deep copies of AST nodes while preserving structure.
@generates
/**
* Creates a function declaration AST node.
*
* @param {string} functionName - The name of the function.
* @param {string[]} parameterNames - Array of parameter names.
* @param {Object} bodyExpression - An AST node representing the expression to return.
* @returns {Object} A function declaration AST node.
*/
function createFunctionDeclaration(functionName, parameterNames, bodyExpression) {
// IMPLEMENTATION HERE
}
/**
* Validates if a given AST node is of a specific type.
*
* @param {Object} node - The AST node to validate.
* @param {string} typeName - The expected node type (e.g., "FunctionDeclaration", "Identifier").
* @returns {boolean} True if the node matches the type, false otherwise.
*/
function isNodeType(node, typeName) {
// IMPLEMENTATION HERE
}
/**
* Creates a deep clone of an AST node.
*
* @param {Object} node - The AST node to clone.
* @returns {Object} A deep copy of the node.
*/
function cloneNode(node) {
// IMPLEMENTATION HERE
}
module.exports = {
createFunctionDeclaration,
isNodeType,
cloneNode,
};Provides utilities for AST node creation, validation, and manipulation.
@satisfied-by
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10