`this` value is lost when iterating via forOwn (Lodash.underscore) #220

Closed
SBoudrias opened this Issue Mar 26, 2013 · 1 comment

Projects

None yet

2 participants

Since v1.1.0, it seems that Lodash created a bug when passing an iteration from forEach to forOwn.

I only tested it with the Lodash.underscore so I can't say if it's limited to this build in particular.

I've been able to fix the bug in the underscore build by changing line 745 by this one using call to keep the this value:

if (callback.call(thisArg, iterable[index], index, collection) === indicatorObject) return result;

I'd send a pull request, but I'm not sure how this all work with the build and the system. I hope this helps a little.

Owner
jdalton commented Mar 26, 2013

Good catch. I'll patch, add a unit test to cover this (I guess Underscore's unit tests let that slip by) and do a v1.1.1 bump.

@SBoudrias SBoudrias referenced this issue in tbranyen/backbone.layoutmanager Mar 26, 2013
Closed

Incompatibility with Lodash v1.1.0 (underscore build) #331

@jdalton jdalton closed this in 2cdb09a Mar 27, 2013
@jdalton jdalton added a commit that referenced this issue Aug 29, 2013
@jdalton jdalton Ensure `underscore` build internal `forOwn` will accept a `thisArg` a…
…rgument. [closes #220].

Former-commit-id: a7818db29e81b64556232bfe44b2e1275d3dada1
d69028a
@jdalton jdalton added a commit that referenced this issue Sep 1, 2013
@jdalton jdalton Ensure `underscore` build internal `forOwn` will accept a `thisArg` a…
…rgument. [closes #220].

Former-commit-id: a7818db29e81b64556232bfe44b2e1275d3dada1
85f70cf
@jdalton jdalton added a commit that referenced this issue Sep 25, 2014
@jdalton jdalton Ensure `underscore` build internal `forOwn` will accept a `thisArg` a…
…rgument. [closes #220].

Former-commit-id: a7818db29e81b64556232bfe44b2e1275d3dada1
d77c9d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment