Update index.js

Add to check to see if target == environment or !target
Merge pull request #11 from Schlogen/patch-1

Update to respect environment