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

Maybe use semicolons to complete function definitions #61

Closed
shyndman opened this issue Jan 17, 2014 · 2 comments
Closed

Maybe use semicolons to complete function definitions #61

shyndman opened this issue Jan 17, 2014 · 2 comments

Comments

@shyndman
Copy link

Hi there,

I encountered a problem where after concat/minification, TokenStore.prototype.toJSON was an object, not a function. Weird, huh?

I did some digging and found that lunr was concatted into my lib file directly before another script that was using an anonymous function to avoid polluting global. Looked something like this:

lunr.TokenStore.prototype.toJSON = function () {
  return {
    root: this.root,
    length: this.length
  };
}(...other library code)();

Should have looked like this:

lunr.TokenStore.prototype.toJSON = function () {
  return {
    root: this.root,
    length: this.length
  };
}; 
(...other library code)();

Anyway, I got around it by changing my grunt config to use semicolon as a file separator, but it may be worthwhile to add semicolons directly in lunr.js to save some others some very weird debugging.

@olivernn
Copy link
Owner

I've just pushed version 0.4.4 with fixes for this issue, let me know if you are still having problems.

@shyndman
Copy link
Author

Thanks Oliver. Looks great.

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

2 participants