Update index.js

Fixed global variable leakage.
Before it broke unit tests that depended on this plugin.