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

... signature.

Finishing a1fdc93831e775b54ab7ebea4dc37321cfae3ad2.
My bad. I thought it was only in one file... fixed it now.