refactor, cli, mocha tests

- add module pattern - works node.js and browser
- add .gitignore
- add mocha tests
- add cli support
- refactoring