Helper function to get function arity by analyzing parameter lists for assignment patterns and rest parameters
95
{
"context": "This evaluation assesses how well the engineer uses @babel/helper-get-function-arity and @babel/types to analyze function AST nodes and generate higher-order function composition utilities. The focus is on correctly importing and applying the package's API to determine function arity and create curried wrappers.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Import helper function",
"description": "Correctly imports the default export from @babel/helper-get-function-arity package",
"max_score": 10
},
{
"name": "Use getFunctionArity directly",
"description": "Uses the imported getFunctionArity function (or equivalent helper name) to determine function arity in the getArity implementation",
"max_score": 20
},
{
"name": "Pass function node",
"description": "Correctly passes the functionNode parameter to getFunctionArity without modification or incorrect transformations",
"max_score": 15
},
{
"name": "Handle arity result",
"description": "Correctly uses the numeric arity result returned by getFunctionArity for logic in currying wrapper generation",
"max_score": 15
},
{
"name": "Use @babel/types builders",
"description": "Uses @babel/types builder functions (like t.functionExpression, t.identifier, t.blockStatement) to construct AST nodes for the curried wrapper",
"max_score": 15
},
{
"name": "Generate recursive curry",
"description": "Creates a curried wrapper implementation that recursively accumulates arguments until the required arity is met, using the arity value from getFunctionArity",
"max_score": 15
},
{
"name": "Respect parameter boundaries",
"description": "The curried wrapper correctly handles functions with default parameters or rest parameters by only requiring arguments up to the arity value (not all parameters)",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-babel--helper-get-function-aritydocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10