You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello @acarl005. The fact that your functions need this to function has this somewhat uncomfortable side-effect that you cannot use them without calling them from the generatorics object.
Here is what I mean:
// If you do the following for instance:varcombination=require('generatorics').combination;// This will throw & fail because the function does not have the required scopecombination([1,2,3],2);
A solution would be to bind your function to the correct scope before exporting or rewrite the code marginally not to rely on the scope of the generatorics object.
The text was updated successfully, but these errors were encountered:
@Yomguithereal Thanks for the feedback! You're absolutely right. I've always found it annoying when I have to manually re-bind methods to their context. The API could certainly be better. A PR would be greatly appreciated!
Hello @acarl005. The fact that your functions need
this
to function has this somewhat uncomfortable side-effect that you cannot use them without calling them from the generatorics object.Here is what I mean:
A solution would be to bind your function to the correct scope before exporting or rewrite the code marginally not to rely on the scope of the generatorics object.
The text was updated successfully, but these errors were encountered: