Rewrite to js

- rewrite coffee to js
- rewrite tests to js
- clean code style