Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manipulation of prototype returns in an error when using 'lodash' #8

Closed
nhebling opened this issue May 4, 2015 · 2 comments
Closed

Comments

@nhebling
Copy link

nhebling commented May 4, 2015

Hi,

using this module (in my case required by 'loadtest') together with 'lodash' you will get an error on execution.
The problem is that if you require 'prototypes' (or 'loadtest') first and then after that load 'lodash'; lodash will fail in index.js (12103).
lodash is searching for different functions and one is "toArray" - and exactly this is added by 'prototypes' to the prototype of "Object".
From my point of view you should avoid this kind of global Object manipulation with very generalized functions as "toArray" on the Object.prototype can be very commonly used (as well as other functions you are adding e.g. forEach, concat, isArray)
'lodash' is downloaded about 200.000 times the last day according to npm, so this issue might occur more often (and that's just lodash)
I can temporarily workaround the issue by changing the order of the require statements, but that's not a nice and clean solution.

Thanks for fixing.

@ajcarpenter
Copy link

+1. Hit this same issue using loadtest.

alexfernandez pushed a commit that referenced this issue May 10, 2015
Due to incompatibilities with lodash, as explained in #8.
Use Array.toArray() instead.
@alexfernandez
Copy link
Owner

Thanks for the detailed bug report and the dissection, it was very useful to reproduce and fix the issue quickly.

Solved in commit 96bca01, which has been released in version 0.4.0. Just update to the new loadtest v1.2.11 and it should solve the issue. Please reopen if it should be a problem again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants