Update index.js

Exporting the function directly.