Update index.js

Replaced `.replace()` with switch cases for better performance.
Benchmark: http://jsperf.com/wildcard-glob-switch-replace