If you’re worried about people stealing your Javascript code, here’s a pretty good deterrent. It’s called JScrambler.
https://jscrambler.com
If you want to optimize and minify your JS, Google’s Closure Compiler may be what you need.
https://developers.google.com/closure/compiler/