Update index.js

Fixed global variable leakage.
Before it broke unit tests that depended on this plugin.
Merge pull request #3 from kristjanmik/patch-1

Fix global variable leakage.