Update index.js

added namedFunc function, changed scan function