Refactor index.js and tests to fit `require, exports, module` definition signature.