fix jslinst errors and refactor loops

loop code in dependencies.js refactored to meet Brackets coding
conventions.