Re-reading https://github.com/d3/d3-ease/issues/13 four years later, I feel this problem was made much more difficult by the desire to overload transition.ease to support both a single easing function shared by all selected nodes and multiple easing functions varying across nodes.
While it would be more verbose (and arguably inconsistent), an easy way around this problem is a separate transition method for the rare case where varying easing functions are desired. For example:
Unlike transition.ease, transition.easeVarying would always take a function, and it would always invoke that function for each selected node. If you pass in something that’s not a function (not a function that returns a function, in this case), it would error (though perhaps not immediately).
Re-reading https://github.com/d3/d3-ease/issues/13 four years later, I feel this problem was made much more difficult by the desire to overload transition.ease to support both a single easing function shared by all selected nodes and multiple easing functions varying across nodes.
While it would be more verbose (and arguably inconsistent), an easy way around this problem is a separate transition method for the rare case where varying easing functions are desired. For example:
Unlike transition.ease, transition.easeVarying would always take a function, and it would always invoke that function for each selected node. If you pass in something that’s not a function (not a function that returns a function, in this case), it would error (though perhaps not immediately).