-
Notifications
You must be signed in to change notification settings - Fork 10
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
Minify? #3
Comments
Great point. Can you provide some examples? |
See my update above. |
What about this: var f = Over({
"string, number": function(s, n){ /* ... */ },
"string, string, number": function(s, s2, n){ /* ... */ },
"string, etc": function(s, etc){ /* ... */ }
}); |
(We could then support both versions) |
Yeah, that's much better than my proposed solution, looks clean. |
I got inspired by your script and gave it a try at building my own way following the solution you proposed. The script is very simple, it doesn't do any serialization or even throw exception, it just fallbacks to the closest signature or to an empty function. Extra arguments are always passed as an array at the end. I uploaded a little gist if you want to take a look. https://gist.github.com/elclanrs/6986187 |
👍 for passing object to Over. This allows optional arguments be notes more human readable, instead of var f = Over({
"string, object?, function": function(name, options, callback){ /* ... */ },
"string, [object], function": function(s, s2, n){ /* ... */ }
}); |
Nice script, I can see myself using this often but as-is it would break when minified, given that you're serializing the function. A workaround could be the approach that Angular takes, passing an array with the arguments as strings so they don't get mangled after minifying. Maybe something like this? Just thinking out loud:
The text was updated successfully, but these errors were encountered: