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

Hashmap breaks when minified #23

Closed
fresheneesz opened this issue May 21, 2016 · 2 comments
Closed

Hashmap breaks when minified #23

fresheneesz opened this issue May 21, 2016 · 2 comments

Comments

@fresheneesz
Copy link
Contributor

I've noticed that when hashmap is minified, this.type doesn't work correctly. The reason is the automatic chaining which does the followin check:

if (fn.toString().indexOf('return ') === -1) {
    proto[method] = chain(fn);
}

In minified code, it seems type is transformed into this:

type: function(t) {var e = Object.prototype.toString.call(t), n = e.slice(8, -1).toLowerCase();return"domwindow" !== n || t ? n : t + ""}

Because there's no space between return and "domwindow", the check causes type to be chained, returning this instead of the correct return value.

I propose that you explicitly list the names of the methods you want to chain instead of doing checks based on the structure of the function. But why did you have the space after return in that string to check anyway?

@fresheneesz
Copy link
Contributor Author

This update should fix the problem: #24

@flesler
Copy link
Owner

flesler commented May 22, 2016

I saw the PR before this, I think we just have the PR.
Anyway, we could also change return to return. But in all truth, while I like the nifty auto-detection, it's simply less code to just hardcode the names.

I'll comment on the PR about changes

@flesler flesler closed this as completed Jun 23, 2016
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