convert to npm package and move tests to mocha