Update index.js

fix TypeError on node < 0.10