Update index.js

added function hasExtension