On May 31, 2012, at 6:06 PM, Rick Waldron wrote:
> The original API allowed me to pass an explicitly bound callback (whether it
> was by bind or fat arrow) and have that binding take precendence over a
> default behavior.
I think you might still be missing a key point: if `callbackFn` is a bound
function, there's no important difference in behavior between
callbackFn.call(elems, x, i)
and
callbackFn(x, i)
The former passes elems as a `this` parameter, but `callbackFn` ignores it and
uses its own bound `this`. The latter doesn't pass a `this` parameter, and
`callbackFn` uses its own bound `this`. Either way, you get the same behavior.
So you can simply replace lines 9 - 22 with
[].forEach.call( elems, callbackFn );
And there's no need for the isBound predicate.
Dave
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss