Closed mathiasbynens closed 11 years ago
I actually wanted this while trying out luamin. As minify is generally only called once the overloading shouldn't even happen in most cases.
Personally I prefer the solution of reusing minify :+1:
Implemented in b5ff809b6d8bfb9350d4212bed6b48f397f45934.
For some reason I absolutely love that this is possible now:
$ luaparse --scope 'a = 42' | luamin -a
a=42
@kitcambridge @jdalton If you still have any opinions on overloading functions vs. creating separate functions in general, please share :)
@mathiasbynens It's a case by case basis (overloading vs. separate functions).
In some situations it would be useful to have a
minifyAST
method that takes a luaparse-generated AST and returns the minified Lua code as a string (as opposed tominify()
which takes a Lua string and returns a minified Lua string).We could make
minify(ast)
work as well (by simply adding atypeof
check tominify()
), but I’m not sure what would be the best solution. Overloadingminify
would have a minor impact on its performance, but API-wise it’s probably the most ideal solution.Any opinions on this? /cc @oxyc @jdalton @kitcambridge