Summary
Array callback methods are still not fully JavaScript-compatible when callbacks are passed as function declarations (e.g. map(inc)).
Reproduction
function inc(x) { return x + 1; }
var out = [1, 2].map(inc);
Current behavior
Error: function 'inc' expects 1 arguments but got 3
Expected behavior
Callback argument normalization should apply consistently for callback-based Array methods regardless of whether the callback is a function expression or function declaration reference:
- extra callback arguments ignored
- missing callback arguments filled with
undefined
Context
Issue #8 fixed this for user-function expressions, but function declaration references still go through a strict arity path.
Related: #2, #8
Summary
Array callback methods are still not fully JavaScript-compatible when callbacks are passed as function declarations (e.g.
map(inc)).Reproduction
Current behavior
Error: function 'inc' expects 1 arguments but got 3Expected behavior
Callback argument normalization should apply consistently for callback-based Array methods regardless of whether the callback is a function expression or function declaration reference:
undefinedContext
Issue #8 fixed this for user-function expressions, but function declaration references still go through a strict arity path.
Related: #2, #8