improve js function min