refactor locate_file function

- fix bug with global scope attachment
- immediate return if index
- remove lodash dep
Merge pull request #3 from carrot/fixes

Refactor locate_file function