add unit tests and fix range function.

also add README and fix package.json